google_cloud_api_servicemanagement_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 service_manager {
18 use crate::Result;
19
20 /// A builder for [ServiceManager][crate::client::ServiceManager].
21 ///
22 /// ```
23 /// # tokio_test::block_on(async {
24 /// # use google_cloud_api_servicemanagement_v1::*;
25 /// # use builder::service_manager::ClientBuilder;
26 /// # use client::ServiceManager;
27 /// let builder : ClientBuilder = ServiceManager::builder();
28 /// let client = builder
29 /// .with_endpoint("https://servicemanagement.googleapis.com")
30 /// .build().await?;
31 /// # gax::client_builder::Result::<()>::Ok(()) });
32 /// ```
33 pub type ClientBuilder =
34 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
35
36 pub(crate) mod client {
37 use super::super::super::client::ServiceManager;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = ServiceManager;
41 type Credentials = gaxi::options::Credentials;
42 async fn build(
43 self,
44 config: gaxi::options::ClientConfig,
45 ) -> gax::client_builder::Result<Self::Client> {
46 Self::Client::new(config).await
47 }
48 }
49 }
50
51 /// Common implementation for [crate::client::ServiceManager] request builders.
52 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
55 request: R,
56 options: gax::options::RequestOptions,
57 }
58
59 impl<R> RequestBuilder<R>
60 where
61 R: std::default::Default,
62 {
63 pub(crate) fn new(
64 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
65 ) -> Self {
66 Self {
67 stub,
68 request: R::default(),
69 options: gax::options::RequestOptions::default(),
70 }
71 }
72 }
73
74 /// The request builder for [ServiceManager::list_services][crate::client::ServiceManager::list_services] calls.
75 ///
76 /// # Example
77 /// ```no_run
78 /// # use google_cloud_api_servicemanagement_v1::builder;
79 /// use builder::service_manager::ListServices;
80 /// # tokio_test::block_on(async {
81 /// use gax::paginator::ItemPaginator;
82 ///
83 /// let builder = prepare_request_builder();
84 /// let mut items = builder.by_item();
85 /// while let Some(result) = items.next().await {
86 /// let item = result?;
87 /// }
88 /// # gax::Result::<()>::Ok(()) });
89 ///
90 /// fn prepare_request_builder() -> ListServices {
91 /// # panic!();
92 /// // ... details omitted ...
93 /// }
94 /// ```
95 #[derive(Clone, Debug)]
96 pub struct ListServices(RequestBuilder<crate::model::ListServicesRequest>);
97
98 impl ListServices {
99 pub(crate) fn new(
100 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
101 ) -> Self {
102 Self(RequestBuilder::new(stub))
103 }
104
105 /// Sets the full request, replacing any prior values.
106 pub fn with_request<V: Into<crate::model::ListServicesRequest>>(mut self, v: V) -> Self {
107 self.0.request = v.into();
108 self
109 }
110
111 /// Sets all the options, replacing any prior values.
112 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
113 self.0.options = v.into();
114 self
115 }
116
117 /// Sends the request.
118 pub async fn send(self) -> Result<crate::model::ListServicesResponse> {
119 (*self.0.stub)
120 .list_services(self.0.request, self.0.options)
121 .await
122 .map(gax::response::Response::into_body)
123 }
124
125 /// Streams each page in the collection.
126 pub fn by_page(
127 self,
128 ) -> impl gax::paginator::Paginator<crate::model::ListServicesResponse, gax::error::Error>
129 {
130 use std::clone::Clone;
131 let token = self.0.request.page_token.clone();
132 let execute = move |token: String| {
133 let mut builder = self.clone();
134 builder.0.request = builder.0.request.set_page_token(token);
135 builder.send()
136 };
137 gax::paginator::internal::new_paginator(token, execute)
138 }
139
140 /// Streams each item in the collection.
141 pub fn by_item(
142 self,
143 ) -> impl gax::paginator::ItemPaginator<crate::model::ListServicesResponse, gax::error::Error>
144 {
145 use gax::paginator::Paginator;
146 self.by_page().items()
147 }
148
149 /// Sets the value of [producer_project_id][crate::model::ListServicesRequest::producer_project_id].
150 pub fn set_producer_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
151 self.0.request.producer_project_id = v.into();
152 self
153 }
154
155 /// Sets the value of [page_size][crate::model::ListServicesRequest::page_size].
156 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
157 self.0.request.page_size = v.into();
158 self
159 }
160
161 /// Sets the value of [page_token][crate::model::ListServicesRequest::page_token].
162 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
163 self.0.request.page_token = v.into();
164 self
165 }
166
167 /// Sets the value of [consumer_id][crate::model::ListServicesRequest::consumer_id].
168 #[deprecated]
169 pub fn set_consumer_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
170 self.0.request.consumer_id = v.into();
171 self
172 }
173 }
174
175 #[doc(hidden)]
176 impl gax::options::internal::RequestBuilder for ListServices {
177 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
178 &mut self.0.options
179 }
180 }
181
182 /// The request builder for [ServiceManager::get_service][crate::client::ServiceManager::get_service] calls.
183 ///
184 /// # Example
185 /// ```no_run
186 /// # use google_cloud_api_servicemanagement_v1::builder;
187 /// use builder::service_manager::GetService;
188 /// # tokio_test::block_on(async {
189 ///
190 /// let builder = prepare_request_builder();
191 /// let response = builder.send().await?;
192 /// # gax::Result::<()>::Ok(()) });
193 ///
194 /// fn prepare_request_builder() -> GetService {
195 /// # panic!();
196 /// // ... details omitted ...
197 /// }
198 /// ```
199 #[derive(Clone, Debug)]
200 pub struct GetService(RequestBuilder<crate::model::GetServiceRequest>);
201
202 impl GetService {
203 pub(crate) fn new(
204 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
205 ) -> Self {
206 Self(RequestBuilder::new(stub))
207 }
208
209 /// Sets the full request, replacing any prior values.
210 pub fn with_request<V: Into<crate::model::GetServiceRequest>>(mut self, v: V) -> Self {
211 self.0.request = v.into();
212 self
213 }
214
215 /// Sets all the options, replacing any prior values.
216 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
217 self.0.options = v.into();
218 self
219 }
220
221 /// Sends the request.
222 pub async fn send(self) -> Result<crate::model::ManagedService> {
223 (*self.0.stub)
224 .get_service(self.0.request, self.0.options)
225 .await
226 .map(gax::response::Response::into_body)
227 }
228
229 /// Sets the value of [service_name][crate::model::GetServiceRequest::service_name].
230 ///
231 /// This is a **required** field for requests.
232 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
233 self.0.request.service_name = v.into();
234 self
235 }
236 }
237
238 #[doc(hidden)]
239 impl gax::options::internal::RequestBuilder for GetService {
240 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
241 &mut self.0.options
242 }
243 }
244
245 /// The request builder for [ServiceManager::create_service][crate::client::ServiceManager::create_service] calls.
246 ///
247 /// # Example
248 /// ```no_run
249 /// # use google_cloud_api_servicemanagement_v1::builder;
250 /// use builder::service_manager::CreateService;
251 /// # tokio_test::block_on(async {
252 /// use lro::Poller;
253 ///
254 /// let builder = prepare_request_builder();
255 /// let response = builder.poller().until_done().await?;
256 /// # gax::Result::<()>::Ok(()) });
257 ///
258 /// fn prepare_request_builder() -> CreateService {
259 /// # panic!();
260 /// // ... details omitted ...
261 /// }
262 /// ```
263 #[derive(Clone, Debug)]
264 pub struct CreateService(RequestBuilder<crate::model::CreateServiceRequest>);
265
266 impl CreateService {
267 pub(crate) fn new(
268 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
269 ) -> Self {
270 Self(RequestBuilder::new(stub))
271 }
272
273 /// Sets the full request, replacing any prior values.
274 pub fn with_request<V: Into<crate::model::CreateServiceRequest>>(mut self, v: V) -> Self {
275 self.0.request = v.into();
276 self
277 }
278
279 /// Sets all the options, replacing any prior values.
280 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
281 self.0.options = v.into();
282 self
283 }
284
285 /// Sends the request.
286 ///
287 /// # Long running operations
288 ///
289 /// This starts, but does not poll, a longrunning operation. More information
290 /// on [create_service][crate::client::ServiceManager::create_service].
291 pub async fn send(self) -> Result<longrunning::model::Operation> {
292 (*self.0.stub)
293 .create_service(self.0.request, self.0.options)
294 .await
295 .map(gax::response::Response::into_body)
296 }
297
298 /// Creates a [Poller][lro::Poller] to work with `create_service`.
299 pub fn poller(
300 self,
301 ) -> impl lro::Poller<crate::model::ManagedService, crate::model::OperationMetadata>
302 {
303 type Operation = lro::internal::Operation<
304 crate::model::ManagedService,
305 crate::model::OperationMetadata,
306 >;
307 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
308 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
309
310 let stub = self.0.stub.clone();
311 let mut options = self.0.options.clone();
312 options.set_retry_policy(gax::retry_policy::NeverRetry);
313 let query = move |name| {
314 let stub = stub.clone();
315 let options = options.clone();
316 async {
317 let op = GetOperation::new(stub)
318 .set_name(name)
319 .with_options(options)
320 .send()
321 .await?;
322 Ok(Operation::new(op))
323 }
324 };
325
326 let start = move || async {
327 let op = self.send().await?;
328 Ok(Operation::new(op))
329 };
330
331 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
332 }
333
334 /// Sets the value of [service][crate::model::CreateServiceRequest::service].
335 ///
336 /// This is a **required** field for requests.
337 pub fn set_service<T>(mut self, v: T) -> Self
338 where
339 T: std::convert::Into<crate::model::ManagedService>,
340 {
341 self.0.request.service = std::option::Option::Some(v.into());
342 self
343 }
344
345 /// Sets or clears the value of [service][crate::model::CreateServiceRequest::service].
346 ///
347 /// This is a **required** field for requests.
348 pub fn set_or_clear_service<T>(mut self, v: std::option::Option<T>) -> Self
349 where
350 T: std::convert::Into<crate::model::ManagedService>,
351 {
352 self.0.request.service = v.map(|x| x.into());
353 self
354 }
355 }
356
357 #[doc(hidden)]
358 impl gax::options::internal::RequestBuilder for CreateService {
359 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
360 &mut self.0.options
361 }
362 }
363
364 /// The request builder for [ServiceManager::delete_service][crate::client::ServiceManager::delete_service] calls.
365 ///
366 /// # Example
367 /// ```no_run
368 /// # use google_cloud_api_servicemanagement_v1::builder;
369 /// use builder::service_manager::DeleteService;
370 /// # tokio_test::block_on(async {
371 /// use lro::Poller;
372 ///
373 /// let builder = prepare_request_builder();
374 /// let response = builder.poller().until_done().await?;
375 /// # gax::Result::<()>::Ok(()) });
376 ///
377 /// fn prepare_request_builder() -> DeleteService {
378 /// # panic!();
379 /// // ... details omitted ...
380 /// }
381 /// ```
382 #[derive(Clone, Debug)]
383 pub struct DeleteService(RequestBuilder<crate::model::DeleteServiceRequest>);
384
385 impl DeleteService {
386 pub(crate) fn new(
387 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
388 ) -> Self {
389 Self(RequestBuilder::new(stub))
390 }
391
392 /// Sets the full request, replacing any prior values.
393 pub fn with_request<V: Into<crate::model::DeleteServiceRequest>>(mut self, v: V) -> Self {
394 self.0.request = v.into();
395 self
396 }
397
398 /// Sets all the options, replacing any prior values.
399 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
400 self.0.options = v.into();
401 self
402 }
403
404 /// Sends the request.
405 ///
406 /// # Long running operations
407 ///
408 /// This starts, but does not poll, a longrunning operation. More information
409 /// on [delete_service][crate::client::ServiceManager::delete_service].
410 pub async fn send(self) -> Result<longrunning::model::Operation> {
411 (*self.0.stub)
412 .delete_service(self.0.request, self.0.options)
413 .await
414 .map(gax::response::Response::into_body)
415 }
416
417 /// Creates a [Poller][lro::Poller] to work with `delete_service`.
418 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
419 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
420 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
421 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
422
423 let stub = self.0.stub.clone();
424 let mut options = self.0.options.clone();
425 options.set_retry_policy(gax::retry_policy::NeverRetry);
426 let query = move |name| {
427 let stub = stub.clone();
428 let options = options.clone();
429 async {
430 let op = GetOperation::new(stub)
431 .set_name(name)
432 .with_options(options)
433 .send()
434 .await?;
435 Ok(Operation::new(op))
436 }
437 };
438
439 let start = move || async {
440 let op = self.send().await?;
441 Ok(Operation::new(op))
442 };
443
444 lro::internal::new_unit_response_poller(
445 polling_error_policy,
446 polling_backoff_policy,
447 start,
448 query,
449 )
450 }
451
452 /// Sets the value of [service_name][crate::model::DeleteServiceRequest::service_name].
453 ///
454 /// This is a **required** field for requests.
455 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
456 self.0.request.service_name = v.into();
457 self
458 }
459 }
460
461 #[doc(hidden)]
462 impl gax::options::internal::RequestBuilder for DeleteService {
463 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
464 &mut self.0.options
465 }
466 }
467
468 /// The request builder for [ServiceManager::undelete_service][crate::client::ServiceManager::undelete_service] calls.
469 ///
470 /// # Example
471 /// ```no_run
472 /// # use google_cloud_api_servicemanagement_v1::builder;
473 /// use builder::service_manager::UndeleteService;
474 /// # tokio_test::block_on(async {
475 /// use lro::Poller;
476 ///
477 /// let builder = prepare_request_builder();
478 /// let response = builder.poller().until_done().await?;
479 /// # gax::Result::<()>::Ok(()) });
480 ///
481 /// fn prepare_request_builder() -> UndeleteService {
482 /// # panic!();
483 /// // ... details omitted ...
484 /// }
485 /// ```
486 #[derive(Clone, Debug)]
487 pub struct UndeleteService(RequestBuilder<crate::model::UndeleteServiceRequest>);
488
489 impl UndeleteService {
490 pub(crate) fn new(
491 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
492 ) -> Self {
493 Self(RequestBuilder::new(stub))
494 }
495
496 /// Sets the full request, replacing any prior values.
497 pub fn with_request<V: Into<crate::model::UndeleteServiceRequest>>(mut self, v: V) -> Self {
498 self.0.request = v.into();
499 self
500 }
501
502 /// Sets all the options, replacing any prior values.
503 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
504 self.0.options = v.into();
505 self
506 }
507
508 /// Sends the request.
509 ///
510 /// # Long running operations
511 ///
512 /// This starts, but does not poll, a longrunning operation. More information
513 /// on [undelete_service][crate::client::ServiceManager::undelete_service].
514 pub async fn send(self) -> Result<longrunning::model::Operation> {
515 (*self.0.stub)
516 .undelete_service(self.0.request, self.0.options)
517 .await
518 .map(gax::response::Response::into_body)
519 }
520
521 /// Creates a [Poller][lro::Poller] to work with `undelete_service`.
522 pub fn poller(
523 self,
524 ) -> impl lro::Poller<crate::model::UndeleteServiceResponse, crate::model::OperationMetadata>
525 {
526 type Operation = lro::internal::Operation<
527 crate::model::UndeleteServiceResponse,
528 crate::model::OperationMetadata,
529 >;
530 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
531 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
532
533 let stub = self.0.stub.clone();
534 let mut options = self.0.options.clone();
535 options.set_retry_policy(gax::retry_policy::NeverRetry);
536 let query = move |name| {
537 let stub = stub.clone();
538 let options = options.clone();
539 async {
540 let op = GetOperation::new(stub)
541 .set_name(name)
542 .with_options(options)
543 .send()
544 .await?;
545 Ok(Operation::new(op))
546 }
547 };
548
549 let start = move || async {
550 let op = self.send().await?;
551 Ok(Operation::new(op))
552 };
553
554 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
555 }
556
557 /// Sets the value of [service_name][crate::model::UndeleteServiceRequest::service_name].
558 ///
559 /// This is a **required** field for requests.
560 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
561 self.0.request.service_name = v.into();
562 self
563 }
564 }
565
566 #[doc(hidden)]
567 impl gax::options::internal::RequestBuilder for UndeleteService {
568 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
569 &mut self.0.options
570 }
571 }
572
573 /// The request builder for [ServiceManager::list_service_configs][crate::client::ServiceManager::list_service_configs] calls.
574 ///
575 /// # Example
576 /// ```no_run
577 /// # use google_cloud_api_servicemanagement_v1::builder;
578 /// use builder::service_manager::ListServiceConfigs;
579 /// # tokio_test::block_on(async {
580 /// use gax::paginator::ItemPaginator;
581 ///
582 /// let builder = prepare_request_builder();
583 /// let mut items = builder.by_item();
584 /// while let Some(result) = items.next().await {
585 /// let item = result?;
586 /// }
587 /// # gax::Result::<()>::Ok(()) });
588 ///
589 /// fn prepare_request_builder() -> ListServiceConfigs {
590 /// # panic!();
591 /// // ... details omitted ...
592 /// }
593 /// ```
594 #[derive(Clone, Debug)]
595 pub struct ListServiceConfigs(RequestBuilder<crate::model::ListServiceConfigsRequest>);
596
597 impl ListServiceConfigs {
598 pub(crate) fn new(
599 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
600 ) -> Self {
601 Self(RequestBuilder::new(stub))
602 }
603
604 /// Sets the full request, replacing any prior values.
605 pub fn with_request<V: Into<crate::model::ListServiceConfigsRequest>>(
606 mut self,
607 v: V,
608 ) -> Self {
609 self.0.request = v.into();
610 self
611 }
612
613 /// Sets all the options, replacing any prior values.
614 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
615 self.0.options = v.into();
616 self
617 }
618
619 /// Sends the request.
620 pub async fn send(self) -> Result<crate::model::ListServiceConfigsResponse> {
621 (*self.0.stub)
622 .list_service_configs(self.0.request, self.0.options)
623 .await
624 .map(gax::response::Response::into_body)
625 }
626
627 /// Streams each page in the collection.
628 pub fn by_page(
629 self,
630 ) -> impl gax::paginator::Paginator<crate::model::ListServiceConfigsResponse, gax::error::Error>
631 {
632 use std::clone::Clone;
633 let token = self.0.request.page_token.clone();
634 let execute = move |token: String| {
635 let mut builder = self.clone();
636 builder.0.request = builder.0.request.set_page_token(token);
637 builder.send()
638 };
639 gax::paginator::internal::new_paginator(token, execute)
640 }
641
642 /// Streams each item in the collection.
643 pub fn by_item(
644 self,
645 ) -> impl gax::paginator::ItemPaginator<
646 crate::model::ListServiceConfigsResponse,
647 gax::error::Error,
648 > {
649 use gax::paginator::Paginator;
650 self.by_page().items()
651 }
652
653 /// Sets the value of [service_name][crate::model::ListServiceConfigsRequest::service_name].
654 ///
655 /// This is a **required** field for requests.
656 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
657 self.0.request.service_name = v.into();
658 self
659 }
660
661 /// Sets the value of [page_token][crate::model::ListServiceConfigsRequest::page_token].
662 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
663 self.0.request.page_token = v.into();
664 self
665 }
666
667 /// Sets the value of [page_size][crate::model::ListServiceConfigsRequest::page_size].
668 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
669 self.0.request.page_size = v.into();
670 self
671 }
672 }
673
674 #[doc(hidden)]
675 impl gax::options::internal::RequestBuilder for ListServiceConfigs {
676 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
677 &mut self.0.options
678 }
679 }
680
681 /// The request builder for [ServiceManager::get_service_config][crate::client::ServiceManager::get_service_config] calls.
682 ///
683 /// # Example
684 /// ```no_run
685 /// # use google_cloud_api_servicemanagement_v1::builder;
686 /// use builder::service_manager::GetServiceConfig;
687 /// # tokio_test::block_on(async {
688 ///
689 /// let builder = prepare_request_builder();
690 /// let response = builder.send().await?;
691 /// # gax::Result::<()>::Ok(()) });
692 ///
693 /// fn prepare_request_builder() -> GetServiceConfig {
694 /// # panic!();
695 /// // ... details omitted ...
696 /// }
697 /// ```
698 #[derive(Clone, Debug)]
699 pub struct GetServiceConfig(RequestBuilder<crate::model::GetServiceConfigRequest>);
700
701 impl GetServiceConfig {
702 pub(crate) fn new(
703 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
704 ) -> Self {
705 Self(RequestBuilder::new(stub))
706 }
707
708 /// Sets the full request, replacing any prior values.
709 pub fn with_request<V: Into<crate::model::GetServiceConfigRequest>>(
710 mut self,
711 v: V,
712 ) -> Self {
713 self.0.request = v.into();
714 self
715 }
716
717 /// Sets all the options, replacing any prior values.
718 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
719 self.0.options = v.into();
720 self
721 }
722
723 /// Sends the request.
724 pub async fn send(self) -> Result<api::model::Service> {
725 (*self.0.stub)
726 .get_service_config(self.0.request, self.0.options)
727 .await
728 .map(gax::response::Response::into_body)
729 }
730
731 /// Sets the value of [service_name][crate::model::GetServiceConfigRequest::service_name].
732 ///
733 /// This is a **required** field for requests.
734 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
735 self.0.request.service_name = v.into();
736 self
737 }
738
739 /// Sets the value of [config_id][crate::model::GetServiceConfigRequest::config_id].
740 ///
741 /// This is a **required** field for requests.
742 pub fn set_config_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
743 self.0.request.config_id = v.into();
744 self
745 }
746
747 /// Sets the value of [view][crate::model::GetServiceConfigRequest::view].
748 pub fn set_view<T: Into<crate::model::get_service_config_request::ConfigView>>(
749 mut self,
750 v: T,
751 ) -> Self {
752 self.0.request.view = v.into();
753 self
754 }
755 }
756
757 #[doc(hidden)]
758 impl gax::options::internal::RequestBuilder for GetServiceConfig {
759 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
760 &mut self.0.options
761 }
762 }
763
764 /// The request builder for [ServiceManager::create_service_config][crate::client::ServiceManager::create_service_config] calls.
765 ///
766 /// # Example
767 /// ```no_run
768 /// # use google_cloud_api_servicemanagement_v1::builder;
769 /// use builder::service_manager::CreateServiceConfig;
770 /// # tokio_test::block_on(async {
771 ///
772 /// let builder = prepare_request_builder();
773 /// let response = builder.send().await?;
774 /// # gax::Result::<()>::Ok(()) });
775 ///
776 /// fn prepare_request_builder() -> CreateServiceConfig {
777 /// # panic!();
778 /// // ... details omitted ...
779 /// }
780 /// ```
781 #[derive(Clone, Debug)]
782 pub struct CreateServiceConfig(RequestBuilder<crate::model::CreateServiceConfigRequest>);
783
784 impl CreateServiceConfig {
785 pub(crate) fn new(
786 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
787 ) -> Self {
788 Self(RequestBuilder::new(stub))
789 }
790
791 /// Sets the full request, replacing any prior values.
792 pub fn with_request<V: Into<crate::model::CreateServiceConfigRequest>>(
793 mut self,
794 v: V,
795 ) -> Self {
796 self.0.request = v.into();
797 self
798 }
799
800 /// Sets all the options, replacing any prior values.
801 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
802 self.0.options = v.into();
803 self
804 }
805
806 /// Sends the request.
807 pub async fn send(self) -> Result<api::model::Service> {
808 (*self.0.stub)
809 .create_service_config(self.0.request, self.0.options)
810 .await
811 .map(gax::response::Response::into_body)
812 }
813
814 /// Sets the value of [service_name][crate::model::CreateServiceConfigRequest::service_name].
815 ///
816 /// This is a **required** field for requests.
817 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
818 self.0.request.service_name = v.into();
819 self
820 }
821
822 /// Sets the value of [service_config][crate::model::CreateServiceConfigRequest::service_config].
823 ///
824 /// This is a **required** field for requests.
825 pub fn set_service_config<T>(mut self, v: T) -> Self
826 where
827 T: std::convert::Into<api::model::Service>,
828 {
829 self.0.request.service_config = std::option::Option::Some(v.into());
830 self
831 }
832
833 /// Sets or clears the value of [service_config][crate::model::CreateServiceConfigRequest::service_config].
834 ///
835 /// This is a **required** field for requests.
836 pub fn set_or_clear_service_config<T>(mut self, v: std::option::Option<T>) -> Self
837 where
838 T: std::convert::Into<api::model::Service>,
839 {
840 self.0.request.service_config = v.map(|x| x.into());
841 self
842 }
843 }
844
845 #[doc(hidden)]
846 impl gax::options::internal::RequestBuilder for CreateServiceConfig {
847 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
848 &mut self.0.options
849 }
850 }
851
852 /// The request builder for [ServiceManager::submit_config_source][crate::client::ServiceManager::submit_config_source] calls.
853 ///
854 /// # Example
855 /// ```no_run
856 /// # use google_cloud_api_servicemanagement_v1::builder;
857 /// use builder::service_manager::SubmitConfigSource;
858 /// # tokio_test::block_on(async {
859 /// use lro::Poller;
860 ///
861 /// let builder = prepare_request_builder();
862 /// let response = builder.poller().until_done().await?;
863 /// # gax::Result::<()>::Ok(()) });
864 ///
865 /// fn prepare_request_builder() -> SubmitConfigSource {
866 /// # panic!();
867 /// // ... details omitted ...
868 /// }
869 /// ```
870 #[derive(Clone, Debug)]
871 pub struct SubmitConfigSource(RequestBuilder<crate::model::SubmitConfigSourceRequest>);
872
873 impl SubmitConfigSource {
874 pub(crate) fn new(
875 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
876 ) -> Self {
877 Self(RequestBuilder::new(stub))
878 }
879
880 /// Sets the full request, replacing any prior values.
881 pub fn with_request<V: Into<crate::model::SubmitConfigSourceRequest>>(
882 mut self,
883 v: V,
884 ) -> Self {
885 self.0.request = v.into();
886 self
887 }
888
889 /// Sets all the options, replacing any prior values.
890 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
891 self.0.options = v.into();
892 self
893 }
894
895 /// Sends the request.
896 ///
897 /// # Long running operations
898 ///
899 /// This starts, but does not poll, a longrunning operation. More information
900 /// on [submit_config_source][crate::client::ServiceManager::submit_config_source].
901 pub async fn send(self) -> Result<longrunning::model::Operation> {
902 (*self.0.stub)
903 .submit_config_source(self.0.request, self.0.options)
904 .await
905 .map(gax::response::Response::into_body)
906 }
907
908 /// Creates a [Poller][lro::Poller] to work with `submit_config_source`.
909 pub fn poller(
910 self,
911 ) -> impl lro::Poller<crate::model::SubmitConfigSourceResponse, crate::model::OperationMetadata>
912 {
913 type Operation = lro::internal::Operation<
914 crate::model::SubmitConfigSourceResponse,
915 crate::model::OperationMetadata,
916 >;
917 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
918 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
919
920 let stub = self.0.stub.clone();
921 let mut options = self.0.options.clone();
922 options.set_retry_policy(gax::retry_policy::NeverRetry);
923 let query = move |name| {
924 let stub = stub.clone();
925 let options = options.clone();
926 async {
927 let op = GetOperation::new(stub)
928 .set_name(name)
929 .with_options(options)
930 .send()
931 .await?;
932 Ok(Operation::new(op))
933 }
934 };
935
936 let start = move || async {
937 let op = self.send().await?;
938 Ok(Operation::new(op))
939 };
940
941 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
942 }
943
944 /// Sets the value of [service_name][crate::model::SubmitConfigSourceRequest::service_name].
945 ///
946 /// This is a **required** field for requests.
947 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
948 self.0.request.service_name = v.into();
949 self
950 }
951
952 /// Sets the value of [config_source][crate::model::SubmitConfigSourceRequest::config_source].
953 ///
954 /// This is a **required** field for requests.
955 pub fn set_config_source<T>(mut self, v: T) -> Self
956 where
957 T: std::convert::Into<crate::model::ConfigSource>,
958 {
959 self.0.request.config_source = std::option::Option::Some(v.into());
960 self
961 }
962
963 /// Sets or clears the value of [config_source][crate::model::SubmitConfigSourceRequest::config_source].
964 ///
965 /// This is a **required** field for requests.
966 pub fn set_or_clear_config_source<T>(mut self, v: std::option::Option<T>) -> Self
967 where
968 T: std::convert::Into<crate::model::ConfigSource>,
969 {
970 self.0.request.config_source = v.map(|x| x.into());
971 self
972 }
973
974 /// Sets the value of [validate_only][crate::model::SubmitConfigSourceRequest::validate_only].
975 pub fn set_validate_only<T: Into<bool>>(mut self, v: T) -> Self {
976 self.0.request.validate_only = v.into();
977 self
978 }
979 }
980
981 #[doc(hidden)]
982 impl gax::options::internal::RequestBuilder for SubmitConfigSource {
983 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
984 &mut self.0.options
985 }
986 }
987
988 /// The request builder for [ServiceManager::list_service_rollouts][crate::client::ServiceManager::list_service_rollouts] calls.
989 ///
990 /// # Example
991 /// ```no_run
992 /// # use google_cloud_api_servicemanagement_v1::builder;
993 /// use builder::service_manager::ListServiceRollouts;
994 /// # tokio_test::block_on(async {
995 /// use gax::paginator::ItemPaginator;
996 ///
997 /// let builder = prepare_request_builder();
998 /// let mut items = builder.by_item();
999 /// while let Some(result) = items.next().await {
1000 /// let item = result?;
1001 /// }
1002 /// # gax::Result::<()>::Ok(()) });
1003 ///
1004 /// fn prepare_request_builder() -> ListServiceRollouts {
1005 /// # panic!();
1006 /// // ... details omitted ...
1007 /// }
1008 /// ```
1009 #[derive(Clone, Debug)]
1010 pub struct ListServiceRollouts(RequestBuilder<crate::model::ListServiceRolloutsRequest>);
1011
1012 impl ListServiceRollouts {
1013 pub(crate) fn new(
1014 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
1015 ) -> Self {
1016 Self(RequestBuilder::new(stub))
1017 }
1018
1019 /// Sets the full request, replacing any prior values.
1020 pub fn with_request<V: Into<crate::model::ListServiceRolloutsRequest>>(
1021 mut self,
1022 v: V,
1023 ) -> Self {
1024 self.0.request = v.into();
1025 self
1026 }
1027
1028 /// Sets all the options, replacing any prior values.
1029 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1030 self.0.options = v.into();
1031 self
1032 }
1033
1034 /// Sends the request.
1035 pub async fn send(self) -> Result<crate::model::ListServiceRolloutsResponse> {
1036 (*self.0.stub)
1037 .list_service_rollouts(self.0.request, self.0.options)
1038 .await
1039 .map(gax::response::Response::into_body)
1040 }
1041
1042 /// Streams each page in the collection.
1043 pub fn by_page(
1044 self,
1045 ) -> impl gax::paginator::Paginator<crate::model::ListServiceRolloutsResponse, gax::error::Error>
1046 {
1047 use std::clone::Clone;
1048 let token = self.0.request.page_token.clone();
1049 let execute = move |token: String| {
1050 let mut builder = self.clone();
1051 builder.0.request = builder.0.request.set_page_token(token);
1052 builder.send()
1053 };
1054 gax::paginator::internal::new_paginator(token, execute)
1055 }
1056
1057 /// Streams each item in the collection.
1058 pub fn by_item(
1059 self,
1060 ) -> impl gax::paginator::ItemPaginator<
1061 crate::model::ListServiceRolloutsResponse,
1062 gax::error::Error,
1063 > {
1064 use gax::paginator::Paginator;
1065 self.by_page().items()
1066 }
1067
1068 /// Sets the value of [service_name][crate::model::ListServiceRolloutsRequest::service_name].
1069 ///
1070 /// This is a **required** field for requests.
1071 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1072 self.0.request.service_name = v.into();
1073 self
1074 }
1075
1076 /// Sets the value of [page_token][crate::model::ListServiceRolloutsRequest::page_token].
1077 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1078 self.0.request.page_token = v.into();
1079 self
1080 }
1081
1082 /// Sets the value of [page_size][crate::model::ListServiceRolloutsRequest::page_size].
1083 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1084 self.0.request.page_size = v.into();
1085 self
1086 }
1087
1088 /// Sets the value of [filter][crate::model::ListServiceRolloutsRequest::filter].
1089 ///
1090 /// This is a **required** field for requests.
1091 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1092 self.0.request.filter = v.into();
1093 self
1094 }
1095 }
1096
1097 #[doc(hidden)]
1098 impl gax::options::internal::RequestBuilder for ListServiceRollouts {
1099 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1100 &mut self.0.options
1101 }
1102 }
1103
1104 /// The request builder for [ServiceManager::get_service_rollout][crate::client::ServiceManager::get_service_rollout] calls.
1105 ///
1106 /// # Example
1107 /// ```no_run
1108 /// # use google_cloud_api_servicemanagement_v1::builder;
1109 /// use builder::service_manager::GetServiceRollout;
1110 /// # tokio_test::block_on(async {
1111 ///
1112 /// let builder = prepare_request_builder();
1113 /// let response = builder.send().await?;
1114 /// # gax::Result::<()>::Ok(()) });
1115 ///
1116 /// fn prepare_request_builder() -> GetServiceRollout {
1117 /// # panic!();
1118 /// // ... details omitted ...
1119 /// }
1120 /// ```
1121 #[derive(Clone, Debug)]
1122 pub struct GetServiceRollout(RequestBuilder<crate::model::GetServiceRolloutRequest>);
1123
1124 impl GetServiceRollout {
1125 pub(crate) fn new(
1126 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
1127 ) -> Self {
1128 Self(RequestBuilder::new(stub))
1129 }
1130
1131 /// Sets the full request, replacing any prior values.
1132 pub fn with_request<V: Into<crate::model::GetServiceRolloutRequest>>(
1133 mut self,
1134 v: V,
1135 ) -> Self {
1136 self.0.request = v.into();
1137 self
1138 }
1139
1140 /// Sets all the options, replacing any prior values.
1141 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1142 self.0.options = v.into();
1143 self
1144 }
1145
1146 /// Sends the request.
1147 pub async fn send(self) -> Result<crate::model::Rollout> {
1148 (*self.0.stub)
1149 .get_service_rollout(self.0.request, self.0.options)
1150 .await
1151 .map(gax::response::Response::into_body)
1152 }
1153
1154 /// Sets the value of [service_name][crate::model::GetServiceRolloutRequest::service_name].
1155 ///
1156 /// This is a **required** field for requests.
1157 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1158 self.0.request.service_name = v.into();
1159 self
1160 }
1161
1162 /// Sets the value of [rollout_id][crate::model::GetServiceRolloutRequest::rollout_id].
1163 ///
1164 /// This is a **required** field for requests.
1165 pub fn set_rollout_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1166 self.0.request.rollout_id = v.into();
1167 self
1168 }
1169 }
1170
1171 #[doc(hidden)]
1172 impl gax::options::internal::RequestBuilder for GetServiceRollout {
1173 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1174 &mut self.0.options
1175 }
1176 }
1177
1178 /// The request builder for [ServiceManager::create_service_rollout][crate::client::ServiceManager::create_service_rollout] calls.
1179 ///
1180 /// # Example
1181 /// ```no_run
1182 /// # use google_cloud_api_servicemanagement_v1::builder;
1183 /// use builder::service_manager::CreateServiceRollout;
1184 /// # tokio_test::block_on(async {
1185 /// use lro::Poller;
1186 ///
1187 /// let builder = prepare_request_builder();
1188 /// let response = builder.poller().until_done().await?;
1189 /// # gax::Result::<()>::Ok(()) });
1190 ///
1191 /// fn prepare_request_builder() -> CreateServiceRollout {
1192 /// # panic!();
1193 /// // ... details omitted ...
1194 /// }
1195 /// ```
1196 #[derive(Clone, Debug)]
1197 pub struct CreateServiceRollout(RequestBuilder<crate::model::CreateServiceRolloutRequest>);
1198
1199 impl CreateServiceRollout {
1200 pub(crate) fn new(
1201 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
1202 ) -> Self {
1203 Self(RequestBuilder::new(stub))
1204 }
1205
1206 /// Sets the full request, replacing any prior values.
1207 pub fn with_request<V: Into<crate::model::CreateServiceRolloutRequest>>(
1208 mut self,
1209 v: V,
1210 ) -> Self {
1211 self.0.request = v.into();
1212 self
1213 }
1214
1215 /// Sets all the options, replacing any prior values.
1216 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1217 self.0.options = v.into();
1218 self
1219 }
1220
1221 /// Sends the request.
1222 ///
1223 /// # Long running operations
1224 ///
1225 /// This starts, but does not poll, a longrunning operation. More information
1226 /// on [create_service_rollout][crate::client::ServiceManager::create_service_rollout].
1227 pub async fn send(self) -> Result<longrunning::model::Operation> {
1228 (*self.0.stub)
1229 .create_service_rollout(self.0.request, self.0.options)
1230 .await
1231 .map(gax::response::Response::into_body)
1232 }
1233
1234 /// Creates a [Poller][lro::Poller] to work with `create_service_rollout`.
1235 pub fn poller(
1236 self,
1237 ) -> impl lro::Poller<crate::model::Rollout, crate::model::OperationMetadata> {
1238 type Operation =
1239 lro::internal::Operation<crate::model::Rollout, crate::model::OperationMetadata>;
1240 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1241 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1242
1243 let stub = self.0.stub.clone();
1244 let mut options = self.0.options.clone();
1245 options.set_retry_policy(gax::retry_policy::NeverRetry);
1246 let query = move |name| {
1247 let stub = stub.clone();
1248 let options = options.clone();
1249 async {
1250 let op = GetOperation::new(stub)
1251 .set_name(name)
1252 .with_options(options)
1253 .send()
1254 .await?;
1255 Ok(Operation::new(op))
1256 }
1257 };
1258
1259 let start = move || async {
1260 let op = self.send().await?;
1261 Ok(Operation::new(op))
1262 };
1263
1264 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1265 }
1266
1267 /// Sets the value of [service_name][crate::model::CreateServiceRolloutRequest::service_name].
1268 ///
1269 /// This is a **required** field for requests.
1270 pub fn set_service_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1271 self.0.request.service_name = v.into();
1272 self
1273 }
1274
1275 /// Sets the value of [rollout][crate::model::CreateServiceRolloutRequest::rollout].
1276 ///
1277 /// This is a **required** field for requests.
1278 pub fn set_rollout<T>(mut self, v: T) -> Self
1279 where
1280 T: std::convert::Into<crate::model::Rollout>,
1281 {
1282 self.0.request.rollout = std::option::Option::Some(v.into());
1283 self
1284 }
1285
1286 /// Sets or clears the value of [rollout][crate::model::CreateServiceRolloutRequest::rollout].
1287 ///
1288 /// This is a **required** field for requests.
1289 pub fn set_or_clear_rollout<T>(mut self, v: std::option::Option<T>) -> Self
1290 where
1291 T: std::convert::Into<crate::model::Rollout>,
1292 {
1293 self.0.request.rollout = v.map(|x| x.into());
1294 self
1295 }
1296 }
1297
1298 #[doc(hidden)]
1299 impl gax::options::internal::RequestBuilder for CreateServiceRollout {
1300 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1301 &mut self.0.options
1302 }
1303 }
1304
1305 /// The request builder for [ServiceManager::generate_config_report][crate::client::ServiceManager::generate_config_report] calls.
1306 ///
1307 /// # Example
1308 /// ```no_run
1309 /// # use google_cloud_api_servicemanagement_v1::builder;
1310 /// use builder::service_manager::GenerateConfigReport;
1311 /// # tokio_test::block_on(async {
1312 ///
1313 /// let builder = prepare_request_builder();
1314 /// let response = builder.send().await?;
1315 /// # gax::Result::<()>::Ok(()) });
1316 ///
1317 /// fn prepare_request_builder() -> GenerateConfigReport {
1318 /// # panic!();
1319 /// // ... details omitted ...
1320 /// }
1321 /// ```
1322 #[derive(Clone, Debug)]
1323 pub struct GenerateConfigReport(RequestBuilder<crate::model::GenerateConfigReportRequest>);
1324
1325 impl GenerateConfigReport {
1326 pub(crate) fn new(
1327 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
1328 ) -> Self {
1329 Self(RequestBuilder::new(stub))
1330 }
1331
1332 /// Sets the full request, replacing any prior values.
1333 pub fn with_request<V: Into<crate::model::GenerateConfigReportRequest>>(
1334 mut self,
1335 v: V,
1336 ) -> Self {
1337 self.0.request = v.into();
1338 self
1339 }
1340
1341 /// Sets all the options, replacing any prior values.
1342 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1343 self.0.options = v.into();
1344 self
1345 }
1346
1347 /// Sends the request.
1348 pub async fn send(self) -> Result<crate::model::GenerateConfigReportResponse> {
1349 (*self.0.stub)
1350 .generate_config_report(self.0.request, self.0.options)
1351 .await
1352 .map(gax::response::Response::into_body)
1353 }
1354
1355 /// Sets the value of [new_config][crate::model::GenerateConfigReportRequest::new_config].
1356 ///
1357 /// This is a **required** field for requests.
1358 pub fn set_new_config<T>(mut self, v: T) -> Self
1359 where
1360 T: std::convert::Into<wkt::Any>,
1361 {
1362 self.0.request.new_config = std::option::Option::Some(v.into());
1363 self
1364 }
1365
1366 /// Sets or clears the value of [new_config][crate::model::GenerateConfigReportRequest::new_config].
1367 ///
1368 /// This is a **required** field for requests.
1369 pub fn set_or_clear_new_config<T>(mut self, v: std::option::Option<T>) -> Self
1370 where
1371 T: std::convert::Into<wkt::Any>,
1372 {
1373 self.0.request.new_config = v.map(|x| x.into());
1374 self
1375 }
1376
1377 /// Sets the value of [old_config][crate::model::GenerateConfigReportRequest::old_config].
1378 pub fn set_old_config<T>(mut self, v: T) -> Self
1379 where
1380 T: std::convert::Into<wkt::Any>,
1381 {
1382 self.0.request.old_config = std::option::Option::Some(v.into());
1383 self
1384 }
1385
1386 /// Sets or clears the value of [old_config][crate::model::GenerateConfigReportRequest::old_config].
1387 pub fn set_or_clear_old_config<T>(mut self, v: std::option::Option<T>) -> Self
1388 where
1389 T: std::convert::Into<wkt::Any>,
1390 {
1391 self.0.request.old_config = v.map(|x| x.into());
1392 self
1393 }
1394 }
1395
1396 #[doc(hidden)]
1397 impl gax::options::internal::RequestBuilder for GenerateConfigReport {
1398 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1399 &mut self.0.options
1400 }
1401 }
1402
1403 /// The request builder for [ServiceManager::set_iam_policy][crate::client::ServiceManager::set_iam_policy] calls.
1404 ///
1405 /// # Example
1406 /// ```no_run
1407 /// # use google_cloud_api_servicemanagement_v1::builder;
1408 /// use builder::service_manager::SetIamPolicy;
1409 /// # tokio_test::block_on(async {
1410 ///
1411 /// let builder = prepare_request_builder();
1412 /// let response = builder.send().await?;
1413 /// # gax::Result::<()>::Ok(()) });
1414 ///
1415 /// fn prepare_request_builder() -> SetIamPolicy {
1416 /// # panic!();
1417 /// // ... details omitted ...
1418 /// }
1419 /// ```
1420 #[derive(Clone, Debug)]
1421 pub struct SetIamPolicy(RequestBuilder<iam_v1::model::SetIamPolicyRequest>);
1422
1423 impl SetIamPolicy {
1424 pub(crate) fn new(
1425 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
1426 ) -> Self {
1427 Self(RequestBuilder::new(stub))
1428 }
1429
1430 /// Sets the full request, replacing any prior values.
1431 pub fn with_request<V: Into<iam_v1::model::SetIamPolicyRequest>>(mut self, v: V) -> Self {
1432 self.0.request = v.into();
1433 self
1434 }
1435
1436 /// Sets all the options, replacing any prior values.
1437 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1438 self.0.options = v.into();
1439 self
1440 }
1441
1442 /// Sends the request.
1443 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1444 (*self.0.stub)
1445 .set_iam_policy(self.0.request, self.0.options)
1446 .await
1447 .map(gax::response::Response::into_body)
1448 }
1449
1450 /// Sets the value of [resource][iam_v1::model::SetIamPolicyRequest::resource].
1451 ///
1452 /// This is a **required** field for requests.
1453 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1454 self.0.request.resource = v.into();
1455 self
1456 }
1457
1458 /// Sets the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1459 ///
1460 /// This is a **required** field for requests.
1461 pub fn set_policy<T>(mut self, v: T) -> Self
1462 where
1463 T: std::convert::Into<iam_v1::model::Policy>,
1464 {
1465 self.0.request.policy = std::option::Option::Some(v.into());
1466 self
1467 }
1468
1469 /// Sets or clears the value of [policy][iam_v1::model::SetIamPolicyRequest::policy].
1470 ///
1471 /// This is a **required** field for requests.
1472 pub fn set_or_clear_policy<T>(mut self, v: std::option::Option<T>) -> Self
1473 where
1474 T: std::convert::Into<iam_v1::model::Policy>,
1475 {
1476 self.0.request.policy = v.map(|x| x.into());
1477 self
1478 }
1479
1480 /// Sets the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1481 pub fn set_update_mask<T>(mut self, v: T) -> Self
1482 where
1483 T: std::convert::Into<wkt::FieldMask>,
1484 {
1485 self.0.request.update_mask = std::option::Option::Some(v.into());
1486 self
1487 }
1488
1489 /// Sets or clears the value of [update_mask][iam_v1::model::SetIamPolicyRequest::update_mask].
1490 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1491 where
1492 T: std::convert::Into<wkt::FieldMask>,
1493 {
1494 self.0.request.update_mask = v.map(|x| x.into());
1495 self
1496 }
1497 }
1498
1499 #[doc(hidden)]
1500 impl gax::options::internal::RequestBuilder for SetIamPolicy {
1501 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1502 &mut self.0.options
1503 }
1504 }
1505
1506 /// The request builder for [ServiceManager::get_iam_policy][crate::client::ServiceManager::get_iam_policy] calls.
1507 ///
1508 /// # Example
1509 /// ```no_run
1510 /// # use google_cloud_api_servicemanagement_v1::builder;
1511 /// use builder::service_manager::GetIamPolicy;
1512 /// # tokio_test::block_on(async {
1513 ///
1514 /// let builder = prepare_request_builder();
1515 /// let response = builder.send().await?;
1516 /// # gax::Result::<()>::Ok(()) });
1517 ///
1518 /// fn prepare_request_builder() -> GetIamPolicy {
1519 /// # panic!();
1520 /// // ... details omitted ...
1521 /// }
1522 /// ```
1523 #[derive(Clone, Debug)]
1524 pub struct GetIamPolicy(RequestBuilder<iam_v1::model::GetIamPolicyRequest>);
1525
1526 impl GetIamPolicy {
1527 pub(crate) fn new(
1528 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
1529 ) -> Self {
1530 Self(RequestBuilder::new(stub))
1531 }
1532
1533 /// Sets the full request, replacing any prior values.
1534 pub fn with_request<V: Into<iam_v1::model::GetIamPolicyRequest>>(mut self, v: V) -> Self {
1535 self.0.request = v.into();
1536 self
1537 }
1538
1539 /// Sets all the options, replacing any prior values.
1540 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1541 self.0.options = v.into();
1542 self
1543 }
1544
1545 /// Sends the request.
1546 pub async fn send(self) -> Result<iam_v1::model::Policy> {
1547 (*self.0.stub)
1548 .get_iam_policy(self.0.request, self.0.options)
1549 .await
1550 .map(gax::response::Response::into_body)
1551 }
1552
1553 /// Sets the value of [resource][iam_v1::model::GetIamPolicyRequest::resource].
1554 ///
1555 /// This is a **required** field for requests.
1556 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1557 self.0.request.resource = v.into();
1558 self
1559 }
1560
1561 /// Sets the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1562 pub fn set_options<T>(mut self, v: T) -> Self
1563 where
1564 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1565 {
1566 self.0.request.options = std::option::Option::Some(v.into());
1567 self
1568 }
1569
1570 /// Sets or clears the value of [options][iam_v1::model::GetIamPolicyRequest::options].
1571 pub fn set_or_clear_options<T>(mut self, v: std::option::Option<T>) -> Self
1572 where
1573 T: std::convert::Into<iam_v1::model::GetPolicyOptions>,
1574 {
1575 self.0.request.options = v.map(|x| x.into());
1576 self
1577 }
1578 }
1579
1580 #[doc(hidden)]
1581 impl gax::options::internal::RequestBuilder for GetIamPolicy {
1582 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1583 &mut self.0.options
1584 }
1585 }
1586
1587 /// The request builder for [ServiceManager::test_iam_permissions][crate::client::ServiceManager::test_iam_permissions] calls.
1588 ///
1589 /// # Example
1590 /// ```no_run
1591 /// # use google_cloud_api_servicemanagement_v1::builder;
1592 /// use builder::service_manager::TestIamPermissions;
1593 /// # tokio_test::block_on(async {
1594 ///
1595 /// let builder = prepare_request_builder();
1596 /// let response = builder.send().await?;
1597 /// # gax::Result::<()>::Ok(()) });
1598 ///
1599 /// fn prepare_request_builder() -> TestIamPermissions {
1600 /// # panic!();
1601 /// // ... details omitted ...
1602 /// }
1603 /// ```
1604 #[derive(Clone, Debug)]
1605 pub struct TestIamPermissions(RequestBuilder<iam_v1::model::TestIamPermissionsRequest>);
1606
1607 impl TestIamPermissions {
1608 pub(crate) fn new(
1609 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
1610 ) -> Self {
1611 Self(RequestBuilder::new(stub))
1612 }
1613
1614 /// Sets the full request, replacing any prior values.
1615 pub fn with_request<V: Into<iam_v1::model::TestIamPermissionsRequest>>(
1616 mut self,
1617 v: V,
1618 ) -> Self {
1619 self.0.request = v.into();
1620 self
1621 }
1622
1623 /// Sets all the options, replacing any prior values.
1624 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1625 self.0.options = v.into();
1626 self
1627 }
1628
1629 /// Sends the request.
1630 pub async fn send(self) -> Result<iam_v1::model::TestIamPermissionsResponse> {
1631 (*self.0.stub)
1632 .test_iam_permissions(self.0.request, self.0.options)
1633 .await
1634 .map(gax::response::Response::into_body)
1635 }
1636
1637 /// Sets the value of [resource][iam_v1::model::TestIamPermissionsRequest::resource].
1638 ///
1639 /// This is a **required** field for requests.
1640 pub fn set_resource<T: Into<std::string::String>>(mut self, v: T) -> Self {
1641 self.0.request.resource = v.into();
1642 self
1643 }
1644
1645 /// Sets the value of [permissions][iam_v1::model::TestIamPermissionsRequest::permissions].
1646 ///
1647 /// This is a **required** field for requests.
1648 pub fn set_permissions<T, V>(mut self, v: T) -> Self
1649 where
1650 T: std::iter::IntoIterator<Item = V>,
1651 V: std::convert::Into<std::string::String>,
1652 {
1653 use std::iter::Iterator;
1654 self.0.request.permissions = v.into_iter().map(|i| i.into()).collect();
1655 self
1656 }
1657 }
1658
1659 #[doc(hidden)]
1660 impl gax::options::internal::RequestBuilder for TestIamPermissions {
1661 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1662 &mut self.0.options
1663 }
1664 }
1665
1666 /// The request builder for [ServiceManager::list_operations][crate::client::ServiceManager::list_operations] calls.
1667 ///
1668 /// # Example
1669 /// ```no_run
1670 /// # use google_cloud_api_servicemanagement_v1::builder;
1671 /// use builder::service_manager::ListOperations;
1672 /// # tokio_test::block_on(async {
1673 /// use gax::paginator::ItemPaginator;
1674 ///
1675 /// let builder = prepare_request_builder();
1676 /// let mut items = builder.by_item();
1677 /// while let Some(result) = items.next().await {
1678 /// let item = result?;
1679 /// }
1680 /// # gax::Result::<()>::Ok(()) });
1681 ///
1682 /// fn prepare_request_builder() -> ListOperations {
1683 /// # panic!();
1684 /// // ... details omitted ...
1685 /// }
1686 /// ```
1687 #[derive(Clone, Debug)]
1688 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1689
1690 impl ListOperations {
1691 pub(crate) fn new(
1692 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
1693 ) -> Self {
1694 Self(RequestBuilder::new(stub))
1695 }
1696
1697 /// Sets the full request, replacing any prior values.
1698 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1699 mut self,
1700 v: V,
1701 ) -> Self {
1702 self.0.request = v.into();
1703 self
1704 }
1705
1706 /// Sets all the options, replacing any prior values.
1707 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1708 self.0.options = v.into();
1709 self
1710 }
1711
1712 /// Sends the request.
1713 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1714 (*self.0.stub)
1715 .list_operations(self.0.request, self.0.options)
1716 .await
1717 .map(gax::response::Response::into_body)
1718 }
1719
1720 /// Streams each page in the collection.
1721 pub fn by_page(
1722 self,
1723 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1724 {
1725 use std::clone::Clone;
1726 let token = self.0.request.page_token.clone();
1727 let execute = move |token: String| {
1728 let mut builder = self.clone();
1729 builder.0.request = builder.0.request.set_page_token(token);
1730 builder.send()
1731 };
1732 gax::paginator::internal::new_paginator(token, execute)
1733 }
1734
1735 /// Streams each item in the collection.
1736 pub fn by_item(
1737 self,
1738 ) -> impl gax::paginator::ItemPaginator<
1739 longrunning::model::ListOperationsResponse,
1740 gax::error::Error,
1741 > {
1742 use gax::paginator::Paginator;
1743 self.by_page().items()
1744 }
1745
1746 /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1747 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1748 self.0.request.name = v.into();
1749 self
1750 }
1751
1752 /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1753 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1754 self.0.request.filter = v.into();
1755 self
1756 }
1757
1758 /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1759 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1760 self.0.request.page_size = v.into();
1761 self
1762 }
1763
1764 /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1765 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1766 self.0.request.page_token = v.into();
1767 self
1768 }
1769
1770 /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
1771 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1772 self.0.request.return_partial_success = v.into();
1773 self
1774 }
1775 }
1776
1777 #[doc(hidden)]
1778 impl gax::options::internal::RequestBuilder for ListOperations {
1779 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1780 &mut self.0.options
1781 }
1782 }
1783
1784 /// The request builder for [ServiceManager::get_operation][crate::client::ServiceManager::get_operation] calls.
1785 ///
1786 /// # Example
1787 /// ```no_run
1788 /// # use google_cloud_api_servicemanagement_v1::builder;
1789 /// use builder::service_manager::GetOperation;
1790 /// # tokio_test::block_on(async {
1791 ///
1792 /// let builder = prepare_request_builder();
1793 /// let response = builder.send().await?;
1794 /// # gax::Result::<()>::Ok(()) });
1795 ///
1796 /// fn prepare_request_builder() -> GetOperation {
1797 /// # panic!();
1798 /// // ... details omitted ...
1799 /// }
1800 /// ```
1801 #[derive(Clone, Debug)]
1802 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1803
1804 impl GetOperation {
1805 pub(crate) fn new(
1806 stub: std::sync::Arc<dyn super::super::stub::dynamic::ServiceManager>,
1807 ) -> Self {
1808 Self(RequestBuilder::new(stub))
1809 }
1810
1811 /// Sets the full request, replacing any prior values.
1812 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1813 mut self,
1814 v: V,
1815 ) -> Self {
1816 self.0.request = v.into();
1817 self
1818 }
1819
1820 /// Sets all the options, replacing any prior values.
1821 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1822 self.0.options = v.into();
1823 self
1824 }
1825
1826 /// Sends the request.
1827 pub async fn send(self) -> Result<longrunning::model::Operation> {
1828 (*self.0.stub)
1829 .get_operation(self.0.request, self.0.options)
1830 .await
1831 .map(gax::response::Response::into_body)
1832 }
1833
1834 /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1835 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1836 self.0.request.name = v.into();
1837 self
1838 }
1839 }
1840
1841 #[doc(hidden)]
1842 impl gax::options::internal::RequestBuilder for GetOperation {
1843 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1844 &mut self.0.options
1845 }
1846 }
1847}