1pub mod ids {
18 use crate::Result;
19
20 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::Ids;
38 pub struct Factory;
39 impl gax::client_builder::internal::ClientFactory for Factory {
40 type Client = Ids;
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 #[derive(Clone, Debug)]
53 pub(crate) struct RequestBuilder<R: std::default::Default> {
54 stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>,
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(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
64 Self {
65 stub,
66 request: R::default(),
67 options: gax::options::RequestOptions::default(),
68 }
69 }
70 }
71
72 #[derive(Clone, Debug)]
94 pub struct ListEndpoints(RequestBuilder<crate::model::ListEndpointsRequest>);
95
96 impl ListEndpoints {
97 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
98 Self(RequestBuilder::new(stub))
99 }
100
101 pub fn with_request<V: Into<crate::model::ListEndpointsRequest>>(mut self, v: V) -> Self {
103 self.0.request = v.into();
104 self
105 }
106
107 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
109 self.0.options = v.into();
110 self
111 }
112
113 pub async fn send(self) -> Result<crate::model::ListEndpointsResponse> {
115 (*self.0.stub)
116 .list_endpoints(self.0.request, self.0.options)
117 .await
118 .map(gax::response::Response::into_body)
119 }
120
121 pub fn by_page(
123 self,
124 ) -> impl gax::paginator::Paginator<crate::model::ListEndpointsResponse, gax::error::Error>
125 {
126 use std::clone::Clone;
127 let token = self.0.request.page_token.clone();
128 let execute = move |token: String| {
129 let mut builder = self.clone();
130 builder.0.request = builder.0.request.set_page_token(token);
131 builder.send()
132 };
133 gax::paginator::internal::new_paginator(token, execute)
134 }
135
136 pub fn by_item(
138 self,
139 ) -> impl gax::paginator::ItemPaginator<crate::model::ListEndpointsResponse, gax::error::Error>
140 {
141 use gax::paginator::Paginator;
142 self.by_page().items()
143 }
144
145 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
149 self.0.request.parent = v.into();
150 self
151 }
152
153 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
155 self.0.request.page_size = v.into();
156 self
157 }
158
159 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
161 self.0.request.page_token = v.into();
162 self
163 }
164
165 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
167 self.0.request.filter = v.into();
168 self
169 }
170
171 pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
173 self.0.request.order_by = v.into();
174 self
175 }
176 }
177
178 #[doc(hidden)]
179 impl gax::options::internal::RequestBuilder for ListEndpoints {
180 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
181 &mut self.0.options
182 }
183 }
184
185 #[derive(Clone, Debug)]
203 pub struct GetEndpoint(RequestBuilder<crate::model::GetEndpointRequest>);
204
205 impl GetEndpoint {
206 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
207 Self(RequestBuilder::new(stub))
208 }
209
210 pub fn with_request<V: Into<crate::model::GetEndpointRequest>>(mut self, v: V) -> Self {
212 self.0.request = v.into();
213 self
214 }
215
216 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
218 self.0.options = v.into();
219 self
220 }
221
222 pub async fn send(self) -> Result<crate::model::Endpoint> {
224 (*self.0.stub)
225 .get_endpoint(self.0.request, self.0.options)
226 .await
227 .map(gax::response::Response::into_body)
228 }
229
230 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
234 self.0.request.name = v.into();
235 self
236 }
237 }
238
239 #[doc(hidden)]
240 impl gax::options::internal::RequestBuilder for GetEndpoint {
241 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
242 &mut self.0.options
243 }
244 }
245
246 #[derive(Clone, Debug)]
265 pub struct CreateEndpoint(RequestBuilder<crate::model::CreateEndpointRequest>);
266
267 impl CreateEndpoint {
268 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
269 Self(RequestBuilder::new(stub))
270 }
271
272 pub fn with_request<V: Into<crate::model::CreateEndpointRequest>>(mut self, v: V) -> Self {
274 self.0.request = v.into();
275 self
276 }
277
278 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
280 self.0.options = v.into();
281 self
282 }
283
284 pub async fn send(self) -> Result<longrunning::model::Operation> {
291 (*self.0.stub)
292 .create_endpoint(self.0.request, self.0.options)
293 .await
294 .map(gax::response::Response::into_body)
295 }
296
297 pub fn poller(
299 self,
300 ) -> impl lro::Poller<crate::model::Endpoint, crate::model::OperationMetadata> {
301 type Operation =
302 lro::internal::Operation<crate::model::Endpoint, crate::model::OperationMetadata>;
303 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
304 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
305
306 let stub = self.0.stub.clone();
307 let mut options = self.0.options.clone();
308 options.set_retry_policy(gax::retry_policy::NeverRetry);
309 let query = move |name| {
310 let stub = stub.clone();
311 let options = options.clone();
312 async {
313 let op = GetOperation::new(stub)
314 .set_name(name)
315 .with_options(options)
316 .send()
317 .await?;
318 Ok(Operation::new(op))
319 }
320 };
321
322 let start = move || async {
323 let op = self.send().await?;
324 Ok(Operation::new(op))
325 };
326
327 lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
328 }
329
330 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
334 self.0.request.parent = v.into();
335 self
336 }
337
338 pub fn set_endpoint_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
342 self.0.request.endpoint_id = v.into();
343 self
344 }
345
346 pub fn set_endpoint<T>(mut self, v: T) -> Self
350 where
351 T: std::convert::Into<crate::model::Endpoint>,
352 {
353 self.0.request.endpoint = std::option::Option::Some(v.into());
354 self
355 }
356
357 pub fn set_or_clear_endpoint<T>(mut self, v: std::option::Option<T>) -> Self
361 where
362 T: std::convert::Into<crate::model::Endpoint>,
363 {
364 self.0.request.endpoint = v.map(|x| x.into());
365 self
366 }
367
368 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
370 self.0.request.request_id = v.into();
371 self
372 }
373 }
374
375 #[doc(hidden)]
376 impl gax::options::internal::RequestBuilder for CreateEndpoint {
377 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
378 &mut self.0.options
379 }
380 }
381
382 #[derive(Clone, Debug)]
401 pub struct DeleteEndpoint(RequestBuilder<crate::model::DeleteEndpointRequest>);
402
403 impl DeleteEndpoint {
404 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
405 Self(RequestBuilder::new(stub))
406 }
407
408 pub fn with_request<V: Into<crate::model::DeleteEndpointRequest>>(mut self, v: V) -> Self {
410 self.0.request = v.into();
411 self
412 }
413
414 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
416 self.0.options = v.into();
417 self
418 }
419
420 pub async fn send(self) -> Result<longrunning::model::Operation> {
427 (*self.0.stub)
428 .delete_endpoint(self.0.request, self.0.options)
429 .await
430 .map(gax::response::Response::into_body)
431 }
432
433 pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
435 type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
436 let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
437 let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
438
439 let stub = self.0.stub.clone();
440 let mut options = self.0.options.clone();
441 options.set_retry_policy(gax::retry_policy::NeverRetry);
442 let query = move |name| {
443 let stub = stub.clone();
444 let options = options.clone();
445 async {
446 let op = GetOperation::new(stub)
447 .set_name(name)
448 .with_options(options)
449 .send()
450 .await?;
451 Ok(Operation::new(op))
452 }
453 };
454
455 let start = move || async {
456 let op = self.send().await?;
457 Ok(Operation::new(op))
458 };
459
460 lro::internal::new_unit_response_poller(
461 polling_error_policy,
462 polling_backoff_policy,
463 start,
464 query,
465 )
466 }
467
468 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
472 self.0.request.name = v.into();
473 self
474 }
475
476 pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
478 self.0.request.request_id = v.into();
479 self
480 }
481 }
482
483 #[doc(hidden)]
484 impl gax::options::internal::RequestBuilder for DeleteEndpoint {
485 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
486 &mut self.0.options
487 }
488 }
489
490 #[derive(Clone, Debug)]
512 pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
513
514 impl ListOperations {
515 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
516 Self(RequestBuilder::new(stub))
517 }
518
519 pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
521 mut self,
522 v: V,
523 ) -> Self {
524 self.0.request = v.into();
525 self
526 }
527
528 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
530 self.0.options = v.into();
531 self
532 }
533
534 pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
536 (*self.0.stub)
537 .list_operations(self.0.request, self.0.options)
538 .await
539 .map(gax::response::Response::into_body)
540 }
541
542 pub fn by_page(
544 self,
545 ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
546 {
547 use std::clone::Clone;
548 let token = self.0.request.page_token.clone();
549 let execute = move |token: String| {
550 let mut builder = self.clone();
551 builder.0.request = builder.0.request.set_page_token(token);
552 builder.send()
553 };
554 gax::paginator::internal::new_paginator(token, execute)
555 }
556
557 pub fn by_item(
559 self,
560 ) -> impl gax::paginator::ItemPaginator<
561 longrunning::model::ListOperationsResponse,
562 gax::error::Error,
563 > {
564 use gax::paginator::Paginator;
565 self.by_page().items()
566 }
567
568 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
570 self.0.request.name = v.into();
571 self
572 }
573
574 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
576 self.0.request.filter = v.into();
577 self
578 }
579
580 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
582 self.0.request.page_size = v.into();
583 self
584 }
585
586 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
588 self.0.request.page_token = v.into();
589 self
590 }
591
592 pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
594 self.0.request.return_partial_success = v.into();
595 self
596 }
597 }
598
599 #[doc(hidden)]
600 impl gax::options::internal::RequestBuilder for ListOperations {
601 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
602 &mut self.0.options
603 }
604 }
605
606 #[derive(Clone, Debug)]
624 pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
625
626 impl GetOperation {
627 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
628 Self(RequestBuilder::new(stub))
629 }
630
631 pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
633 mut self,
634 v: V,
635 ) -> Self {
636 self.0.request = v.into();
637 self
638 }
639
640 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
642 self.0.options = v.into();
643 self
644 }
645
646 pub async fn send(self) -> Result<longrunning::model::Operation> {
648 (*self.0.stub)
649 .get_operation(self.0.request, self.0.options)
650 .await
651 .map(gax::response::Response::into_body)
652 }
653
654 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
656 self.0.request.name = v.into();
657 self
658 }
659 }
660
661 #[doc(hidden)]
662 impl gax::options::internal::RequestBuilder for GetOperation {
663 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
664 &mut self.0.options
665 }
666 }
667
668 #[derive(Clone, Debug)]
686 pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
687
688 impl DeleteOperation {
689 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
690 Self(RequestBuilder::new(stub))
691 }
692
693 pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
695 mut self,
696 v: V,
697 ) -> Self {
698 self.0.request = v.into();
699 self
700 }
701
702 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
704 self.0.options = v.into();
705 self
706 }
707
708 pub async fn send(self) -> Result<()> {
710 (*self.0.stub)
711 .delete_operation(self.0.request, self.0.options)
712 .await
713 .map(gax::response::Response::into_body)
714 }
715
716 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
718 self.0.request.name = v.into();
719 self
720 }
721 }
722
723 #[doc(hidden)]
724 impl gax::options::internal::RequestBuilder for DeleteOperation {
725 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
726 &mut self.0.options
727 }
728 }
729
730 #[derive(Clone, Debug)]
748 pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
749
750 impl CancelOperation {
751 pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
752 Self(RequestBuilder::new(stub))
753 }
754
755 pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
757 mut self,
758 v: V,
759 ) -> Self {
760 self.0.request = v.into();
761 self
762 }
763
764 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
766 self.0.options = v.into();
767 self
768 }
769
770 pub async fn send(self) -> Result<()> {
772 (*self.0.stub)
773 .cancel_operation(self.0.request, self.0.options)
774 .await
775 .map(gax::response::Response::into_body)
776 }
777
778 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
780 self.0.request.name = v.into();
781 self
782 }
783 }
784
785 #[doc(hidden)]
786 impl gax::options::internal::RequestBuilder for CancelOperation {
787 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
788 &mut self.0.options
789 }
790 }
791}