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 /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
2270 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
2271 self.0.request.return_partial_success = v.into();
2272 self
2273 }
2274 }
2275
2276 #[doc(hidden)]
2277 impl gax::options::internal::RequestBuilder for ListOperations {
2278 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2279 &mut self.0.options
2280 }
2281 }
2282
2283 /// The request builder for [ManagedKafka::get_operation][crate::client::ManagedKafka::get_operation] calls.
2284 ///
2285 /// # Example
2286 /// ```no_run
2287 /// # use google_cloud_managedkafka_v1::builder;
2288 /// use builder::managed_kafka::GetOperation;
2289 /// # tokio_test::block_on(async {
2290 ///
2291 /// let builder = prepare_request_builder();
2292 /// let response = builder.send().await?;
2293 /// # gax::Result::<()>::Ok(()) });
2294 ///
2295 /// fn prepare_request_builder() -> GetOperation {
2296 /// # panic!();
2297 /// // ... details omitted ...
2298 /// }
2299 /// ```
2300 #[derive(Clone, Debug)]
2301 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
2302
2303 impl GetOperation {
2304 pub(crate) fn new(
2305 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafka>,
2306 ) -> Self {
2307 Self(RequestBuilder::new(stub))
2308 }
2309
2310 /// Sets the full request, replacing any prior values.
2311 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
2312 mut self,
2313 v: V,
2314 ) -> Self {
2315 self.0.request = v.into();
2316 self
2317 }
2318
2319 /// Sets all the options, replacing any prior values.
2320 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2321 self.0.options = v.into();
2322 self
2323 }
2324
2325 /// Sends the request.
2326 pub async fn send(self) -> Result<longrunning::model::Operation> {
2327 (*self.0.stub)
2328 .get_operation(self.0.request, self.0.options)
2329 .await
2330 .map(gax::response::Response::into_body)
2331 }
2332
2333 /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
2334 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2335 self.0.request.name = v.into();
2336 self
2337 }
2338 }
2339
2340 #[doc(hidden)]
2341 impl gax::options::internal::RequestBuilder for GetOperation {
2342 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2343 &mut self.0.options
2344 }
2345 }
2346
2347 /// The request builder for [ManagedKafka::delete_operation][crate::client::ManagedKafka::delete_operation] calls.
2348 ///
2349 /// # Example
2350 /// ```no_run
2351 /// # use google_cloud_managedkafka_v1::builder;
2352 /// use builder::managed_kafka::DeleteOperation;
2353 /// # tokio_test::block_on(async {
2354 ///
2355 /// let builder = prepare_request_builder();
2356 /// let response = builder.send().await?;
2357 /// # gax::Result::<()>::Ok(()) });
2358 ///
2359 /// fn prepare_request_builder() -> DeleteOperation {
2360 /// # panic!();
2361 /// // ... details omitted ...
2362 /// }
2363 /// ```
2364 #[derive(Clone, Debug)]
2365 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2366
2367 impl DeleteOperation {
2368 pub(crate) fn new(
2369 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafka>,
2370 ) -> Self {
2371 Self(RequestBuilder::new(stub))
2372 }
2373
2374 /// Sets the full request, replacing any prior values.
2375 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2376 mut self,
2377 v: V,
2378 ) -> Self {
2379 self.0.request = v.into();
2380 self
2381 }
2382
2383 /// Sets all the options, replacing any prior values.
2384 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2385 self.0.options = v.into();
2386 self
2387 }
2388
2389 /// Sends the request.
2390 pub async fn send(self) -> Result<()> {
2391 (*self.0.stub)
2392 .delete_operation(self.0.request, self.0.options)
2393 .await
2394 .map(gax::response::Response::into_body)
2395 }
2396
2397 /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
2398 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2399 self.0.request.name = v.into();
2400 self
2401 }
2402 }
2403
2404 #[doc(hidden)]
2405 impl gax::options::internal::RequestBuilder for DeleteOperation {
2406 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2407 &mut self.0.options
2408 }
2409 }
2410
2411 /// The request builder for [ManagedKafka::cancel_operation][crate::client::ManagedKafka::cancel_operation] calls.
2412 ///
2413 /// # Example
2414 /// ```no_run
2415 /// # use google_cloud_managedkafka_v1::builder;
2416 /// use builder::managed_kafka::CancelOperation;
2417 /// # tokio_test::block_on(async {
2418 ///
2419 /// let builder = prepare_request_builder();
2420 /// let response = builder.send().await?;
2421 /// # gax::Result::<()>::Ok(()) });
2422 ///
2423 /// fn prepare_request_builder() -> CancelOperation {
2424 /// # panic!();
2425 /// // ... details omitted ...
2426 /// }
2427 /// ```
2428 #[derive(Clone, Debug)]
2429 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2430
2431 impl CancelOperation {
2432 pub(crate) fn new(
2433 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafka>,
2434 ) -> Self {
2435 Self(RequestBuilder::new(stub))
2436 }
2437
2438 /// Sets the full request, replacing any prior values.
2439 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2440 mut self,
2441 v: V,
2442 ) -> Self {
2443 self.0.request = v.into();
2444 self
2445 }
2446
2447 /// Sets all the options, replacing any prior values.
2448 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2449 self.0.options = v.into();
2450 self
2451 }
2452
2453 /// Sends the request.
2454 pub async fn send(self) -> Result<()> {
2455 (*self.0.stub)
2456 .cancel_operation(self.0.request, self.0.options)
2457 .await
2458 .map(gax::response::Response::into_body)
2459 }
2460
2461 /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
2462 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2463 self.0.request.name = v.into();
2464 self
2465 }
2466 }
2467
2468 #[doc(hidden)]
2469 impl gax::options::internal::RequestBuilder for CancelOperation {
2470 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2471 &mut self.0.options
2472 }
2473 }
2474}
2475
2476pub mod managed_kafka_connect {
2477 use crate::Result;
2478
2479 /// A builder for [ManagedKafkaConnect][crate::client::ManagedKafkaConnect].
2480 ///
2481 /// ```
2482 /// # tokio_test::block_on(async {
2483 /// # use google_cloud_managedkafka_v1::*;
2484 /// # use builder::managed_kafka_connect::ClientBuilder;
2485 /// # use client::ManagedKafkaConnect;
2486 /// let builder : ClientBuilder = ManagedKafkaConnect::builder();
2487 /// let client = builder
2488 /// .with_endpoint("https://managedkafka.googleapis.com")
2489 /// .build().await?;
2490 /// # gax::client_builder::Result::<()>::Ok(()) });
2491 /// ```
2492 pub type ClientBuilder =
2493 gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;
2494
2495 pub(crate) mod client {
2496 use super::super::super::client::ManagedKafkaConnect;
2497 pub struct Factory;
2498 impl gax::client_builder::internal::ClientFactory for Factory {
2499 type Client = ManagedKafkaConnect;
2500 type Credentials = gaxi::options::Credentials;
2501 async fn build(
2502 self,
2503 config: gaxi::options::ClientConfig,
2504 ) -> gax::client_builder::Result<Self::Client> {
2505 Self::Client::new(config).await
2506 }
2507 }
2508 }
2509
2510 /// Common implementation for [crate::client::ManagedKafkaConnect] request builders.
2511 #[derive(Clone, Debug)]
2512 pub(crate) struct RequestBuilder<R: std::default::Default> {
2513 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
2514 request: R,
2515 options: gax::options::RequestOptions,
2516 }
2517
2518 impl<R> RequestBuilder<R>
2519 where
2520 R: std::default::Default,
2521 {
2522 pub(crate) fn new(
2523 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
2524 ) -> Self {
2525 Self {
2526 stub,
2527 request: R::default(),
2528 options: gax::options::RequestOptions::default(),
2529 }
2530 }
2531 }
2532
2533 /// The request builder for [ManagedKafkaConnect::list_connect_clusters][crate::client::ManagedKafkaConnect::list_connect_clusters] calls.
2534 ///
2535 /// # Example
2536 /// ```no_run
2537 /// # use google_cloud_managedkafka_v1::builder;
2538 /// use builder::managed_kafka_connect::ListConnectClusters;
2539 /// # tokio_test::block_on(async {
2540 /// use gax::paginator::ItemPaginator;
2541 ///
2542 /// let builder = prepare_request_builder();
2543 /// let mut items = builder.by_item();
2544 /// while let Some(result) = items.next().await {
2545 /// let item = result?;
2546 /// }
2547 /// # gax::Result::<()>::Ok(()) });
2548 ///
2549 /// fn prepare_request_builder() -> ListConnectClusters {
2550 /// # panic!();
2551 /// // ... details omitted ...
2552 /// }
2553 /// ```
2554 #[derive(Clone, Debug)]
2555 pub struct ListConnectClusters(RequestBuilder<crate::model::ListConnectClustersRequest>);
2556
2557 impl ListConnectClusters {
2558 pub(crate) fn new(
2559 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
2560 ) -> Self {
2561 Self(RequestBuilder::new(stub))
2562 }
2563
2564 /// Sets the full request, replacing any prior values.
2565 pub fn with_request<V: Into<crate::model::ListConnectClustersRequest>>(
2566 mut self,
2567 v: V,
2568 ) -> Self {
2569 self.0.request = v.into();
2570 self
2571 }
2572
2573 /// Sets all the options, replacing any prior values.
2574 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2575 self.0.options = v.into();
2576 self
2577 }
2578
2579 /// Sends the request.
2580 pub async fn send(self) -> Result<crate::model::ListConnectClustersResponse> {
2581 (*self.0.stub)
2582 .list_connect_clusters(self.0.request, self.0.options)
2583 .await
2584 .map(gax::response::Response::into_body)
2585 }
2586
2587 /// Streams each page in the collection.
2588 pub fn by_page(
2589 self,
2590 ) -> impl gax::paginator::Paginator<crate::model::ListConnectClustersResponse, gax::error::Error>
2591 {
2592 use std::clone::Clone;
2593 let token = self.0.request.page_token.clone();
2594 let execute = move |token: String| {
2595 let mut builder = self.clone();
2596 builder.0.request = builder.0.request.set_page_token(token);
2597 builder.send()
2598 };
2599 gax::paginator::internal::new_paginator(token, execute)
2600 }
2601
2602 /// Streams each item in the collection.
2603 pub fn by_item(
2604 self,
2605 ) -> impl gax::paginator::ItemPaginator<
2606 crate::model::ListConnectClustersResponse,
2607 gax::error::Error,
2608 > {
2609 use gax::paginator::Paginator;
2610 self.by_page().items()
2611 }
2612
2613 /// Sets the value of [parent][crate::model::ListConnectClustersRequest::parent].
2614 ///
2615 /// This is a **required** field for requests.
2616 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2617 self.0.request.parent = v.into();
2618 self
2619 }
2620
2621 /// Sets the value of [page_size][crate::model::ListConnectClustersRequest::page_size].
2622 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
2623 self.0.request.page_size = v.into();
2624 self
2625 }
2626
2627 /// Sets the value of [page_token][crate::model::ListConnectClustersRequest::page_token].
2628 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
2629 self.0.request.page_token = v.into();
2630 self
2631 }
2632
2633 /// Sets the value of [filter][crate::model::ListConnectClustersRequest::filter].
2634 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
2635 self.0.request.filter = v.into();
2636 self
2637 }
2638
2639 /// Sets the value of [order_by][crate::model::ListConnectClustersRequest::order_by].
2640 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
2641 self.0.request.order_by = v.into();
2642 self
2643 }
2644 }
2645
2646 #[doc(hidden)]
2647 impl gax::options::internal::RequestBuilder for ListConnectClusters {
2648 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2649 &mut self.0.options
2650 }
2651 }
2652
2653 /// The request builder for [ManagedKafkaConnect::get_connect_cluster][crate::client::ManagedKafkaConnect::get_connect_cluster] calls.
2654 ///
2655 /// # Example
2656 /// ```no_run
2657 /// # use google_cloud_managedkafka_v1::builder;
2658 /// use builder::managed_kafka_connect::GetConnectCluster;
2659 /// # tokio_test::block_on(async {
2660 ///
2661 /// let builder = prepare_request_builder();
2662 /// let response = builder.send().await?;
2663 /// # gax::Result::<()>::Ok(()) });
2664 ///
2665 /// fn prepare_request_builder() -> GetConnectCluster {
2666 /// # panic!();
2667 /// // ... details omitted ...
2668 /// }
2669 /// ```
2670 #[derive(Clone, Debug)]
2671 pub struct GetConnectCluster(RequestBuilder<crate::model::GetConnectClusterRequest>);
2672
2673 impl GetConnectCluster {
2674 pub(crate) fn new(
2675 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
2676 ) -> Self {
2677 Self(RequestBuilder::new(stub))
2678 }
2679
2680 /// Sets the full request, replacing any prior values.
2681 pub fn with_request<V: Into<crate::model::GetConnectClusterRequest>>(
2682 mut self,
2683 v: V,
2684 ) -> Self {
2685 self.0.request = v.into();
2686 self
2687 }
2688
2689 /// Sets all the options, replacing any prior values.
2690 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2691 self.0.options = v.into();
2692 self
2693 }
2694
2695 /// Sends the request.
2696 pub async fn send(self) -> Result<crate::model::ConnectCluster> {
2697 (*self.0.stub)
2698 .get_connect_cluster(self.0.request, self.0.options)
2699 .await
2700 .map(gax::response::Response::into_body)
2701 }
2702
2703 /// Sets the value of [name][crate::model::GetConnectClusterRequest::name].
2704 ///
2705 /// This is a **required** field for requests.
2706 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2707 self.0.request.name = v.into();
2708 self
2709 }
2710 }
2711
2712 #[doc(hidden)]
2713 impl gax::options::internal::RequestBuilder for GetConnectCluster {
2714 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2715 &mut self.0.options
2716 }
2717 }
2718
2719 /// The request builder for [ManagedKafkaConnect::create_connect_cluster][crate::client::ManagedKafkaConnect::create_connect_cluster] calls.
2720 ///
2721 /// # Example
2722 /// ```no_run
2723 /// # use google_cloud_managedkafka_v1::builder;
2724 /// use builder::managed_kafka_connect::CreateConnectCluster;
2725 /// # tokio_test::block_on(async {
2726 /// use lro::Poller;
2727 ///
2728 /// let builder = prepare_request_builder();
2729 /// let response = builder.poller().until_done().await?;
2730 /// # gax::Result::<()>::Ok(()) });
2731 ///
2732 /// fn prepare_request_builder() -> CreateConnectCluster {
2733 /// # panic!();
2734 /// // ... details omitted ...
2735 /// }
2736 /// ```
2737 #[derive(Clone, Debug)]
2738 pub struct CreateConnectCluster(RequestBuilder<crate::model::CreateConnectClusterRequest>);
2739
2740 impl CreateConnectCluster {
2741 pub(crate) fn new(
2742 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
2743 ) -> Self {
2744 Self(RequestBuilder::new(stub))
2745 }
2746
2747 /// Sets the full request, replacing any prior values.
2748 pub fn with_request<V: Into<crate::model::CreateConnectClusterRequest>>(
2749 mut self,
2750 v: V,
2751 ) -> Self {
2752 self.0.request = v.into();
2753 self
2754 }
2755
2756 /// Sets all the options, replacing any prior values.
2757 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2758 self.0.options = v.into();
2759 self
2760 }
2761
2762 /// Sends the request.
2763 ///
2764 /// # Long running operations
2765 ///
2766 /// This starts, but does not poll, a longrunning operation. More information
2767 /// on [create_connect_cluster][crate::client::ManagedKafkaConnect::create_connect_cluster].
2768 pub async fn send(self) -> Result<longrunning::model::Operation> {
2769 (*self.0.stub)
2770 .create_connect_cluster(self.0.request, self.0.options)
2771 .await
2772 .map(gax::response::Response::into_body)
2773 }
2774
2775 /// Creates a [Poller][lro::Poller] to work with `create_connect_cluster`.
2776 pub fn poller(
2777 self,
2778 ) -> impl lro::Poller<crate::model::ConnectCluster, crate::model::OperationMetadata>
2779 {
2780 type Operation = lro::internal::Operation<
2781 crate::model::ConnectCluster,
2782 crate::model::OperationMetadata,
2783 >;
2784 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2785 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2786
2787 let stub = self.0.stub.clone();
2788 let mut options = self.0.options.clone();
2789 options.set_retry_policy(gax::retry_policy::NeverRetry);
2790 let query = move |name| {
2791 let stub = stub.clone();
2792 let options = options.clone();
2793 async {
2794 let op = GetOperation::new(stub)
2795 .set_name(name)
2796 .with_options(options)
2797 .send()
2798 .await?;
2799 Ok(Operation::new(op))
2800 }
2801 };
2802
2803 let start = move || async {
2804 let op = self.send().await?;
2805 Ok(Operation::new(op))
2806 };
2807
2808 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2809 }
2810
2811 /// Sets the value of [parent][crate::model::CreateConnectClusterRequest::parent].
2812 ///
2813 /// This is a **required** field for requests.
2814 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
2815 self.0.request.parent = v.into();
2816 self
2817 }
2818
2819 /// Sets the value of [connect_cluster_id][crate::model::CreateConnectClusterRequest::connect_cluster_id].
2820 ///
2821 /// This is a **required** field for requests.
2822 pub fn set_connect_cluster_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2823 self.0.request.connect_cluster_id = v.into();
2824 self
2825 }
2826
2827 /// Sets the value of [connect_cluster][crate::model::CreateConnectClusterRequest::connect_cluster].
2828 ///
2829 /// This is a **required** field for requests.
2830 pub fn set_connect_cluster<T>(mut self, v: T) -> Self
2831 where
2832 T: std::convert::Into<crate::model::ConnectCluster>,
2833 {
2834 self.0.request.connect_cluster = std::option::Option::Some(v.into());
2835 self
2836 }
2837
2838 /// Sets or clears the value of [connect_cluster][crate::model::CreateConnectClusterRequest::connect_cluster].
2839 ///
2840 /// This is a **required** field for requests.
2841 pub fn set_or_clear_connect_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2842 where
2843 T: std::convert::Into<crate::model::ConnectCluster>,
2844 {
2845 self.0.request.connect_cluster = v.map(|x| x.into());
2846 self
2847 }
2848
2849 /// Sets the value of [request_id][crate::model::CreateConnectClusterRequest::request_id].
2850 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
2851 self.0.request.request_id = v.into();
2852 self
2853 }
2854 }
2855
2856 #[doc(hidden)]
2857 impl gax::options::internal::RequestBuilder for CreateConnectCluster {
2858 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2859 &mut self.0.options
2860 }
2861 }
2862
2863 /// The request builder for [ManagedKafkaConnect::update_connect_cluster][crate::client::ManagedKafkaConnect::update_connect_cluster] calls.
2864 ///
2865 /// # Example
2866 /// ```no_run
2867 /// # use google_cloud_managedkafka_v1::builder;
2868 /// use builder::managed_kafka_connect::UpdateConnectCluster;
2869 /// # tokio_test::block_on(async {
2870 /// use lro::Poller;
2871 ///
2872 /// let builder = prepare_request_builder();
2873 /// let response = builder.poller().until_done().await?;
2874 /// # gax::Result::<()>::Ok(()) });
2875 ///
2876 /// fn prepare_request_builder() -> UpdateConnectCluster {
2877 /// # panic!();
2878 /// // ... details omitted ...
2879 /// }
2880 /// ```
2881 #[derive(Clone, Debug)]
2882 pub struct UpdateConnectCluster(RequestBuilder<crate::model::UpdateConnectClusterRequest>);
2883
2884 impl UpdateConnectCluster {
2885 pub(crate) fn new(
2886 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
2887 ) -> Self {
2888 Self(RequestBuilder::new(stub))
2889 }
2890
2891 /// Sets the full request, replacing any prior values.
2892 pub fn with_request<V: Into<crate::model::UpdateConnectClusterRequest>>(
2893 mut self,
2894 v: V,
2895 ) -> Self {
2896 self.0.request = v.into();
2897 self
2898 }
2899
2900 /// Sets all the options, replacing any prior values.
2901 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2902 self.0.options = v.into();
2903 self
2904 }
2905
2906 /// Sends the request.
2907 ///
2908 /// # Long running operations
2909 ///
2910 /// This starts, but does not poll, a longrunning operation. More information
2911 /// on [update_connect_cluster][crate::client::ManagedKafkaConnect::update_connect_cluster].
2912 pub async fn send(self) -> Result<longrunning::model::Operation> {
2913 (*self.0.stub)
2914 .update_connect_cluster(self.0.request, self.0.options)
2915 .await
2916 .map(gax::response::Response::into_body)
2917 }
2918
2919 /// Creates a [Poller][lro::Poller] to work with `update_connect_cluster`.
2920 pub fn poller(
2921 self,
2922 ) -> impl lro::Poller<crate::model::ConnectCluster, crate::model::OperationMetadata>
2923 {
2924 type Operation = lro::internal::Operation<
2925 crate::model::ConnectCluster,
2926 crate::model::OperationMetadata,
2927 >;
2928 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
2929 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
2930
2931 let stub = self.0.stub.clone();
2932 let mut options = self.0.options.clone();
2933 options.set_retry_policy(gax::retry_policy::NeverRetry);
2934 let query = move |name| {
2935 let stub = stub.clone();
2936 let options = options.clone();
2937 async {
2938 let op = GetOperation::new(stub)
2939 .set_name(name)
2940 .with_options(options)
2941 .send()
2942 .await?;
2943 Ok(Operation::new(op))
2944 }
2945 };
2946
2947 let start = move || async {
2948 let op = self.send().await?;
2949 Ok(Operation::new(op))
2950 };
2951
2952 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
2953 }
2954
2955 /// Sets the value of [update_mask][crate::model::UpdateConnectClusterRequest::update_mask].
2956 ///
2957 /// This is a **required** field for requests.
2958 pub fn set_update_mask<T>(mut self, v: T) -> Self
2959 where
2960 T: std::convert::Into<wkt::FieldMask>,
2961 {
2962 self.0.request.update_mask = std::option::Option::Some(v.into());
2963 self
2964 }
2965
2966 /// Sets or clears the value of [update_mask][crate::model::UpdateConnectClusterRequest::update_mask].
2967 ///
2968 /// This is a **required** field for requests.
2969 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
2970 where
2971 T: std::convert::Into<wkt::FieldMask>,
2972 {
2973 self.0.request.update_mask = v.map(|x| x.into());
2974 self
2975 }
2976
2977 /// Sets the value of [connect_cluster][crate::model::UpdateConnectClusterRequest::connect_cluster].
2978 ///
2979 /// This is a **required** field for requests.
2980 pub fn set_connect_cluster<T>(mut self, v: T) -> Self
2981 where
2982 T: std::convert::Into<crate::model::ConnectCluster>,
2983 {
2984 self.0.request.connect_cluster = std::option::Option::Some(v.into());
2985 self
2986 }
2987
2988 /// Sets or clears the value of [connect_cluster][crate::model::UpdateConnectClusterRequest::connect_cluster].
2989 ///
2990 /// This is a **required** field for requests.
2991 pub fn set_or_clear_connect_cluster<T>(mut self, v: std::option::Option<T>) -> Self
2992 where
2993 T: std::convert::Into<crate::model::ConnectCluster>,
2994 {
2995 self.0.request.connect_cluster = v.map(|x| x.into());
2996 self
2997 }
2998
2999 /// Sets the value of [request_id][crate::model::UpdateConnectClusterRequest::request_id].
3000 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3001 self.0.request.request_id = v.into();
3002 self
3003 }
3004 }
3005
3006 #[doc(hidden)]
3007 impl gax::options::internal::RequestBuilder for UpdateConnectCluster {
3008 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3009 &mut self.0.options
3010 }
3011 }
3012
3013 /// The request builder for [ManagedKafkaConnect::delete_connect_cluster][crate::client::ManagedKafkaConnect::delete_connect_cluster] calls.
3014 ///
3015 /// # Example
3016 /// ```no_run
3017 /// # use google_cloud_managedkafka_v1::builder;
3018 /// use builder::managed_kafka_connect::DeleteConnectCluster;
3019 /// # tokio_test::block_on(async {
3020 /// use lro::Poller;
3021 ///
3022 /// let builder = prepare_request_builder();
3023 /// let response = builder.poller().until_done().await?;
3024 /// # gax::Result::<()>::Ok(()) });
3025 ///
3026 /// fn prepare_request_builder() -> DeleteConnectCluster {
3027 /// # panic!();
3028 /// // ... details omitted ...
3029 /// }
3030 /// ```
3031 #[derive(Clone, Debug)]
3032 pub struct DeleteConnectCluster(RequestBuilder<crate::model::DeleteConnectClusterRequest>);
3033
3034 impl DeleteConnectCluster {
3035 pub(crate) fn new(
3036 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
3037 ) -> Self {
3038 Self(RequestBuilder::new(stub))
3039 }
3040
3041 /// Sets the full request, replacing any prior values.
3042 pub fn with_request<V: Into<crate::model::DeleteConnectClusterRequest>>(
3043 mut self,
3044 v: V,
3045 ) -> Self {
3046 self.0.request = v.into();
3047 self
3048 }
3049
3050 /// Sets all the options, replacing any prior values.
3051 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3052 self.0.options = v.into();
3053 self
3054 }
3055
3056 /// Sends the request.
3057 ///
3058 /// # Long running operations
3059 ///
3060 /// This starts, but does not poll, a longrunning operation. More information
3061 /// on [delete_connect_cluster][crate::client::ManagedKafkaConnect::delete_connect_cluster].
3062 pub async fn send(self) -> Result<longrunning::model::Operation> {
3063 (*self.0.stub)
3064 .delete_connect_cluster(self.0.request, self.0.options)
3065 .await
3066 .map(gax::response::Response::into_body)
3067 }
3068
3069 /// Creates a [Poller][lro::Poller] to work with `delete_connect_cluster`.
3070 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
3071 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
3072 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
3073 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
3074
3075 let stub = self.0.stub.clone();
3076 let mut options = self.0.options.clone();
3077 options.set_retry_policy(gax::retry_policy::NeverRetry);
3078 let query = move |name| {
3079 let stub = stub.clone();
3080 let options = options.clone();
3081 async {
3082 let op = GetOperation::new(stub)
3083 .set_name(name)
3084 .with_options(options)
3085 .send()
3086 .await?;
3087 Ok(Operation::new(op))
3088 }
3089 };
3090
3091 let start = move || async {
3092 let op = self.send().await?;
3093 Ok(Operation::new(op))
3094 };
3095
3096 lro::internal::new_unit_response_poller(
3097 polling_error_policy,
3098 polling_backoff_policy,
3099 start,
3100 query,
3101 )
3102 }
3103
3104 /// Sets the value of [name][crate::model::DeleteConnectClusterRequest::name].
3105 ///
3106 /// This is a **required** field for requests.
3107 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3108 self.0.request.name = v.into();
3109 self
3110 }
3111
3112 /// Sets the value of [request_id][crate::model::DeleteConnectClusterRequest::request_id].
3113 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3114 self.0.request.request_id = v.into();
3115 self
3116 }
3117 }
3118
3119 #[doc(hidden)]
3120 impl gax::options::internal::RequestBuilder for DeleteConnectCluster {
3121 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3122 &mut self.0.options
3123 }
3124 }
3125
3126 /// The request builder for [ManagedKafkaConnect::list_connectors][crate::client::ManagedKafkaConnect::list_connectors] calls.
3127 ///
3128 /// # Example
3129 /// ```no_run
3130 /// # use google_cloud_managedkafka_v1::builder;
3131 /// use builder::managed_kafka_connect::ListConnectors;
3132 /// # tokio_test::block_on(async {
3133 /// use gax::paginator::ItemPaginator;
3134 ///
3135 /// let builder = prepare_request_builder();
3136 /// let mut items = builder.by_item();
3137 /// while let Some(result) = items.next().await {
3138 /// let item = result?;
3139 /// }
3140 /// # gax::Result::<()>::Ok(()) });
3141 ///
3142 /// fn prepare_request_builder() -> ListConnectors {
3143 /// # panic!();
3144 /// // ... details omitted ...
3145 /// }
3146 /// ```
3147 #[derive(Clone, Debug)]
3148 pub struct ListConnectors(RequestBuilder<crate::model::ListConnectorsRequest>);
3149
3150 impl ListConnectors {
3151 pub(crate) fn new(
3152 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
3153 ) -> Self {
3154 Self(RequestBuilder::new(stub))
3155 }
3156
3157 /// Sets the full request, replacing any prior values.
3158 pub fn with_request<V: Into<crate::model::ListConnectorsRequest>>(mut self, v: V) -> Self {
3159 self.0.request = v.into();
3160 self
3161 }
3162
3163 /// Sets all the options, replacing any prior values.
3164 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3165 self.0.options = v.into();
3166 self
3167 }
3168
3169 /// Sends the request.
3170 pub async fn send(self) -> Result<crate::model::ListConnectorsResponse> {
3171 (*self.0.stub)
3172 .list_connectors(self.0.request, self.0.options)
3173 .await
3174 .map(gax::response::Response::into_body)
3175 }
3176
3177 /// Streams each page in the collection.
3178 pub fn by_page(
3179 self,
3180 ) -> impl gax::paginator::Paginator<crate::model::ListConnectorsResponse, gax::error::Error>
3181 {
3182 use std::clone::Clone;
3183 let token = self.0.request.page_token.clone();
3184 let execute = move |token: String| {
3185 let mut builder = self.clone();
3186 builder.0.request = builder.0.request.set_page_token(token);
3187 builder.send()
3188 };
3189 gax::paginator::internal::new_paginator(token, execute)
3190 }
3191
3192 /// Streams each item in the collection.
3193 pub fn by_item(
3194 self,
3195 ) -> impl gax::paginator::ItemPaginator<crate::model::ListConnectorsResponse, gax::error::Error>
3196 {
3197 use gax::paginator::Paginator;
3198 self.by_page().items()
3199 }
3200
3201 /// Sets the value of [parent][crate::model::ListConnectorsRequest::parent].
3202 ///
3203 /// This is a **required** field for requests.
3204 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3205 self.0.request.parent = v.into();
3206 self
3207 }
3208
3209 /// Sets the value of [page_size][crate::model::ListConnectorsRequest::page_size].
3210 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3211 self.0.request.page_size = v.into();
3212 self
3213 }
3214
3215 /// Sets the value of [page_token][crate::model::ListConnectorsRequest::page_token].
3216 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3217 self.0.request.page_token = v.into();
3218 self
3219 }
3220 }
3221
3222 #[doc(hidden)]
3223 impl gax::options::internal::RequestBuilder for ListConnectors {
3224 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3225 &mut self.0.options
3226 }
3227 }
3228
3229 /// The request builder for [ManagedKafkaConnect::get_connector][crate::client::ManagedKafkaConnect::get_connector] calls.
3230 ///
3231 /// # Example
3232 /// ```no_run
3233 /// # use google_cloud_managedkafka_v1::builder;
3234 /// use builder::managed_kafka_connect::GetConnector;
3235 /// # tokio_test::block_on(async {
3236 ///
3237 /// let builder = prepare_request_builder();
3238 /// let response = builder.send().await?;
3239 /// # gax::Result::<()>::Ok(()) });
3240 ///
3241 /// fn prepare_request_builder() -> GetConnector {
3242 /// # panic!();
3243 /// // ... details omitted ...
3244 /// }
3245 /// ```
3246 #[derive(Clone, Debug)]
3247 pub struct GetConnector(RequestBuilder<crate::model::GetConnectorRequest>);
3248
3249 impl GetConnector {
3250 pub(crate) fn new(
3251 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
3252 ) -> Self {
3253 Self(RequestBuilder::new(stub))
3254 }
3255
3256 /// Sets the full request, replacing any prior values.
3257 pub fn with_request<V: Into<crate::model::GetConnectorRequest>>(mut self, v: V) -> Self {
3258 self.0.request = v.into();
3259 self
3260 }
3261
3262 /// Sets all the options, replacing any prior values.
3263 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3264 self.0.options = v.into();
3265 self
3266 }
3267
3268 /// Sends the request.
3269 pub async fn send(self) -> Result<crate::model::Connector> {
3270 (*self.0.stub)
3271 .get_connector(self.0.request, self.0.options)
3272 .await
3273 .map(gax::response::Response::into_body)
3274 }
3275
3276 /// Sets the value of [name][crate::model::GetConnectorRequest::name].
3277 ///
3278 /// This is a **required** field for requests.
3279 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3280 self.0.request.name = v.into();
3281 self
3282 }
3283 }
3284
3285 #[doc(hidden)]
3286 impl gax::options::internal::RequestBuilder for GetConnector {
3287 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3288 &mut self.0.options
3289 }
3290 }
3291
3292 /// The request builder for [ManagedKafkaConnect::create_connector][crate::client::ManagedKafkaConnect::create_connector] calls.
3293 ///
3294 /// # Example
3295 /// ```no_run
3296 /// # use google_cloud_managedkafka_v1::builder;
3297 /// use builder::managed_kafka_connect::CreateConnector;
3298 /// # tokio_test::block_on(async {
3299 ///
3300 /// let builder = prepare_request_builder();
3301 /// let response = builder.send().await?;
3302 /// # gax::Result::<()>::Ok(()) });
3303 ///
3304 /// fn prepare_request_builder() -> CreateConnector {
3305 /// # panic!();
3306 /// // ... details omitted ...
3307 /// }
3308 /// ```
3309 #[derive(Clone, Debug)]
3310 pub struct CreateConnector(RequestBuilder<crate::model::CreateConnectorRequest>);
3311
3312 impl CreateConnector {
3313 pub(crate) fn new(
3314 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
3315 ) -> Self {
3316 Self(RequestBuilder::new(stub))
3317 }
3318
3319 /// Sets the full request, replacing any prior values.
3320 pub fn with_request<V: Into<crate::model::CreateConnectorRequest>>(mut self, v: V) -> Self {
3321 self.0.request = v.into();
3322 self
3323 }
3324
3325 /// Sets all the options, replacing any prior values.
3326 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3327 self.0.options = v.into();
3328 self
3329 }
3330
3331 /// Sends the request.
3332 pub async fn send(self) -> Result<crate::model::Connector> {
3333 (*self.0.stub)
3334 .create_connector(self.0.request, self.0.options)
3335 .await
3336 .map(gax::response::Response::into_body)
3337 }
3338
3339 /// Sets the value of [parent][crate::model::CreateConnectorRequest::parent].
3340 ///
3341 /// This is a **required** field for requests.
3342 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
3343 self.0.request.parent = v.into();
3344 self
3345 }
3346
3347 /// Sets the value of [connector_id][crate::model::CreateConnectorRequest::connector_id].
3348 ///
3349 /// This is a **required** field for requests.
3350 pub fn set_connector_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
3351 self.0.request.connector_id = v.into();
3352 self
3353 }
3354
3355 /// Sets the value of [connector][crate::model::CreateConnectorRequest::connector].
3356 ///
3357 /// This is a **required** field for requests.
3358 pub fn set_connector<T>(mut self, v: T) -> Self
3359 where
3360 T: std::convert::Into<crate::model::Connector>,
3361 {
3362 self.0.request.connector = std::option::Option::Some(v.into());
3363 self
3364 }
3365
3366 /// Sets or clears the value of [connector][crate::model::CreateConnectorRequest::connector].
3367 ///
3368 /// This is a **required** field for requests.
3369 pub fn set_or_clear_connector<T>(mut self, v: std::option::Option<T>) -> Self
3370 where
3371 T: std::convert::Into<crate::model::Connector>,
3372 {
3373 self.0.request.connector = v.map(|x| x.into());
3374 self
3375 }
3376 }
3377
3378 #[doc(hidden)]
3379 impl gax::options::internal::RequestBuilder for CreateConnector {
3380 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3381 &mut self.0.options
3382 }
3383 }
3384
3385 /// The request builder for [ManagedKafkaConnect::update_connector][crate::client::ManagedKafkaConnect::update_connector] calls.
3386 ///
3387 /// # Example
3388 /// ```no_run
3389 /// # use google_cloud_managedkafka_v1::builder;
3390 /// use builder::managed_kafka_connect::UpdateConnector;
3391 /// # tokio_test::block_on(async {
3392 ///
3393 /// let builder = prepare_request_builder();
3394 /// let response = builder.send().await?;
3395 /// # gax::Result::<()>::Ok(()) });
3396 ///
3397 /// fn prepare_request_builder() -> UpdateConnector {
3398 /// # panic!();
3399 /// // ... details omitted ...
3400 /// }
3401 /// ```
3402 #[derive(Clone, Debug)]
3403 pub struct UpdateConnector(RequestBuilder<crate::model::UpdateConnectorRequest>);
3404
3405 impl UpdateConnector {
3406 pub(crate) fn new(
3407 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
3408 ) -> Self {
3409 Self(RequestBuilder::new(stub))
3410 }
3411
3412 /// Sets the full request, replacing any prior values.
3413 pub fn with_request<V: Into<crate::model::UpdateConnectorRequest>>(mut self, v: V) -> Self {
3414 self.0.request = v.into();
3415 self
3416 }
3417
3418 /// Sets all the options, replacing any prior values.
3419 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3420 self.0.options = v.into();
3421 self
3422 }
3423
3424 /// Sends the request.
3425 pub async fn send(self) -> Result<crate::model::Connector> {
3426 (*self.0.stub)
3427 .update_connector(self.0.request, self.0.options)
3428 .await
3429 .map(gax::response::Response::into_body)
3430 }
3431
3432 /// Sets the value of [update_mask][crate::model::UpdateConnectorRequest::update_mask].
3433 ///
3434 /// This is a **required** field for requests.
3435 pub fn set_update_mask<T>(mut self, v: T) -> Self
3436 where
3437 T: std::convert::Into<wkt::FieldMask>,
3438 {
3439 self.0.request.update_mask = std::option::Option::Some(v.into());
3440 self
3441 }
3442
3443 /// Sets or clears the value of [update_mask][crate::model::UpdateConnectorRequest::update_mask].
3444 ///
3445 /// This is a **required** field for requests.
3446 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
3447 where
3448 T: std::convert::Into<wkt::FieldMask>,
3449 {
3450 self.0.request.update_mask = v.map(|x| x.into());
3451 self
3452 }
3453
3454 /// Sets the value of [connector][crate::model::UpdateConnectorRequest::connector].
3455 ///
3456 /// This is a **required** field for requests.
3457 pub fn set_connector<T>(mut self, v: T) -> Self
3458 where
3459 T: std::convert::Into<crate::model::Connector>,
3460 {
3461 self.0.request.connector = std::option::Option::Some(v.into());
3462 self
3463 }
3464
3465 /// Sets or clears the value of [connector][crate::model::UpdateConnectorRequest::connector].
3466 ///
3467 /// This is a **required** field for requests.
3468 pub fn set_or_clear_connector<T>(mut self, v: std::option::Option<T>) -> Self
3469 where
3470 T: std::convert::Into<crate::model::Connector>,
3471 {
3472 self.0.request.connector = v.map(|x| x.into());
3473 self
3474 }
3475 }
3476
3477 #[doc(hidden)]
3478 impl gax::options::internal::RequestBuilder for UpdateConnector {
3479 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3480 &mut self.0.options
3481 }
3482 }
3483
3484 /// The request builder for [ManagedKafkaConnect::delete_connector][crate::client::ManagedKafkaConnect::delete_connector] calls.
3485 ///
3486 /// # Example
3487 /// ```no_run
3488 /// # use google_cloud_managedkafka_v1::builder;
3489 /// use builder::managed_kafka_connect::DeleteConnector;
3490 /// # tokio_test::block_on(async {
3491 ///
3492 /// let builder = prepare_request_builder();
3493 /// let response = builder.send().await?;
3494 /// # gax::Result::<()>::Ok(()) });
3495 ///
3496 /// fn prepare_request_builder() -> DeleteConnector {
3497 /// # panic!();
3498 /// // ... details omitted ...
3499 /// }
3500 /// ```
3501 #[derive(Clone, Debug)]
3502 pub struct DeleteConnector(RequestBuilder<crate::model::DeleteConnectorRequest>);
3503
3504 impl DeleteConnector {
3505 pub(crate) fn new(
3506 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
3507 ) -> Self {
3508 Self(RequestBuilder::new(stub))
3509 }
3510
3511 /// Sets the full request, replacing any prior values.
3512 pub fn with_request<V: Into<crate::model::DeleteConnectorRequest>>(mut self, v: V) -> Self {
3513 self.0.request = v.into();
3514 self
3515 }
3516
3517 /// Sets all the options, replacing any prior values.
3518 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3519 self.0.options = v.into();
3520 self
3521 }
3522
3523 /// Sends the request.
3524 pub async fn send(self) -> Result<()> {
3525 (*self.0.stub)
3526 .delete_connector(self.0.request, self.0.options)
3527 .await
3528 .map(gax::response::Response::into_body)
3529 }
3530
3531 /// Sets the value of [name][crate::model::DeleteConnectorRequest::name].
3532 ///
3533 /// This is a **required** field for requests.
3534 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3535 self.0.request.name = v.into();
3536 self
3537 }
3538 }
3539
3540 #[doc(hidden)]
3541 impl gax::options::internal::RequestBuilder for DeleteConnector {
3542 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3543 &mut self.0.options
3544 }
3545 }
3546
3547 /// The request builder for [ManagedKafkaConnect::pause_connector][crate::client::ManagedKafkaConnect::pause_connector] calls.
3548 ///
3549 /// # Example
3550 /// ```no_run
3551 /// # use google_cloud_managedkafka_v1::builder;
3552 /// use builder::managed_kafka_connect::PauseConnector;
3553 /// # tokio_test::block_on(async {
3554 ///
3555 /// let builder = prepare_request_builder();
3556 /// let response = builder.send().await?;
3557 /// # gax::Result::<()>::Ok(()) });
3558 ///
3559 /// fn prepare_request_builder() -> PauseConnector {
3560 /// # panic!();
3561 /// // ... details omitted ...
3562 /// }
3563 /// ```
3564 #[derive(Clone, Debug)]
3565 pub struct PauseConnector(RequestBuilder<crate::model::PauseConnectorRequest>);
3566
3567 impl PauseConnector {
3568 pub(crate) fn new(
3569 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
3570 ) -> Self {
3571 Self(RequestBuilder::new(stub))
3572 }
3573
3574 /// Sets the full request, replacing any prior values.
3575 pub fn with_request<V: Into<crate::model::PauseConnectorRequest>>(mut self, v: V) -> Self {
3576 self.0.request = v.into();
3577 self
3578 }
3579
3580 /// Sets all the options, replacing any prior values.
3581 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3582 self.0.options = v.into();
3583 self
3584 }
3585
3586 /// Sends the request.
3587 pub async fn send(self) -> Result<crate::model::PauseConnectorResponse> {
3588 (*self.0.stub)
3589 .pause_connector(self.0.request, self.0.options)
3590 .await
3591 .map(gax::response::Response::into_body)
3592 }
3593
3594 /// Sets the value of [name][crate::model::PauseConnectorRequest::name].
3595 ///
3596 /// This is a **required** field for requests.
3597 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3598 self.0.request.name = v.into();
3599 self
3600 }
3601 }
3602
3603 #[doc(hidden)]
3604 impl gax::options::internal::RequestBuilder for PauseConnector {
3605 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3606 &mut self.0.options
3607 }
3608 }
3609
3610 /// The request builder for [ManagedKafkaConnect::resume_connector][crate::client::ManagedKafkaConnect::resume_connector] calls.
3611 ///
3612 /// # Example
3613 /// ```no_run
3614 /// # use google_cloud_managedkafka_v1::builder;
3615 /// use builder::managed_kafka_connect::ResumeConnector;
3616 /// # tokio_test::block_on(async {
3617 ///
3618 /// let builder = prepare_request_builder();
3619 /// let response = builder.send().await?;
3620 /// # gax::Result::<()>::Ok(()) });
3621 ///
3622 /// fn prepare_request_builder() -> ResumeConnector {
3623 /// # panic!();
3624 /// // ... details omitted ...
3625 /// }
3626 /// ```
3627 #[derive(Clone, Debug)]
3628 pub struct ResumeConnector(RequestBuilder<crate::model::ResumeConnectorRequest>);
3629
3630 impl ResumeConnector {
3631 pub(crate) fn new(
3632 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
3633 ) -> Self {
3634 Self(RequestBuilder::new(stub))
3635 }
3636
3637 /// Sets the full request, replacing any prior values.
3638 pub fn with_request<V: Into<crate::model::ResumeConnectorRequest>>(mut self, v: V) -> Self {
3639 self.0.request = v.into();
3640 self
3641 }
3642
3643 /// Sets all the options, replacing any prior values.
3644 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3645 self.0.options = v.into();
3646 self
3647 }
3648
3649 /// Sends the request.
3650 pub async fn send(self) -> Result<crate::model::ResumeConnectorResponse> {
3651 (*self.0.stub)
3652 .resume_connector(self.0.request, self.0.options)
3653 .await
3654 .map(gax::response::Response::into_body)
3655 }
3656
3657 /// Sets the value of [name][crate::model::ResumeConnectorRequest::name].
3658 ///
3659 /// This is a **required** field for requests.
3660 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3661 self.0.request.name = v.into();
3662 self
3663 }
3664 }
3665
3666 #[doc(hidden)]
3667 impl gax::options::internal::RequestBuilder for ResumeConnector {
3668 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3669 &mut self.0.options
3670 }
3671 }
3672
3673 /// The request builder for [ManagedKafkaConnect::restart_connector][crate::client::ManagedKafkaConnect::restart_connector] calls.
3674 ///
3675 /// # Example
3676 /// ```no_run
3677 /// # use google_cloud_managedkafka_v1::builder;
3678 /// use builder::managed_kafka_connect::RestartConnector;
3679 /// # tokio_test::block_on(async {
3680 ///
3681 /// let builder = prepare_request_builder();
3682 /// let response = builder.send().await?;
3683 /// # gax::Result::<()>::Ok(()) });
3684 ///
3685 /// fn prepare_request_builder() -> RestartConnector {
3686 /// # panic!();
3687 /// // ... details omitted ...
3688 /// }
3689 /// ```
3690 #[derive(Clone, Debug)]
3691 pub struct RestartConnector(RequestBuilder<crate::model::RestartConnectorRequest>);
3692
3693 impl RestartConnector {
3694 pub(crate) fn new(
3695 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
3696 ) -> Self {
3697 Self(RequestBuilder::new(stub))
3698 }
3699
3700 /// Sets the full request, replacing any prior values.
3701 pub fn with_request<V: Into<crate::model::RestartConnectorRequest>>(
3702 mut self,
3703 v: V,
3704 ) -> Self {
3705 self.0.request = v.into();
3706 self
3707 }
3708
3709 /// Sets all the options, replacing any prior values.
3710 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3711 self.0.options = v.into();
3712 self
3713 }
3714
3715 /// Sends the request.
3716 pub async fn send(self) -> Result<crate::model::RestartConnectorResponse> {
3717 (*self.0.stub)
3718 .restart_connector(self.0.request, self.0.options)
3719 .await
3720 .map(gax::response::Response::into_body)
3721 }
3722
3723 /// Sets the value of [name][crate::model::RestartConnectorRequest::name].
3724 ///
3725 /// This is a **required** field for requests.
3726 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3727 self.0.request.name = v.into();
3728 self
3729 }
3730 }
3731
3732 #[doc(hidden)]
3733 impl gax::options::internal::RequestBuilder for RestartConnector {
3734 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3735 &mut self.0.options
3736 }
3737 }
3738
3739 /// The request builder for [ManagedKafkaConnect::stop_connector][crate::client::ManagedKafkaConnect::stop_connector] calls.
3740 ///
3741 /// # Example
3742 /// ```no_run
3743 /// # use google_cloud_managedkafka_v1::builder;
3744 /// use builder::managed_kafka_connect::StopConnector;
3745 /// # tokio_test::block_on(async {
3746 ///
3747 /// let builder = prepare_request_builder();
3748 /// let response = builder.send().await?;
3749 /// # gax::Result::<()>::Ok(()) });
3750 ///
3751 /// fn prepare_request_builder() -> StopConnector {
3752 /// # panic!();
3753 /// // ... details omitted ...
3754 /// }
3755 /// ```
3756 #[derive(Clone, Debug)]
3757 pub struct StopConnector(RequestBuilder<crate::model::StopConnectorRequest>);
3758
3759 impl StopConnector {
3760 pub(crate) fn new(
3761 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
3762 ) -> Self {
3763 Self(RequestBuilder::new(stub))
3764 }
3765
3766 /// Sets the full request, replacing any prior values.
3767 pub fn with_request<V: Into<crate::model::StopConnectorRequest>>(mut self, v: V) -> Self {
3768 self.0.request = v.into();
3769 self
3770 }
3771
3772 /// Sets all the options, replacing any prior values.
3773 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3774 self.0.options = v.into();
3775 self
3776 }
3777
3778 /// Sends the request.
3779 pub async fn send(self) -> Result<crate::model::StopConnectorResponse> {
3780 (*self.0.stub)
3781 .stop_connector(self.0.request, self.0.options)
3782 .await
3783 .map(gax::response::Response::into_body)
3784 }
3785
3786 /// Sets the value of [name][crate::model::StopConnectorRequest::name].
3787 ///
3788 /// This is a **required** field for requests.
3789 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3790 self.0.request.name = v.into();
3791 self
3792 }
3793 }
3794
3795 #[doc(hidden)]
3796 impl gax::options::internal::RequestBuilder for StopConnector {
3797 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3798 &mut self.0.options
3799 }
3800 }
3801
3802 /// The request builder for [ManagedKafkaConnect::list_locations][crate::client::ManagedKafkaConnect::list_locations] calls.
3803 ///
3804 /// # Example
3805 /// ```no_run
3806 /// # use google_cloud_managedkafka_v1::builder;
3807 /// use builder::managed_kafka_connect::ListLocations;
3808 /// # tokio_test::block_on(async {
3809 /// use gax::paginator::ItemPaginator;
3810 ///
3811 /// let builder = prepare_request_builder();
3812 /// let mut items = builder.by_item();
3813 /// while let Some(result) = items.next().await {
3814 /// let item = result?;
3815 /// }
3816 /// # gax::Result::<()>::Ok(()) });
3817 ///
3818 /// fn prepare_request_builder() -> ListLocations {
3819 /// # panic!();
3820 /// // ... details omitted ...
3821 /// }
3822 /// ```
3823 #[derive(Clone, Debug)]
3824 pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
3825
3826 impl ListLocations {
3827 pub(crate) fn new(
3828 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
3829 ) -> Self {
3830 Self(RequestBuilder::new(stub))
3831 }
3832
3833 /// Sets the full request, replacing any prior values.
3834 pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
3835 mut self,
3836 v: V,
3837 ) -> Self {
3838 self.0.request = v.into();
3839 self
3840 }
3841
3842 /// Sets all the options, replacing any prior values.
3843 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3844 self.0.options = v.into();
3845 self
3846 }
3847
3848 /// Sends the request.
3849 pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
3850 (*self.0.stub)
3851 .list_locations(self.0.request, self.0.options)
3852 .await
3853 .map(gax::response::Response::into_body)
3854 }
3855
3856 /// Streams each page in the collection.
3857 pub fn by_page(
3858 self,
3859 ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
3860 {
3861 use std::clone::Clone;
3862 let token = self.0.request.page_token.clone();
3863 let execute = move |token: String| {
3864 let mut builder = self.clone();
3865 builder.0.request = builder.0.request.set_page_token(token);
3866 builder.send()
3867 };
3868 gax::paginator::internal::new_paginator(token, execute)
3869 }
3870
3871 /// Streams each item in the collection.
3872 pub fn by_item(
3873 self,
3874 ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
3875 {
3876 use gax::paginator::Paginator;
3877 self.by_page().items()
3878 }
3879
3880 /// Sets the value of [name][location::model::ListLocationsRequest::name].
3881 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3882 self.0.request.name = v.into();
3883 self
3884 }
3885
3886 /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
3887 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
3888 self.0.request.filter = v.into();
3889 self
3890 }
3891
3892 /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
3893 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
3894 self.0.request.page_size = v.into();
3895 self
3896 }
3897
3898 /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
3899 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
3900 self.0.request.page_token = v.into();
3901 self
3902 }
3903 }
3904
3905 #[doc(hidden)]
3906 impl gax::options::internal::RequestBuilder for ListLocations {
3907 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3908 &mut self.0.options
3909 }
3910 }
3911
3912 /// The request builder for [ManagedKafkaConnect::get_location][crate::client::ManagedKafkaConnect::get_location] calls.
3913 ///
3914 /// # Example
3915 /// ```no_run
3916 /// # use google_cloud_managedkafka_v1::builder;
3917 /// use builder::managed_kafka_connect::GetLocation;
3918 /// # tokio_test::block_on(async {
3919 ///
3920 /// let builder = prepare_request_builder();
3921 /// let response = builder.send().await?;
3922 /// # gax::Result::<()>::Ok(()) });
3923 ///
3924 /// fn prepare_request_builder() -> GetLocation {
3925 /// # panic!();
3926 /// // ... details omitted ...
3927 /// }
3928 /// ```
3929 #[derive(Clone, Debug)]
3930 pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
3931
3932 impl GetLocation {
3933 pub(crate) fn new(
3934 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
3935 ) -> Self {
3936 Self(RequestBuilder::new(stub))
3937 }
3938
3939 /// Sets the full request, replacing any prior values.
3940 pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
3941 self.0.request = v.into();
3942 self
3943 }
3944
3945 /// Sets all the options, replacing any prior values.
3946 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
3947 self.0.options = v.into();
3948 self
3949 }
3950
3951 /// Sends the request.
3952 pub async fn send(self) -> Result<location::model::Location> {
3953 (*self.0.stub)
3954 .get_location(self.0.request, self.0.options)
3955 .await
3956 .map(gax::response::Response::into_body)
3957 }
3958
3959 /// Sets the value of [name][location::model::GetLocationRequest::name].
3960 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
3961 self.0.request.name = v.into();
3962 self
3963 }
3964 }
3965
3966 #[doc(hidden)]
3967 impl gax::options::internal::RequestBuilder for GetLocation {
3968 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
3969 &mut self.0.options
3970 }
3971 }
3972
3973 /// The request builder for [ManagedKafkaConnect::list_operations][crate::client::ManagedKafkaConnect::list_operations] calls.
3974 ///
3975 /// # Example
3976 /// ```no_run
3977 /// # use google_cloud_managedkafka_v1::builder;
3978 /// use builder::managed_kafka_connect::ListOperations;
3979 /// # tokio_test::block_on(async {
3980 /// use gax::paginator::ItemPaginator;
3981 ///
3982 /// let builder = prepare_request_builder();
3983 /// let mut items = builder.by_item();
3984 /// while let Some(result) = items.next().await {
3985 /// let item = result?;
3986 /// }
3987 /// # gax::Result::<()>::Ok(()) });
3988 ///
3989 /// fn prepare_request_builder() -> ListOperations {
3990 /// # panic!();
3991 /// // ... details omitted ...
3992 /// }
3993 /// ```
3994 #[derive(Clone, Debug)]
3995 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
3996
3997 impl ListOperations {
3998 pub(crate) fn new(
3999 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
4000 ) -> Self {
4001 Self(RequestBuilder::new(stub))
4002 }
4003
4004 /// Sets the full request, replacing any prior values.
4005 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
4006 mut self,
4007 v: V,
4008 ) -> Self {
4009 self.0.request = v.into();
4010 self
4011 }
4012
4013 /// Sets all the options, replacing any prior values.
4014 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4015 self.0.options = v.into();
4016 self
4017 }
4018
4019 /// Sends the request.
4020 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
4021 (*self.0.stub)
4022 .list_operations(self.0.request, self.0.options)
4023 .await
4024 .map(gax::response::Response::into_body)
4025 }
4026
4027 /// Streams each page in the collection.
4028 pub fn by_page(
4029 self,
4030 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
4031 {
4032 use std::clone::Clone;
4033 let token = self.0.request.page_token.clone();
4034 let execute = move |token: String| {
4035 let mut builder = self.clone();
4036 builder.0.request = builder.0.request.set_page_token(token);
4037 builder.send()
4038 };
4039 gax::paginator::internal::new_paginator(token, execute)
4040 }
4041
4042 /// Streams each item in the collection.
4043 pub fn by_item(
4044 self,
4045 ) -> impl gax::paginator::ItemPaginator<
4046 longrunning::model::ListOperationsResponse,
4047 gax::error::Error,
4048 > {
4049 use gax::paginator::Paginator;
4050 self.by_page().items()
4051 }
4052
4053 /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
4054 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4055 self.0.request.name = v.into();
4056 self
4057 }
4058
4059 /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
4060 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
4061 self.0.request.filter = v.into();
4062 self
4063 }
4064
4065 /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
4066 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
4067 self.0.request.page_size = v.into();
4068 self
4069 }
4070
4071 /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
4072 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
4073 self.0.request.page_token = v.into();
4074 self
4075 }
4076
4077 /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
4078 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
4079 self.0.request.return_partial_success = v.into();
4080 self
4081 }
4082 }
4083
4084 #[doc(hidden)]
4085 impl gax::options::internal::RequestBuilder for ListOperations {
4086 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4087 &mut self.0.options
4088 }
4089 }
4090
4091 /// The request builder for [ManagedKafkaConnect::get_operation][crate::client::ManagedKafkaConnect::get_operation] calls.
4092 ///
4093 /// # Example
4094 /// ```no_run
4095 /// # use google_cloud_managedkafka_v1::builder;
4096 /// use builder::managed_kafka_connect::GetOperation;
4097 /// # tokio_test::block_on(async {
4098 ///
4099 /// let builder = prepare_request_builder();
4100 /// let response = builder.send().await?;
4101 /// # gax::Result::<()>::Ok(()) });
4102 ///
4103 /// fn prepare_request_builder() -> GetOperation {
4104 /// # panic!();
4105 /// // ... details omitted ...
4106 /// }
4107 /// ```
4108 #[derive(Clone, Debug)]
4109 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
4110
4111 impl GetOperation {
4112 pub(crate) fn new(
4113 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
4114 ) -> Self {
4115 Self(RequestBuilder::new(stub))
4116 }
4117
4118 /// Sets the full request, replacing any prior values.
4119 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
4120 mut self,
4121 v: V,
4122 ) -> Self {
4123 self.0.request = v.into();
4124 self
4125 }
4126
4127 /// Sets all the options, replacing any prior values.
4128 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4129 self.0.options = v.into();
4130 self
4131 }
4132
4133 /// Sends the request.
4134 pub async fn send(self) -> Result<longrunning::model::Operation> {
4135 (*self.0.stub)
4136 .get_operation(self.0.request, self.0.options)
4137 .await
4138 .map(gax::response::Response::into_body)
4139 }
4140
4141 /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
4142 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4143 self.0.request.name = v.into();
4144 self
4145 }
4146 }
4147
4148 #[doc(hidden)]
4149 impl gax::options::internal::RequestBuilder for GetOperation {
4150 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4151 &mut self.0.options
4152 }
4153 }
4154
4155 /// The request builder for [ManagedKafkaConnect::delete_operation][crate::client::ManagedKafkaConnect::delete_operation] calls.
4156 ///
4157 /// # Example
4158 /// ```no_run
4159 /// # use google_cloud_managedkafka_v1::builder;
4160 /// use builder::managed_kafka_connect::DeleteOperation;
4161 /// # tokio_test::block_on(async {
4162 ///
4163 /// let builder = prepare_request_builder();
4164 /// let response = builder.send().await?;
4165 /// # gax::Result::<()>::Ok(()) });
4166 ///
4167 /// fn prepare_request_builder() -> DeleteOperation {
4168 /// # panic!();
4169 /// // ... details omitted ...
4170 /// }
4171 /// ```
4172 #[derive(Clone, Debug)]
4173 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
4174
4175 impl DeleteOperation {
4176 pub(crate) fn new(
4177 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
4178 ) -> Self {
4179 Self(RequestBuilder::new(stub))
4180 }
4181
4182 /// Sets the full request, replacing any prior values.
4183 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
4184 mut self,
4185 v: V,
4186 ) -> Self {
4187 self.0.request = v.into();
4188 self
4189 }
4190
4191 /// Sets all the options, replacing any prior values.
4192 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4193 self.0.options = v.into();
4194 self
4195 }
4196
4197 /// Sends the request.
4198 pub async fn send(self) -> Result<()> {
4199 (*self.0.stub)
4200 .delete_operation(self.0.request, self.0.options)
4201 .await
4202 .map(gax::response::Response::into_body)
4203 }
4204
4205 /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
4206 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4207 self.0.request.name = v.into();
4208 self
4209 }
4210 }
4211
4212 #[doc(hidden)]
4213 impl gax::options::internal::RequestBuilder for DeleteOperation {
4214 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4215 &mut self.0.options
4216 }
4217 }
4218
4219 /// The request builder for [ManagedKafkaConnect::cancel_operation][crate::client::ManagedKafkaConnect::cancel_operation] calls.
4220 ///
4221 /// # Example
4222 /// ```no_run
4223 /// # use google_cloud_managedkafka_v1::builder;
4224 /// use builder::managed_kafka_connect::CancelOperation;
4225 /// # tokio_test::block_on(async {
4226 ///
4227 /// let builder = prepare_request_builder();
4228 /// let response = builder.send().await?;
4229 /// # gax::Result::<()>::Ok(()) });
4230 ///
4231 /// fn prepare_request_builder() -> CancelOperation {
4232 /// # panic!();
4233 /// // ... details omitted ...
4234 /// }
4235 /// ```
4236 #[derive(Clone, Debug)]
4237 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
4238
4239 impl CancelOperation {
4240 pub(crate) fn new(
4241 stub: std::sync::Arc<dyn super::super::stub::dynamic::ManagedKafkaConnect>,
4242 ) -> Self {
4243 Self(RequestBuilder::new(stub))
4244 }
4245
4246 /// Sets the full request, replacing any prior values.
4247 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
4248 mut self,
4249 v: V,
4250 ) -> Self {
4251 self.0.request = v.into();
4252 self
4253 }
4254
4255 /// Sets all the options, replacing any prior values.
4256 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
4257 self.0.options = v.into();
4258 self
4259 }
4260
4261 /// Sends the request.
4262 pub async fn send(self) -> Result<()> {
4263 (*self.0.stub)
4264 .cancel_operation(self.0.request, self.0.options)
4265 .await
4266 .map(gax::response::Response::into_body)
4267 }
4268
4269 /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
4270 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
4271 self.0.request.name = v.into();
4272 self
4273 }
4274 }
4275
4276 #[doc(hidden)]
4277 impl gax::options::internal::RequestBuilder for CancelOperation {
4278 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
4279 &mut self.0.options
4280 }
4281 }
4282}