google_cloud_ids_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 ids {
18    use crate::Result;
19
20    /// A builder for [Ids][super::super::client::Ids].
21    ///
22    /// ```
23    /// # tokio_test::block_on(async {
24    /// # use google_cloud_ids_v1::*;
25    /// # use builder::ids::ClientBuilder;
26    /// # use client::Ids;
27    /// let builder : ClientBuilder = Ids::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://ids.googleapis.com")
30    ///     .build().await?;
31    /// # gax::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::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(self, config: gaxi::options::ClientConfig) -> gax::Result<Self::Client> {
43                Self::Client::new(config).await
44            }
45        }
46    }
47
48    /// Common implementation for [super::super::client::Ids] request builders.
49    #[derive(Clone, Debug)]
50    pub(crate) struct RequestBuilder<R: std::default::Default> {
51        stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>,
52        request: R,
53        options: gax::options::RequestOptions,
54    }
55
56    impl<R> RequestBuilder<R>
57    where
58        R: std::default::Default,
59    {
60        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
61            Self {
62                stub,
63                request: R::default(),
64                options: gax::options::RequestOptions::default(),
65            }
66        }
67    }
68
69    /// The request builder for [Ids::list_endpoints][super::super::client::Ids::list_endpoints] calls.
70    ///
71    /// # Example
72    /// ```no_run
73    /// # use google_cloud_ids_v1::builder;
74    /// use builder::ids::ListEndpoints;
75    /// # tokio_test::block_on(async {
76    /// let builder = prepare_request_builder();
77    /// use gax::paginator::ItemPaginator;
78    /// let mut items = builder.by_item();
79    /// while let Some(result) = items.next().await {
80    ///   let item = result?;
81    /// }
82    /// # gax::Result::<()>::Ok(()) });
83    ///
84    /// fn prepare_request_builder() -> ListEndpoints {
85    ///   # panic!();
86    ///   // ... details omitted ...
87    /// }
88    /// ```
89    #[derive(Clone, Debug)]
90    pub struct ListEndpoints(RequestBuilder<crate::model::ListEndpointsRequest>);
91
92    impl ListEndpoints {
93        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
94            Self(RequestBuilder::new(stub))
95        }
96
97        /// Sets the full request, replacing any prior values.
98        pub fn with_request<V: Into<crate::model::ListEndpointsRequest>>(mut self, v: V) -> Self {
99            self.0.request = v.into();
100            self
101        }
102
103        /// Sets all the options, replacing any prior values.
104        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
105            self.0.options = v.into();
106            self
107        }
108
109        /// Sends the request.
110        pub async fn send(self) -> Result<crate::model::ListEndpointsResponse> {
111            (*self.0.stub)
112                .list_endpoints(self.0.request, self.0.options)
113                .await
114                .map(gax::response::Response::into_body)
115        }
116
117        /// Streams each page in the collection.
118        pub fn by_page(
119            self,
120        ) -> impl gax::paginator::Paginator<crate::model::ListEndpointsResponse, gax::error::Error>
121        {
122            use std::clone::Clone;
123            let token = self.0.request.page_token.clone();
124            let execute = move |token: String| {
125                let mut builder = self.clone();
126                builder.0.request = builder.0.request.set_page_token(token);
127                builder.send()
128            };
129            gax::paginator::internal::new_paginator(token, execute)
130        }
131
132        /// Streams each item in the collection.
133        pub fn by_item(
134            self,
135        ) -> impl gax::paginator::ItemPaginator<crate::model::ListEndpointsResponse, gax::error::Error>
136        {
137            use gax::paginator::Paginator;
138            self.by_page().items()
139        }
140
141        /// Sets the value of [parent][crate::model::ListEndpointsRequest::parent].
142        ///
143        /// This is a **required** field for requests.
144        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
145            self.0.request.parent = v.into();
146            self
147        }
148
149        /// Sets the value of [page_size][crate::model::ListEndpointsRequest::page_size].
150        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
151            self.0.request.page_size = v.into();
152            self
153        }
154
155        /// Sets the value of [page_token][crate::model::ListEndpointsRequest::page_token].
156        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
157            self.0.request.page_token = v.into();
158            self
159        }
160
161        /// Sets the value of [filter][crate::model::ListEndpointsRequest::filter].
162        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
163            self.0.request.filter = v.into();
164            self
165        }
166
167        /// Sets the value of [order_by][crate::model::ListEndpointsRequest::order_by].
168        pub fn set_order_by<T: Into<std::string::String>>(mut self, v: T) -> Self {
169            self.0.request.order_by = v.into();
170            self
171        }
172    }
173
174    #[doc(hidden)]
175    impl gax::options::internal::RequestBuilder for ListEndpoints {
176        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
177            &mut self.0.options
178        }
179    }
180
181    /// The request builder for [Ids::get_endpoint][super::super::client::Ids::get_endpoint] calls.
182    ///
183    /// # Example
184    /// ```no_run
185    /// # use google_cloud_ids_v1::builder;
186    /// use builder::ids::GetEndpoint;
187    /// # tokio_test::block_on(async {
188    /// let builder = prepare_request_builder();
189    /// let response = builder.send().await?;
190    /// # gax::Result::<()>::Ok(()) });
191    ///
192    /// fn prepare_request_builder() -> GetEndpoint {
193    ///   # panic!();
194    ///   // ... details omitted ...
195    /// }
196    /// ```
197    #[derive(Clone, Debug)]
198    pub struct GetEndpoint(RequestBuilder<crate::model::GetEndpointRequest>);
199
200    impl GetEndpoint {
201        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
202            Self(RequestBuilder::new(stub))
203        }
204
205        /// Sets the full request, replacing any prior values.
206        pub fn with_request<V: Into<crate::model::GetEndpointRequest>>(mut self, v: V) -> Self {
207            self.0.request = v.into();
208            self
209        }
210
211        /// Sets all the options, replacing any prior values.
212        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
213            self.0.options = v.into();
214            self
215        }
216
217        /// Sends the request.
218        pub async fn send(self) -> Result<crate::model::Endpoint> {
219            (*self.0.stub)
220                .get_endpoint(self.0.request, self.0.options)
221                .await
222                .map(gax::response::Response::into_body)
223        }
224
225        /// Sets the value of [name][crate::model::GetEndpointRequest::name].
226        ///
227        /// This is a **required** field for requests.
228        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
229            self.0.request.name = v.into();
230            self
231        }
232    }
233
234    #[doc(hidden)]
235    impl gax::options::internal::RequestBuilder for GetEndpoint {
236        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
237            &mut self.0.options
238        }
239    }
240
241    /// The request builder for [Ids::create_endpoint][super::super::client::Ids::create_endpoint] calls.
242    ///
243    /// # Example
244    /// ```no_run
245    /// # use google_cloud_ids_v1::builder;
246    /// use builder::ids::CreateEndpoint;
247    /// # tokio_test::block_on(async {
248    /// let builder = prepare_request_builder();
249    /// use google_cloud_ids_v1::Poller;
250    /// let response = builder.poller().until_done().await?;
251    /// # gax::Result::<()>::Ok(()) });
252    ///
253    /// fn prepare_request_builder() -> CreateEndpoint {
254    ///   # panic!();
255    ///   // ... details omitted ...
256    /// }
257    /// ```
258    #[derive(Clone, Debug)]
259    pub struct CreateEndpoint(RequestBuilder<crate::model::CreateEndpointRequest>);
260
261    impl CreateEndpoint {
262        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
263            Self(RequestBuilder::new(stub))
264        }
265
266        /// Sets the full request, replacing any prior values.
267        pub fn with_request<V: Into<crate::model::CreateEndpointRequest>>(mut self, v: V) -> Self {
268            self.0.request = v.into();
269            self
270        }
271
272        /// Sets all the options, replacing any prior values.
273        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
274            self.0.options = v.into();
275            self
276        }
277
278        /// Sends the request.
279        ///
280        /// # Long running operations
281        ///
282        /// This starts, but does not poll, a longrunning operation. More information
283        /// on [create_endpoint][super::super::client::Ids::create_endpoint].
284        pub async fn send(self) -> Result<longrunning::model::Operation> {
285            (*self.0.stub)
286                .create_endpoint(self.0.request, self.0.options)
287                .await
288                .map(gax::response::Response::into_body)
289        }
290
291        /// Creates a [Poller][lro::Poller] to work with `create_endpoint`.
292        pub fn poller(
293            self,
294        ) -> impl lro::Poller<crate::model::Endpoint, crate::model::OperationMetadata> {
295            type Operation =
296                lro::internal::Operation<crate::model::Endpoint, crate::model::OperationMetadata>;
297            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
298            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
299
300            let stub = self.0.stub.clone();
301            let mut options = self.0.options.clone();
302            options.set_retry_policy(gax::retry_policy::NeverRetry);
303            let query = move |name| {
304                let stub = stub.clone();
305                let options = options.clone();
306                async {
307                    let op = GetOperation::new(stub)
308                        .set_name(name)
309                        .with_options(options)
310                        .send()
311                        .await?;
312                    Ok(Operation::new(op))
313                }
314            };
315
316            let start = move || async {
317                let op = self.send().await?;
318                Ok(Operation::new(op))
319            };
320
321            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
322        }
323
324        /// Sets the value of [parent][crate::model::CreateEndpointRequest::parent].
325        ///
326        /// This is a **required** field for requests.
327        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
328            self.0.request.parent = v.into();
329            self
330        }
331
332        /// Sets the value of [endpoint_id][crate::model::CreateEndpointRequest::endpoint_id].
333        ///
334        /// This is a **required** field for requests.
335        pub fn set_endpoint_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
336            self.0.request.endpoint_id = v.into();
337            self
338        }
339
340        /// Sets the value of [endpoint][crate::model::CreateEndpointRequest::endpoint].
341        ///
342        /// This is a **required** field for requests.
343        pub fn set_endpoint<T: Into<std::option::Option<crate::model::Endpoint>>>(
344            mut self,
345            v: T,
346        ) -> Self {
347            self.0.request.endpoint = v.into();
348            self
349        }
350
351        /// Sets the value of [request_id][crate::model::CreateEndpointRequest::request_id].
352        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
353            self.0.request.request_id = v.into();
354            self
355        }
356    }
357
358    #[doc(hidden)]
359    impl gax::options::internal::RequestBuilder for CreateEndpoint {
360        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
361            &mut self.0.options
362        }
363    }
364
365    /// The request builder for [Ids::delete_endpoint][super::super::client::Ids::delete_endpoint] calls.
366    ///
367    /// # Example
368    /// ```no_run
369    /// # use google_cloud_ids_v1::builder;
370    /// use builder::ids::DeleteEndpoint;
371    /// # tokio_test::block_on(async {
372    /// let builder = prepare_request_builder();
373    /// use google_cloud_ids_v1::Poller;
374    /// let response = builder.poller().until_done().await?;
375    /// # gax::Result::<()>::Ok(()) });
376    ///
377    /// fn prepare_request_builder() -> DeleteEndpoint {
378    ///   # panic!();
379    ///   // ... details omitted ...
380    /// }
381    /// ```
382    #[derive(Clone, Debug)]
383    pub struct DeleteEndpoint(RequestBuilder<crate::model::DeleteEndpointRequest>);
384
385    impl DeleteEndpoint {
386        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
387            Self(RequestBuilder::new(stub))
388        }
389
390        /// Sets the full request, replacing any prior values.
391        pub fn with_request<V: Into<crate::model::DeleteEndpointRequest>>(mut self, v: V) -> Self {
392            self.0.request = v.into();
393            self
394        }
395
396        /// Sets all the options, replacing any prior values.
397        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
398            self.0.options = v.into();
399            self
400        }
401
402        /// Sends the request.
403        ///
404        /// # Long running operations
405        ///
406        /// This starts, but does not poll, a longrunning operation. More information
407        /// on [delete_endpoint][super::super::client::Ids::delete_endpoint].
408        pub async fn send(self) -> Result<longrunning::model::Operation> {
409            (*self.0.stub)
410                .delete_endpoint(self.0.request, self.0.options)
411                .await
412                .map(gax::response::Response::into_body)
413        }
414
415        /// Creates a [Poller][lro::Poller] to work with `delete_endpoint`.
416        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
417            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
418            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
419            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
420
421            let stub = self.0.stub.clone();
422            let mut options = self.0.options.clone();
423            options.set_retry_policy(gax::retry_policy::NeverRetry);
424            let query = move |name| {
425                let stub = stub.clone();
426                let options = options.clone();
427                async {
428                    let op = GetOperation::new(stub)
429                        .set_name(name)
430                        .with_options(options)
431                        .send()
432                        .await?;
433                    Ok(Operation::new(op))
434                }
435            };
436
437            let start = move || async {
438                let op = self.send().await?;
439                Ok(Operation::new(op))
440            };
441
442            lro::internal::new_unit_response_poller(
443                polling_error_policy,
444                polling_backoff_policy,
445                start,
446                query,
447            )
448        }
449
450        /// Sets the value of [name][crate::model::DeleteEndpointRequest::name].
451        ///
452        /// This is a **required** field for requests.
453        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
454            self.0.request.name = v.into();
455            self
456        }
457
458        /// Sets the value of [request_id][crate::model::DeleteEndpointRequest::request_id].
459        pub fn set_request_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
460            self.0.request.request_id = v.into();
461            self
462        }
463    }
464
465    #[doc(hidden)]
466    impl gax::options::internal::RequestBuilder for DeleteEndpoint {
467        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
468            &mut self.0.options
469        }
470    }
471
472    /// The request builder for [Ids::list_operations][super::super::client::Ids::list_operations] calls.
473    ///
474    /// # Example
475    /// ```no_run
476    /// # use google_cloud_ids_v1::builder;
477    /// use builder::ids::ListOperations;
478    /// # tokio_test::block_on(async {
479    /// let builder = prepare_request_builder();
480    /// use gax::paginator::ItemPaginator;
481    /// let mut items = builder.by_item();
482    /// while let Some(result) = items.next().await {
483    ///   let item = result?;
484    /// }
485    /// # gax::Result::<()>::Ok(()) });
486    ///
487    /// fn prepare_request_builder() -> ListOperations {
488    ///   # panic!();
489    ///   // ... details omitted ...
490    /// }
491    /// ```
492    #[derive(Clone, Debug)]
493    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
494
495    impl ListOperations {
496        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
497            Self(RequestBuilder::new(stub))
498        }
499
500        /// Sets the full request, replacing any prior values.
501        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
502            mut self,
503            v: V,
504        ) -> Self {
505            self.0.request = v.into();
506            self
507        }
508
509        /// Sets all the options, replacing any prior values.
510        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
511            self.0.options = v.into();
512            self
513        }
514
515        /// Sends the request.
516        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
517            (*self.0.stub)
518                .list_operations(self.0.request, self.0.options)
519                .await
520                .map(gax::response::Response::into_body)
521        }
522
523        /// Streams each page in the collection.
524        pub fn by_page(
525            self,
526        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
527        {
528            use std::clone::Clone;
529            let token = self.0.request.page_token.clone();
530            let execute = move |token: String| {
531                let mut builder = self.clone();
532                builder.0.request = builder.0.request.set_page_token(token);
533                builder.send()
534            };
535            gax::paginator::internal::new_paginator(token, execute)
536        }
537
538        /// Streams each item in the collection.
539        pub fn by_item(
540            self,
541        ) -> impl gax::paginator::ItemPaginator<
542            longrunning::model::ListOperationsResponse,
543            gax::error::Error,
544        > {
545            use gax::paginator::Paginator;
546            self.by_page().items()
547        }
548
549        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
550        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
551            self.0.request.name = v.into();
552            self
553        }
554
555        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
556        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
557            self.0.request.filter = v.into();
558            self
559        }
560
561        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
562        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
563            self.0.request.page_size = v.into();
564            self
565        }
566
567        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
568        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
569            self.0.request.page_token = v.into();
570            self
571        }
572    }
573
574    #[doc(hidden)]
575    impl gax::options::internal::RequestBuilder for ListOperations {
576        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
577            &mut self.0.options
578        }
579    }
580
581    /// The request builder for [Ids::get_operation][super::super::client::Ids::get_operation] calls.
582    ///
583    /// # Example
584    /// ```no_run
585    /// # use google_cloud_ids_v1::builder;
586    /// use builder::ids::GetOperation;
587    /// # tokio_test::block_on(async {
588    /// let builder = prepare_request_builder();
589    /// let response = builder.send().await?;
590    /// # gax::Result::<()>::Ok(()) });
591    ///
592    /// fn prepare_request_builder() -> GetOperation {
593    ///   # panic!();
594    ///   // ... details omitted ...
595    /// }
596    /// ```
597    #[derive(Clone, Debug)]
598    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
599
600    impl GetOperation {
601        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
602            Self(RequestBuilder::new(stub))
603        }
604
605        /// Sets the full request, replacing any prior values.
606        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
607            mut self,
608            v: V,
609        ) -> Self {
610            self.0.request = v.into();
611            self
612        }
613
614        /// Sets all the options, replacing any prior values.
615        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
616            self.0.options = v.into();
617            self
618        }
619
620        /// Sends the request.
621        pub async fn send(self) -> Result<longrunning::model::Operation> {
622            (*self.0.stub)
623                .get_operation(self.0.request, self.0.options)
624                .await
625                .map(gax::response::Response::into_body)
626        }
627
628        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
629        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
630            self.0.request.name = v.into();
631            self
632        }
633    }
634
635    #[doc(hidden)]
636    impl gax::options::internal::RequestBuilder for GetOperation {
637        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
638            &mut self.0.options
639        }
640    }
641
642    /// The request builder for [Ids::delete_operation][super::super::client::Ids::delete_operation] calls.
643    ///
644    /// # Example
645    /// ```no_run
646    /// # use google_cloud_ids_v1::builder;
647    /// use builder::ids::DeleteOperation;
648    /// # tokio_test::block_on(async {
649    /// let builder = prepare_request_builder();
650    /// let response = builder.send().await?;
651    /// # gax::Result::<()>::Ok(()) });
652    ///
653    /// fn prepare_request_builder() -> DeleteOperation {
654    ///   # panic!();
655    ///   // ... details omitted ...
656    /// }
657    /// ```
658    #[derive(Clone, Debug)]
659    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
660
661    impl DeleteOperation {
662        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
663            Self(RequestBuilder::new(stub))
664        }
665
666        /// Sets the full request, replacing any prior values.
667        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
668            mut self,
669            v: V,
670        ) -> Self {
671            self.0.request = v.into();
672            self
673        }
674
675        /// Sets all the options, replacing any prior values.
676        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
677            self.0.options = v.into();
678            self
679        }
680
681        /// Sends the request.
682        pub async fn send(self) -> Result<()> {
683            (*self.0.stub)
684                .delete_operation(self.0.request, self.0.options)
685                .await
686                .map(gax::response::Response::into_body)
687        }
688
689        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
690        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
691            self.0.request.name = v.into();
692            self
693        }
694    }
695
696    #[doc(hidden)]
697    impl gax::options::internal::RequestBuilder for DeleteOperation {
698        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
699            &mut self.0.options
700        }
701    }
702
703    /// The request builder for [Ids::cancel_operation][super::super::client::Ids::cancel_operation] calls.
704    ///
705    /// # Example
706    /// ```no_run
707    /// # use google_cloud_ids_v1::builder;
708    /// use builder::ids::CancelOperation;
709    /// # tokio_test::block_on(async {
710    /// let builder = prepare_request_builder();
711    /// let response = builder.send().await?;
712    /// # gax::Result::<()>::Ok(()) });
713    ///
714    /// fn prepare_request_builder() -> CancelOperation {
715    ///   # panic!();
716    ///   // ... details omitted ...
717    /// }
718    /// ```
719    #[derive(Clone, Debug)]
720    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
721
722    impl CancelOperation {
723        pub(crate) fn new(stub: std::sync::Arc<dyn super::super::stub::dynamic::Ids>) -> Self {
724            Self(RequestBuilder::new(stub))
725        }
726
727        /// Sets the full request, replacing any prior values.
728        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
729            mut self,
730            v: V,
731        ) -> Self {
732            self.0.request = v.into();
733            self
734        }
735
736        /// Sets all the options, replacing any prior values.
737        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
738            self.0.options = v.into();
739            self
740        }
741
742        /// Sends the request.
743        pub async fn send(self) -> Result<()> {
744            (*self.0.stub)
745                .cancel_operation(self.0.request, self.0.options)
746                .await
747                .map(gax::response::Response::into_body)
748        }
749
750        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
751        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
752            self.0.request.name = v.into();
753            self
754        }
755    }
756
757    #[doc(hidden)]
758    impl gax::options::internal::RequestBuilder for CancelOperation {
759        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
760            &mut self.0.options
761        }
762    }
763}