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