google_cloud_securityposture_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 security_posture {
18    use crate::Result;
19
20    /// A builder for [SecurityPosture][crate::client::SecurityPosture].
21    ///
22    /// ```
23    /// # tokio_test::block_on(async {
24    /// # use google_cloud_securityposture_v1::*;
25    /// # use builder::security_posture::ClientBuilder;
26    /// # use client::SecurityPosture;
27    /// let builder : ClientBuilder = SecurityPosture::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://securityposture.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::SecurityPosture;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = SecurityPosture;
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::SecurityPosture] 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::SecurityPosture>,
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::SecurityPosture>,
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 [SecurityPosture::list_postures][crate::client::SecurityPosture::list_postures] calls.
75    ///
76    /// # Example
77    /// ```no_run
78    /// # use google_cloud_securityposture_v1::builder;
79    /// use builder::security_posture::ListPostures;
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() -> ListPostures {
91    ///   # panic!();
92    ///   // ... details omitted ...
93    /// }
94    /// ```
95    #[derive(Clone, Debug)]
96    pub struct ListPostures(RequestBuilder<crate::model::ListPosturesRequest>);
97
98    impl ListPostures {
99        pub(crate) fn new(
100            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
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::ListPosturesRequest>>(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::ListPosturesResponse> {
119            (*self.0.stub)
120                .list_postures(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::ListPosturesResponse, 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::ListPosturesResponse, gax::error::Error>
144        {
145            use gax::paginator::Paginator;
146            self.by_page().items()
147        }
148
149        /// Sets the value of [parent][crate::model::ListPosturesRequest::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::ListPosturesRequest::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::ListPosturesRequest::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
170    #[doc(hidden)]
171    impl gax::options::internal::RequestBuilder for ListPostures {
172        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
173            &mut self.0.options
174        }
175    }
176
177    /// The request builder for [SecurityPosture::list_posture_revisions][crate::client::SecurityPosture::list_posture_revisions] calls.
178    ///
179    /// # Example
180    /// ```no_run
181    /// # use google_cloud_securityposture_v1::builder;
182    /// use builder::security_posture::ListPostureRevisions;
183    /// # tokio_test::block_on(async {
184    /// use gax::paginator::ItemPaginator;
185    ///
186    /// let builder = prepare_request_builder();
187    /// let mut items = builder.by_item();
188    /// while let Some(result) = items.next().await {
189    ///   let item = result?;
190    /// }
191    /// # gax::Result::<()>::Ok(()) });
192    ///
193    /// fn prepare_request_builder() -> ListPostureRevisions {
194    ///   # panic!();
195    ///   // ... details omitted ...
196    /// }
197    /// ```
198    #[derive(Clone, Debug)]
199    pub struct ListPostureRevisions(RequestBuilder<crate::model::ListPostureRevisionsRequest>);
200
201    impl ListPostureRevisions {
202        pub(crate) fn new(
203            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
204        ) -> Self {
205            Self(RequestBuilder::new(stub))
206        }
207
208        /// Sets the full request, replacing any prior values.
209        pub fn with_request<V: Into<crate::model::ListPostureRevisionsRequest>>(
210            mut self,
211            v: V,
212        ) -> Self {
213            self.0.request = v.into();
214            self
215        }
216
217        /// Sets all the options, replacing any prior values.
218        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
219            self.0.options = v.into();
220            self
221        }
222
223        /// Sends the request.
224        pub async fn send(self) -> Result<crate::model::ListPostureRevisionsResponse> {
225            (*self.0.stub)
226                .list_posture_revisions(self.0.request, self.0.options)
227                .await
228                .map(gax::response::Response::into_body)
229        }
230
231        /// Streams each page in the collection.
232        pub fn by_page(
233            self,
234        ) -> impl gax::paginator::Paginator<crate::model::ListPostureRevisionsResponse, gax::error::Error>
235        {
236            use std::clone::Clone;
237            let token = self.0.request.page_token.clone();
238            let execute = move |token: String| {
239                let mut builder = self.clone();
240                builder.0.request = builder.0.request.set_page_token(token);
241                builder.send()
242            };
243            gax::paginator::internal::new_paginator(token, execute)
244        }
245
246        /// Streams each item in the collection.
247        pub fn by_item(
248            self,
249        ) -> impl gax::paginator::ItemPaginator<
250            crate::model::ListPostureRevisionsResponse,
251            gax::error::Error,
252        > {
253            use gax::paginator::Paginator;
254            self.by_page().items()
255        }
256
257        /// Sets the value of [name][crate::model::ListPostureRevisionsRequest::name].
258        ///
259        /// This is a **required** field for requests.
260        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
261            self.0.request.name = v.into();
262            self
263        }
264
265        /// Sets the value of [page_size][crate::model::ListPostureRevisionsRequest::page_size].
266        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
267            self.0.request.page_size = v.into();
268            self
269        }
270
271        /// Sets the value of [page_token][crate::model::ListPostureRevisionsRequest::page_token].
272        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
273            self.0.request.page_token = v.into();
274            self
275        }
276    }
277
278    #[doc(hidden)]
279    impl gax::options::internal::RequestBuilder for ListPostureRevisions {
280        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
281            &mut self.0.options
282        }
283    }
284
285    /// The request builder for [SecurityPosture::get_posture][crate::client::SecurityPosture::get_posture] calls.
286    ///
287    /// # Example
288    /// ```no_run
289    /// # use google_cloud_securityposture_v1::builder;
290    /// use builder::security_posture::GetPosture;
291    /// # tokio_test::block_on(async {
292    ///
293    /// let builder = prepare_request_builder();
294    /// let response = builder.send().await?;
295    /// # gax::Result::<()>::Ok(()) });
296    ///
297    /// fn prepare_request_builder() -> GetPosture {
298    ///   # panic!();
299    ///   // ... details omitted ...
300    /// }
301    /// ```
302    #[derive(Clone, Debug)]
303    pub struct GetPosture(RequestBuilder<crate::model::GetPostureRequest>);
304
305    impl GetPosture {
306        pub(crate) fn new(
307            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
308        ) -> Self {
309            Self(RequestBuilder::new(stub))
310        }
311
312        /// Sets the full request, replacing any prior values.
313        pub fn with_request<V: Into<crate::model::GetPostureRequest>>(mut self, v: V) -> Self {
314            self.0.request = v.into();
315            self
316        }
317
318        /// Sets all the options, replacing any prior values.
319        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
320            self.0.options = v.into();
321            self
322        }
323
324        /// Sends the request.
325        pub async fn send(self) -> Result<crate::model::Posture> {
326            (*self.0.stub)
327                .get_posture(self.0.request, self.0.options)
328                .await
329                .map(gax::response::Response::into_body)
330        }
331
332        /// Sets the value of [name][crate::model::GetPostureRequest::name].
333        ///
334        /// This is a **required** field for requests.
335        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
336            self.0.request.name = v.into();
337            self
338        }
339
340        /// Sets the value of [revision_id][crate::model::GetPostureRequest::revision_id].
341        pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
342            self.0.request.revision_id = v.into();
343            self
344        }
345    }
346
347    #[doc(hidden)]
348    impl gax::options::internal::RequestBuilder for GetPosture {
349        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
350            &mut self.0.options
351        }
352    }
353
354    /// The request builder for [SecurityPosture::create_posture][crate::client::SecurityPosture::create_posture] calls.
355    ///
356    /// # Example
357    /// ```no_run
358    /// # use google_cloud_securityposture_v1::builder;
359    /// use builder::security_posture::CreatePosture;
360    /// # tokio_test::block_on(async {
361    /// use lro::Poller;
362    ///
363    /// let builder = prepare_request_builder();
364    /// let response = builder.poller().until_done().await?;
365    /// # gax::Result::<()>::Ok(()) });
366    ///
367    /// fn prepare_request_builder() -> CreatePosture {
368    ///   # panic!();
369    ///   // ... details omitted ...
370    /// }
371    /// ```
372    #[derive(Clone, Debug)]
373    pub struct CreatePosture(RequestBuilder<crate::model::CreatePostureRequest>);
374
375    impl CreatePosture {
376        pub(crate) fn new(
377            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
378        ) -> Self {
379            Self(RequestBuilder::new(stub))
380        }
381
382        /// Sets the full request, replacing any prior values.
383        pub fn with_request<V: Into<crate::model::CreatePostureRequest>>(mut self, v: V) -> Self {
384            self.0.request = v.into();
385            self
386        }
387
388        /// Sets all the options, replacing any prior values.
389        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
390            self.0.options = v.into();
391            self
392        }
393
394        /// Sends the request.
395        ///
396        /// # Long running operations
397        ///
398        /// This starts, but does not poll, a longrunning operation. More information
399        /// on [create_posture][crate::client::SecurityPosture::create_posture].
400        pub async fn send(self) -> Result<longrunning::model::Operation> {
401            (*self.0.stub)
402                .create_posture(self.0.request, self.0.options)
403                .await
404                .map(gax::response::Response::into_body)
405        }
406
407        /// Creates a [Poller][lro::Poller] to work with `create_posture`.
408        pub fn poller(
409            self,
410        ) -> impl lro::Poller<crate::model::Posture, crate::model::OperationMetadata> {
411            type Operation =
412                lro::internal::Operation<crate::model::Posture, crate::model::OperationMetadata>;
413            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
414            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
415
416            let stub = self.0.stub.clone();
417            let mut options = self.0.options.clone();
418            options.set_retry_policy(gax::retry_policy::NeverRetry);
419            let query = move |name| {
420                let stub = stub.clone();
421                let options = options.clone();
422                async {
423                    let op = GetOperation::new(stub)
424                        .set_name(name)
425                        .with_options(options)
426                        .send()
427                        .await?;
428                    Ok(Operation::new(op))
429                }
430            };
431
432            let start = move || async {
433                let op = self.send().await?;
434                Ok(Operation::new(op))
435            };
436
437            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
438        }
439
440        /// Sets the value of [parent][crate::model::CreatePostureRequest::parent].
441        ///
442        /// This is a **required** field for requests.
443        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
444            self.0.request.parent = v.into();
445            self
446        }
447
448        /// Sets the value of [posture_id][crate::model::CreatePostureRequest::posture_id].
449        ///
450        /// This is a **required** field for requests.
451        pub fn set_posture_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
452            self.0.request.posture_id = v.into();
453            self
454        }
455
456        /// Sets the value of [posture][crate::model::CreatePostureRequest::posture].
457        ///
458        /// This is a **required** field for requests.
459        pub fn set_posture<T>(mut self, v: T) -> Self
460        where
461            T: std::convert::Into<crate::model::Posture>,
462        {
463            self.0.request.posture = std::option::Option::Some(v.into());
464            self
465        }
466
467        /// Sets or clears the value of [posture][crate::model::CreatePostureRequest::posture].
468        ///
469        /// This is a **required** field for requests.
470        pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
471        where
472            T: std::convert::Into<crate::model::Posture>,
473        {
474            self.0.request.posture = v.map(|x| x.into());
475            self
476        }
477    }
478
479    #[doc(hidden)]
480    impl gax::options::internal::RequestBuilder for CreatePosture {
481        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
482            &mut self.0.options
483        }
484    }
485
486    /// The request builder for [SecurityPosture::update_posture][crate::client::SecurityPosture::update_posture] calls.
487    ///
488    /// # Example
489    /// ```no_run
490    /// # use google_cloud_securityposture_v1::builder;
491    /// use builder::security_posture::UpdatePosture;
492    /// # tokio_test::block_on(async {
493    /// use lro::Poller;
494    ///
495    /// let builder = prepare_request_builder();
496    /// let response = builder.poller().until_done().await?;
497    /// # gax::Result::<()>::Ok(()) });
498    ///
499    /// fn prepare_request_builder() -> UpdatePosture {
500    ///   # panic!();
501    ///   // ... details omitted ...
502    /// }
503    /// ```
504    #[derive(Clone, Debug)]
505    pub struct UpdatePosture(RequestBuilder<crate::model::UpdatePostureRequest>);
506
507    impl UpdatePosture {
508        pub(crate) fn new(
509            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
510        ) -> Self {
511            Self(RequestBuilder::new(stub))
512        }
513
514        /// Sets the full request, replacing any prior values.
515        pub fn with_request<V: Into<crate::model::UpdatePostureRequest>>(mut self, v: V) -> Self {
516            self.0.request = v.into();
517            self
518        }
519
520        /// Sets all the options, replacing any prior values.
521        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
522            self.0.options = v.into();
523            self
524        }
525
526        /// Sends the request.
527        ///
528        /// # Long running operations
529        ///
530        /// This starts, but does not poll, a longrunning operation. More information
531        /// on [update_posture][crate::client::SecurityPosture::update_posture].
532        pub async fn send(self) -> Result<longrunning::model::Operation> {
533            (*self.0.stub)
534                .update_posture(self.0.request, self.0.options)
535                .await
536                .map(gax::response::Response::into_body)
537        }
538
539        /// Creates a [Poller][lro::Poller] to work with `update_posture`.
540        pub fn poller(
541            self,
542        ) -> impl lro::Poller<crate::model::Posture, crate::model::OperationMetadata> {
543            type Operation =
544                lro::internal::Operation<crate::model::Posture, crate::model::OperationMetadata>;
545            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
546            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
547
548            let stub = self.0.stub.clone();
549            let mut options = self.0.options.clone();
550            options.set_retry_policy(gax::retry_policy::NeverRetry);
551            let query = move |name| {
552                let stub = stub.clone();
553                let options = options.clone();
554                async {
555                    let op = GetOperation::new(stub)
556                        .set_name(name)
557                        .with_options(options)
558                        .send()
559                        .await?;
560                    Ok(Operation::new(op))
561                }
562            };
563
564            let start = move || async {
565                let op = self.send().await?;
566                Ok(Operation::new(op))
567            };
568
569            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
570        }
571
572        /// Sets the value of [update_mask][crate::model::UpdatePostureRequest::update_mask].
573        ///
574        /// This is a **required** field for requests.
575        pub fn set_update_mask<T>(mut self, v: T) -> Self
576        where
577            T: std::convert::Into<wkt::FieldMask>,
578        {
579            self.0.request.update_mask = std::option::Option::Some(v.into());
580            self
581        }
582
583        /// Sets or clears the value of [update_mask][crate::model::UpdatePostureRequest::update_mask].
584        ///
585        /// This is a **required** field for requests.
586        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
587        where
588            T: std::convert::Into<wkt::FieldMask>,
589        {
590            self.0.request.update_mask = v.map(|x| x.into());
591            self
592        }
593
594        /// Sets the value of [posture][crate::model::UpdatePostureRequest::posture].
595        ///
596        /// This is a **required** field for requests.
597        pub fn set_posture<T>(mut self, v: T) -> Self
598        where
599            T: std::convert::Into<crate::model::Posture>,
600        {
601            self.0.request.posture = std::option::Option::Some(v.into());
602            self
603        }
604
605        /// Sets or clears the value of [posture][crate::model::UpdatePostureRequest::posture].
606        ///
607        /// This is a **required** field for requests.
608        pub fn set_or_clear_posture<T>(mut self, v: std::option::Option<T>) -> Self
609        where
610            T: std::convert::Into<crate::model::Posture>,
611        {
612            self.0.request.posture = v.map(|x| x.into());
613            self
614        }
615
616        /// Sets the value of [revision_id][crate::model::UpdatePostureRequest::revision_id].
617        ///
618        /// This is a **required** field for requests.
619        pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
620            self.0.request.revision_id = v.into();
621            self
622        }
623    }
624
625    #[doc(hidden)]
626    impl gax::options::internal::RequestBuilder for UpdatePosture {
627        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
628            &mut self.0.options
629        }
630    }
631
632    /// The request builder for [SecurityPosture::delete_posture][crate::client::SecurityPosture::delete_posture] calls.
633    ///
634    /// # Example
635    /// ```no_run
636    /// # use google_cloud_securityposture_v1::builder;
637    /// use builder::security_posture::DeletePosture;
638    /// # tokio_test::block_on(async {
639    /// use lro::Poller;
640    ///
641    /// let builder = prepare_request_builder();
642    /// let response = builder.poller().until_done().await?;
643    /// # gax::Result::<()>::Ok(()) });
644    ///
645    /// fn prepare_request_builder() -> DeletePosture {
646    ///   # panic!();
647    ///   // ... details omitted ...
648    /// }
649    /// ```
650    #[derive(Clone, Debug)]
651    pub struct DeletePosture(RequestBuilder<crate::model::DeletePostureRequest>);
652
653    impl DeletePosture {
654        pub(crate) fn new(
655            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
656        ) -> Self {
657            Self(RequestBuilder::new(stub))
658        }
659
660        /// Sets the full request, replacing any prior values.
661        pub fn with_request<V: Into<crate::model::DeletePostureRequest>>(mut self, v: V) -> Self {
662            self.0.request = v.into();
663            self
664        }
665
666        /// Sets all the options, replacing any prior values.
667        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
668            self.0.options = v.into();
669            self
670        }
671
672        /// Sends the request.
673        ///
674        /// # Long running operations
675        ///
676        /// This starts, but does not poll, a longrunning operation. More information
677        /// on [delete_posture][crate::client::SecurityPosture::delete_posture].
678        pub async fn send(self) -> Result<longrunning::model::Operation> {
679            (*self.0.stub)
680                .delete_posture(self.0.request, self.0.options)
681                .await
682                .map(gax::response::Response::into_body)
683        }
684
685        /// Creates a [Poller][lro::Poller] to work with `delete_posture`.
686        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
687            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
688            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
689            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
690
691            let stub = self.0.stub.clone();
692            let mut options = self.0.options.clone();
693            options.set_retry_policy(gax::retry_policy::NeverRetry);
694            let query = move |name| {
695                let stub = stub.clone();
696                let options = options.clone();
697                async {
698                    let op = GetOperation::new(stub)
699                        .set_name(name)
700                        .with_options(options)
701                        .send()
702                        .await?;
703                    Ok(Operation::new(op))
704                }
705            };
706
707            let start = move || async {
708                let op = self.send().await?;
709                Ok(Operation::new(op))
710            };
711
712            lro::internal::new_unit_response_poller(
713                polling_error_policy,
714                polling_backoff_policy,
715                start,
716                query,
717            )
718        }
719
720        /// Sets the value of [name][crate::model::DeletePostureRequest::name].
721        ///
722        /// This is a **required** field for requests.
723        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
724            self.0.request.name = v.into();
725            self
726        }
727
728        /// Sets the value of [etag][crate::model::DeletePostureRequest::etag].
729        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
730            self.0.request.etag = v.into();
731            self
732        }
733    }
734
735    #[doc(hidden)]
736    impl gax::options::internal::RequestBuilder for DeletePosture {
737        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
738            &mut self.0.options
739        }
740    }
741
742    /// The request builder for [SecurityPosture::extract_posture][crate::client::SecurityPosture::extract_posture] calls.
743    ///
744    /// # Example
745    /// ```no_run
746    /// # use google_cloud_securityposture_v1::builder;
747    /// use builder::security_posture::ExtractPosture;
748    /// # tokio_test::block_on(async {
749    /// use lro::Poller;
750    ///
751    /// let builder = prepare_request_builder();
752    /// let response = builder.poller().until_done().await?;
753    /// # gax::Result::<()>::Ok(()) });
754    ///
755    /// fn prepare_request_builder() -> ExtractPosture {
756    ///   # panic!();
757    ///   // ... details omitted ...
758    /// }
759    /// ```
760    #[derive(Clone, Debug)]
761    pub struct ExtractPosture(RequestBuilder<crate::model::ExtractPostureRequest>);
762
763    impl ExtractPosture {
764        pub(crate) fn new(
765            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
766        ) -> Self {
767            Self(RequestBuilder::new(stub))
768        }
769
770        /// Sets the full request, replacing any prior values.
771        pub fn with_request<V: Into<crate::model::ExtractPostureRequest>>(mut self, v: V) -> Self {
772            self.0.request = v.into();
773            self
774        }
775
776        /// Sets all the options, replacing any prior values.
777        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
778            self.0.options = v.into();
779            self
780        }
781
782        /// Sends the request.
783        ///
784        /// # Long running operations
785        ///
786        /// This starts, but does not poll, a longrunning operation. More information
787        /// on [extract_posture][crate::client::SecurityPosture::extract_posture].
788        pub async fn send(self) -> Result<longrunning::model::Operation> {
789            (*self.0.stub)
790                .extract_posture(self.0.request, self.0.options)
791                .await
792                .map(gax::response::Response::into_body)
793        }
794
795        /// Creates a [Poller][lro::Poller] to work with `extract_posture`.
796        pub fn poller(
797            self,
798        ) -> impl lro::Poller<crate::model::Posture, crate::model::OperationMetadata> {
799            type Operation =
800                lro::internal::Operation<crate::model::Posture, crate::model::OperationMetadata>;
801            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
802            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
803
804            let stub = self.0.stub.clone();
805            let mut options = self.0.options.clone();
806            options.set_retry_policy(gax::retry_policy::NeverRetry);
807            let query = move |name| {
808                let stub = stub.clone();
809                let options = options.clone();
810                async {
811                    let op = GetOperation::new(stub)
812                        .set_name(name)
813                        .with_options(options)
814                        .send()
815                        .await?;
816                    Ok(Operation::new(op))
817                }
818            };
819
820            let start = move || async {
821                let op = self.send().await?;
822                Ok(Operation::new(op))
823            };
824
825            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
826        }
827
828        /// Sets the value of [parent][crate::model::ExtractPostureRequest::parent].
829        ///
830        /// This is a **required** field for requests.
831        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
832            self.0.request.parent = v.into();
833            self
834        }
835
836        /// Sets the value of [posture_id][crate::model::ExtractPostureRequest::posture_id].
837        ///
838        /// This is a **required** field for requests.
839        pub fn set_posture_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
840            self.0.request.posture_id = v.into();
841            self
842        }
843
844        /// Sets the value of [workload][crate::model::ExtractPostureRequest::workload].
845        ///
846        /// This is a **required** field for requests.
847        pub fn set_workload<T: Into<std::string::String>>(mut self, v: T) -> Self {
848            self.0.request.workload = v.into();
849            self
850        }
851    }
852
853    #[doc(hidden)]
854    impl gax::options::internal::RequestBuilder for ExtractPosture {
855        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
856            &mut self.0.options
857        }
858    }
859
860    /// The request builder for [SecurityPosture::list_posture_deployments][crate::client::SecurityPosture::list_posture_deployments] calls.
861    ///
862    /// # Example
863    /// ```no_run
864    /// # use google_cloud_securityposture_v1::builder;
865    /// use builder::security_posture::ListPostureDeployments;
866    /// # tokio_test::block_on(async {
867    /// use gax::paginator::ItemPaginator;
868    ///
869    /// let builder = prepare_request_builder();
870    /// let mut items = builder.by_item();
871    /// while let Some(result) = items.next().await {
872    ///   let item = result?;
873    /// }
874    /// # gax::Result::<()>::Ok(()) });
875    ///
876    /// fn prepare_request_builder() -> ListPostureDeployments {
877    ///   # panic!();
878    ///   // ... details omitted ...
879    /// }
880    /// ```
881    #[derive(Clone, Debug)]
882    pub struct ListPostureDeployments(RequestBuilder<crate::model::ListPostureDeploymentsRequest>);
883
884    impl ListPostureDeployments {
885        pub(crate) fn new(
886            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
887        ) -> Self {
888            Self(RequestBuilder::new(stub))
889        }
890
891        /// Sets the full request, replacing any prior values.
892        pub fn with_request<V: Into<crate::model::ListPostureDeploymentsRequest>>(
893            mut self,
894            v: V,
895        ) -> Self {
896            self.0.request = v.into();
897            self
898        }
899
900        /// Sets all the options, replacing any prior values.
901        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
902            self.0.options = v.into();
903            self
904        }
905
906        /// Sends the request.
907        pub async fn send(self) -> Result<crate::model::ListPostureDeploymentsResponse> {
908            (*self.0.stub)
909                .list_posture_deployments(self.0.request, self.0.options)
910                .await
911                .map(gax::response::Response::into_body)
912        }
913
914        /// Streams each page in the collection.
915        pub fn by_page(
916            self,
917        ) -> impl gax::paginator::Paginator<
918            crate::model::ListPostureDeploymentsResponse,
919            gax::error::Error,
920        > {
921            use std::clone::Clone;
922            let token = self.0.request.page_token.clone();
923            let execute = move |token: String| {
924                let mut builder = self.clone();
925                builder.0.request = builder.0.request.set_page_token(token);
926                builder.send()
927            };
928            gax::paginator::internal::new_paginator(token, execute)
929        }
930
931        /// Streams each item in the collection.
932        pub fn by_item(
933            self,
934        ) -> impl gax::paginator::ItemPaginator<
935            crate::model::ListPostureDeploymentsResponse,
936            gax::error::Error,
937        > {
938            use gax::paginator::Paginator;
939            self.by_page().items()
940        }
941
942        /// Sets the value of [parent][crate::model::ListPostureDeploymentsRequest::parent].
943        ///
944        /// This is a **required** field for requests.
945        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
946            self.0.request.parent = v.into();
947            self
948        }
949
950        /// Sets the value of [page_size][crate::model::ListPostureDeploymentsRequest::page_size].
951        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
952            self.0.request.page_size = v.into();
953            self
954        }
955
956        /// Sets the value of [page_token][crate::model::ListPostureDeploymentsRequest::page_token].
957        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
958            self.0.request.page_token = v.into();
959            self
960        }
961
962        /// Sets the value of [filter][crate::model::ListPostureDeploymentsRequest::filter].
963        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
964            self.0.request.filter = v.into();
965            self
966        }
967    }
968
969    #[doc(hidden)]
970    impl gax::options::internal::RequestBuilder for ListPostureDeployments {
971        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
972            &mut self.0.options
973        }
974    }
975
976    /// The request builder for [SecurityPosture::get_posture_deployment][crate::client::SecurityPosture::get_posture_deployment] calls.
977    ///
978    /// # Example
979    /// ```no_run
980    /// # use google_cloud_securityposture_v1::builder;
981    /// use builder::security_posture::GetPostureDeployment;
982    /// # tokio_test::block_on(async {
983    ///
984    /// let builder = prepare_request_builder();
985    /// let response = builder.send().await?;
986    /// # gax::Result::<()>::Ok(()) });
987    ///
988    /// fn prepare_request_builder() -> GetPostureDeployment {
989    ///   # panic!();
990    ///   // ... details omitted ...
991    /// }
992    /// ```
993    #[derive(Clone, Debug)]
994    pub struct GetPostureDeployment(RequestBuilder<crate::model::GetPostureDeploymentRequest>);
995
996    impl GetPostureDeployment {
997        pub(crate) fn new(
998            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
999        ) -> Self {
1000            Self(RequestBuilder::new(stub))
1001        }
1002
1003        /// Sets the full request, replacing any prior values.
1004        pub fn with_request<V: Into<crate::model::GetPostureDeploymentRequest>>(
1005            mut self,
1006            v: V,
1007        ) -> Self {
1008            self.0.request = v.into();
1009            self
1010        }
1011
1012        /// Sets all the options, replacing any prior values.
1013        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1014            self.0.options = v.into();
1015            self
1016        }
1017
1018        /// Sends the request.
1019        pub async fn send(self) -> Result<crate::model::PostureDeployment> {
1020            (*self.0.stub)
1021                .get_posture_deployment(self.0.request, self.0.options)
1022                .await
1023                .map(gax::response::Response::into_body)
1024        }
1025
1026        /// Sets the value of [name][crate::model::GetPostureDeploymentRequest::name].
1027        ///
1028        /// This is a **required** field for requests.
1029        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1030            self.0.request.name = v.into();
1031            self
1032        }
1033    }
1034
1035    #[doc(hidden)]
1036    impl gax::options::internal::RequestBuilder for GetPostureDeployment {
1037        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1038            &mut self.0.options
1039        }
1040    }
1041
1042    /// The request builder for [SecurityPosture::create_posture_deployment][crate::client::SecurityPosture::create_posture_deployment] calls.
1043    ///
1044    /// # Example
1045    /// ```no_run
1046    /// # use google_cloud_securityposture_v1::builder;
1047    /// use builder::security_posture::CreatePostureDeployment;
1048    /// # tokio_test::block_on(async {
1049    /// use lro::Poller;
1050    ///
1051    /// let builder = prepare_request_builder();
1052    /// let response = builder.poller().until_done().await?;
1053    /// # gax::Result::<()>::Ok(()) });
1054    ///
1055    /// fn prepare_request_builder() -> CreatePostureDeployment {
1056    ///   # panic!();
1057    ///   // ... details omitted ...
1058    /// }
1059    /// ```
1060    #[derive(Clone, Debug)]
1061    pub struct CreatePostureDeployment(
1062        RequestBuilder<crate::model::CreatePostureDeploymentRequest>,
1063    );
1064
1065    impl CreatePostureDeployment {
1066        pub(crate) fn new(
1067            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1068        ) -> Self {
1069            Self(RequestBuilder::new(stub))
1070        }
1071
1072        /// Sets the full request, replacing any prior values.
1073        pub fn with_request<V: Into<crate::model::CreatePostureDeploymentRequest>>(
1074            mut self,
1075            v: V,
1076        ) -> Self {
1077            self.0.request = v.into();
1078            self
1079        }
1080
1081        /// Sets all the options, replacing any prior values.
1082        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1083            self.0.options = v.into();
1084            self
1085        }
1086
1087        /// Sends the request.
1088        ///
1089        /// # Long running operations
1090        ///
1091        /// This starts, but does not poll, a longrunning operation. More information
1092        /// on [create_posture_deployment][crate::client::SecurityPosture::create_posture_deployment].
1093        pub async fn send(self) -> Result<longrunning::model::Operation> {
1094            (*self.0.stub)
1095                .create_posture_deployment(self.0.request, self.0.options)
1096                .await
1097                .map(gax::response::Response::into_body)
1098        }
1099
1100        /// Creates a [Poller][lro::Poller] to work with `create_posture_deployment`.
1101        pub fn poller(
1102            self,
1103        ) -> impl lro::Poller<crate::model::PostureDeployment, crate::model::OperationMetadata>
1104        {
1105            type Operation = lro::internal::Operation<
1106                crate::model::PostureDeployment,
1107                crate::model::OperationMetadata,
1108            >;
1109            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1110            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1111
1112            let stub = self.0.stub.clone();
1113            let mut options = self.0.options.clone();
1114            options.set_retry_policy(gax::retry_policy::NeverRetry);
1115            let query = move |name| {
1116                let stub = stub.clone();
1117                let options = options.clone();
1118                async {
1119                    let op = GetOperation::new(stub)
1120                        .set_name(name)
1121                        .with_options(options)
1122                        .send()
1123                        .await?;
1124                    Ok(Operation::new(op))
1125                }
1126            };
1127
1128            let start = move || async {
1129                let op = self.send().await?;
1130                Ok(Operation::new(op))
1131            };
1132
1133            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1134        }
1135
1136        /// Sets the value of [parent][crate::model::CreatePostureDeploymentRequest::parent].
1137        ///
1138        /// This is a **required** field for requests.
1139        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1140            self.0.request.parent = v.into();
1141            self
1142        }
1143
1144        /// Sets the value of [posture_deployment_id][crate::model::CreatePostureDeploymentRequest::posture_deployment_id].
1145        ///
1146        /// This is a **required** field for requests.
1147        pub fn set_posture_deployment_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1148            self.0.request.posture_deployment_id = v.into();
1149            self
1150        }
1151
1152        /// Sets the value of [posture_deployment][crate::model::CreatePostureDeploymentRequest::posture_deployment].
1153        ///
1154        /// This is a **required** field for requests.
1155        pub fn set_posture_deployment<T>(mut self, v: T) -> Self
1156        where
1157            T: std::convert::Into<crate::model::PostureDeployment>,
1158        {
1159            self.0.request.posture_deployment = std::option::Option::Some(v.into());
1160            self
1161        }
1162
1163        /// Sets or clears the value of [posture_deployment][crate::model::CreatePostureDeploymentRequest::posture_deployment].
1164        ///
1165        /// This is a **required** field for requests.
1166        pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
1167        where
1168            T: std::convert::Into<crate::model::PostureDeployment>,
1169        {
1170            self.0.request.posture_deployment = v.map(|x| x.into());
1171            self
1172        }
1173    }
1174
1175    #[doc(hidden)]
1176    impl gax::options::internal::RequestBuilder for CreatePostureDeployment {
1177        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1178            &mut self.0.options
1179        }
1180    }
1181
1182    /// The request builder for [SecurityPosture::update_posture_deployment][crate::client::SecurityPosture::update_posture_deployment] calls.
1183    ///
1184    /// # Example
1185    /// ```no_run
1186    /// # use google_cloud_securityposture_v1::builder;
1187    /// use builder::security_posture::UpdatePostureDeployment;
1188    /// # tokio_test::block_on(async {
1189    /// use lro::Poller;
1190    ///
1191    /// let builder = prepare_request_builder();
1192    /// let response = builder.poller().until_done().await?;
1193    /// # gax::Result::<()>::Ok(()) });
1194    ///
1195    /// fn prepare_request_builder() -> UpdatePostureDeployment {
1196    ///   # panic!();
1197    ///   // ... details omitted ...
1198    /// }
1199    /// ```
1200    #[derive(Clone, Debug)]
1201    pub struct UpdatePostureDeployment(
1202        RequestBuilder<crate::model::UpdatePostureDeploymentRequest>,
1203    );
1204
1205    impl UpdatePostureDeployment {
1206        pub(crate) fn new(
1207            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1208        ) -> Self {
1209            Self(RequestBuilder::new(stub))
1210        }
1211
1212        /// Sets the full request, replacing any prior values.
1213        pub fn with_request<V: Into<crate::model::UpdatePostureDeploymentRequest>>(
1214            mut self,
1215            v: V,
1216        ) -> Self {
1217            self.0.request = v.into();
1218            self
1219        }
1220
1221        /// Sets all the options, replacing any prior values.
1222        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1223            self.0.options = v.into();
1224            self
1225        }
1226
1227        /// Sends the request.
1228        ///
1229        /// # Long running operations
1230        ///
1231        /// This starts, but does not poll, a longrunning operation. More information
1232        /// on [update_posture_deployment][crate::client::SecurityPosture::update_posture_deployment].
1233        pub async fn send(self) -> Result<longrunning::model::Operation> {
1234            (*self.0.stub)
1235                .update_posture_deployment(self.0.request, self.0.options)
1236                .await
1237                .map(gax::response::Response::into_body)
1238        }
1239
1240        /// Creates a [Poller][lro::Poller] to work with `update_posture_deployment`.
1241        pub fn poller(
1242            self,
1243        ) -> impl lro::Poller<crate::model::PostureDeployment, crate::model::OperationMetadata>
1244        {
1245            type Operation = lro::internal::Operation<
1246                crate::model::PostureDeployment,
1247                crate::model::OperationMetadata,
1248            >;
1249            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1250            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1251
1252            let stub = self.0.stub.clone();
1253            let mut options = self.0.options.clone();
1254            options.set_retry_policy(gax::retry_policy::NeverRetry);
1255            let query = move |name| {
1256                let stub = stub.clone();
1257                let options = options.clone();
1258                async {
1259                    let op = GetOperation::new(stub)
1260                        .set_name(name)
1261                        .with_options(options)
1262                        .send()
1263                        .await?;
1264                    Ok(Operation::new(op))
1265                }
1266            };
1267
1268            let start = move || async {
1269                let op = self.send().await?;
1270                Ok(Operation::new(op))
1271            };
1272
1273            lro::internal::new_poller(polling_error_policy, polling_backoff_policy, start, query)
1274        }
1275
1276        /// Sets the value of [update_mask][crate::model::UpdatePostureDeploymentRequest::update_mask].
1277        ///
1278        /// This is a **required** field for requests.
1279        pub fn set_update_mask<T>(mut self, v: T) -> Self
1280        where
1281            T: std::convert::Into<wkt::FieldMask>,
1282        {
1283            self.0.request.update_mask = std::option::Option::Some(v.into());
1284            self
1285        }
1286
1287        /// Sets or clears the value of [update_mask][crate::model::UpdatePostureDeploymentRequest::update_mask].
1288        ///
1289        /// This is a **required** field for requests.
1290        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
1291        where
1292            T: std::convert::Into<wkt::FieldMask>,
1293        {
1294            self.0.request.update_mask = v.map(|x| x.into());
1295            self
1296        }
1297
1298        /// Sets the value of [posture_deployment][crate::model::UpdatePostureDeploymentRequest::posture_deployment].
1299        ///
1300        /// This is a **required** field for requests.
1301        pub fn set_posture_deployment<T>(mut self, v: T) -> Self
1302        where
1303            T: std::convert::Into<crate::model::PostureDeployment>,
1304        {
1305            self.0.request.posture_deployment = std::option::Option::Some(v.into());
1306            self
1307        }
1308
1309        /// Sets or clears the value of [posture_deployment][crate::model::UpdatePostureDeploymentRequest::posture_deployment].
1310        ///
1311        /// This is a **required** field for requests.
1312        pub fn set_or_clear_posture_deployment<T>(mut self, v: std::option::Option<T>) -> Self
1313        where
1314            T: std::convert::Into<crate::model::PostureDeployment>,
1315        {
1316            self.0.request.posture_deployment = v.map(|x| x.into());
1317            self
1318        }
1319    }
1320
1321    #[doc(hidden)]
1322    impl gax::options::internal::RequestBuilder for UpdatePostureDeployment {
1323        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1324            &mut self.0.options
1325        }
1326    }
1327
1328    /// The request builder for [SecurityPosture::delete_posture_deployment][crate::client::SecurityPosture::delete_posture_deployment] calls.
1329    ///
1330    /// # Example
1331    /// ```no_run
1332    /// # use google_cloud_securityposture_v1::builder;
1333    /// use builder::security_posture::DeletePostureDeployment;
1334    /// # tokio_test::block_on(async {
1335    /// use lro::Poller;
1336    ///
1337    /// let builder = prepare_request_builder();
1338    /// let response = builder.poller().until_done().await?;
1339    /// # gax::Result::<()>::Ok(()) });
1340    ///
1341    /// fn prepare_request_builder() -> DeletePostureDeployment {
1342    ///   # panic!();
1343    ///   // ... details omitted ...
1344    /// }
1345    /// ```
1346    #[derive(Clone, Debug)]
1347    pub struct DeletePostureDeployment(
1348        RequestBuilder<crate::model::DeletePostureDeploymentRequest>,
1349    );
1350
1351    impl DeletePostureDeployment {
1352        pub(crate) fn new(
1353            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1354        ) -> Self {
1355            Self(RequestBuilder::new(stub))
1356        }
1357
1358        /// Sets the full request, replacing any prior values.
1359        pub fn with_request<V: Into<crate::model::DeletePostureDeploymentRequest>>(
1360            mut self,
1361            v: V,
1362        ) -> Self {
1363            self.0.request = v.into();
1364            self
1365        }
1366
1367        /// Sets all the options, replacing any prior values.
1368        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1369            self.0.options = v.into();
1370            self
1371        }
1372
1373        /// Sends the request.
1374        ///
1375        /// # Long running operations
1376        ///
1377        /// This starts, but does not poll, a longrunning operation. More information
1378        /// on [delete_posture_deployment][crate::client::SecurityPosture::delete_posture_deployment].
1379        pub async fn send(self) -> Result<longrunning::model::Operation> {
1380            (*self.0.stub)
1381                .delete_posture_deployment(self.0.request, self.0.options)
1382                .await
1383                .map(gax::response::Response::into_body)
1384        }
1385
1386        /// Creates a [Poller][lro::Poller] to work with `delete_posture_deployment`.
1387        pub fn poller(self) -> impl lro::Poller<(), crate::model::OperationMetadata> {
1388            type Operation = lro::internal::Operation<wkt::Empty, crate::model::OperationMetadata>;
1389            let polling_error_policy = self.0.stub.get_polling_error_policy(&self.0.options);
1390            let polling_backoff_policy = self.0.stub.get_polling_backoff_policy(&self.0.options);
1391
1392            let stub = self.0.stub.clone();
1393            let mut options = self.0.options.clone();
1394            options.set_retry_policy(gax::retry_policy::NeverRetry);
1395            let query = move |name| {
1396                let stub = stub.clone();
1397                let options = options.clone();
1398                async {
1399                    let op = GetOperation::new(stub)
1400                        .set_name(name)
1401                        .with_options(options)
1402                        .send()
1403                        .await?;
1404                    Ok(Operation::new(op))
1405                }
1406            };
1407
1408            let start = move || async {
1409                let op = self.send().await?;
1410                Ok(Operation::new(op))
1411            };
1412
1413            lro::internal::new_unit_response_poller(
1414                polling_error_policy,
1415                polling_backoff_policy,
1416                start,
1417                query,
1418            )
1419        }
1420
1421        /// Sets the value of [name][crate::model::DeletePostureDeploymentRequest::name].
1422        ///
1423        /// This is a **required** field for requests.
1424        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1425            self.0.request.name = v.into();
1426            self
1427        }
1428
1429        /// Sets the value of [etag][crate::model::DeletePostureDeploymentRequest::etag].
1430        pub fn set_etag<T: Into<std::string::String>>(mut self, v: T) -> Self {
1431            self.0.request.etag = v.into();
1432            self
1433        }
1434    }
1435
1436    #[doc(hidden)]
1437    impl gax::options::internal::RequestBuilder for DeletePostureDeployment {
1438        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1439            &mut self.0.options
1440        }
1441    }
1442
1443    /// The request builder for [SecurityPosture::list_posture_templates][crate::client::SecurityPosture::list_posture_templates] calls.
1444    ///
1445    /// # Example
1446    /// ```no_run
1447    /// # use google_cloud_securityposture_v1::builder;
1448    /// use builder::security_posture::ListPostureTemplates;
1449    /// # tokio_test::block_on(async {
1450    /// use gax::paginator::ItemPaginator;
1451    ///
1452    /// let builder = prepare_request_builder();
1453    /// let mut items = builder.by_item();
1454    /// while let Some(result) = items.next().await {
1455    ///   let item = result?;
1456    /// }
1457    /// # gax::Result::<()>::Ok(()) });
1458    ///
1459    /// fn prepare_request_builder() -> ListPostureTemplates {
1460    ///   # panic!();
1461    ///   // ... details omitted ...
1462    /// }
1463    /// ```
1464    #[derive(Clone, Debug)]
1465    pub struct ListPostureTemplates(RequestBuilder<crate::model::ListPostureTemplatesRequest>);
1466
1467    impl ListPostureTemplates {
1468        pub(crate) fn new(
1469            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1470        ) -> Self {
1471            Self(RequestBuilder::new(stub))
1472        }
1473
1474        /// Sets the full request, replacing any prior values.
1475        pub fn with_request<V: Into<crate::model::ListPostureTemplatesRequest>>(
1476            mut self,
1477            v: V,
1478        ) -> Self {
1479            self.0.request = v.into();
1480            self
1481        }
1482
1483        /// Sets all the options, replacing any prior values.
1484        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1485            self.0.options = v.into();
1486            self
1487        }
1488
1489        /// Sends the request.
1490        pub async fn send(self) -> Result<crate::model::ListPostureTemplatesResponse> {
1491            (*self.0.stub)
1492                .list_posture_templates(self.0.request, self.0.options)
1493                .await
1494                .map(gax::response::Response::into_body)
1495        }
1496
1497        /// Streams each page in the collection.
1498        pub fn by_page(
1499            self,
1500        ) -> impl gax::paginator::Paginator<crate::model::ListPostureTemplatesResponse, gax::error::Error>
1501        {
1502            use std::clone::Clone;
1503            let token = self.0.request.page_token.clone();
1504            let execute = move |token: String| {
1505                let mut builder = self.clone();
1506                builder.0.request = builder.0.request.set_page_token(token);
1507                builder.send()
1508            };
1509            gax::paginator::internal::new_paginator(token, execute)
1510        }
1511
1512        /// Streams each item in the collection.
1513        pub fn by_item(
1514            self,
1515        ) -> impl gax::paginator::ItemPaginator<
1516            crate::model::ListPostureTemplatesResponse,
1517            gax::error::Error,
1518        > {
1519            use gax::paginator::Paginator;
1520            self.by_page().items()
1521        }
1522
1523        /// Sets the value of [parent][crate::model::ListPostureTemplatesRequest::parent].
1524        ///
1525        /// This is a **required** field for requests.
1526        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1527            self.0.request.parent = v.into();
1528            self
1529        }
1530
1531        /// Sets the value of [page_size][crate::model::ListPostureTemplatesRequest::page_size].
1532        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1533            self.0.request.page_size = v.into();
1534            self
1535        }
1536
1537        /// Sets the value of [page_token][crate::model::ListPostureTemplatesRequest::page_token].
1538        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1539            self.0.request.page_token = v.into();
1540            self
1541        }
1542
1543        /// Sets the value of [filter][crate::model::ListPostureTemplatesRequest::filter].
1544        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1545            self.0.request.filter = v.into();
1546            self
1547        }
1548    }
1549
1550    #[doc(hidden)]
1551    impl gax::options::internal::RequestBuilder for ListPostureTemplates {
1552        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1553            &mut self.0.options
1554        }
1555    }
1556
1557    /// The request builder for [SecurityPosture::get_posture_template][crate::client::SecurityPosture::get_posture_template] calls.
1558    ///
1559    /// # Example
1560    /// ```no_run
1561    /// # use google_cloud_securityposture_v1::builder;
1562    /// use builder::security_posture::GetPostureTemplate;
1563    /// # tokio_test::block_on(async {
1564    ///
1565    /// let builder = prepare_request_builder();
1566    /// let response = builder.send().await?;
1567    /// # gax::Result::<()>::Ok(()) });
1568    ///
1569    /// fn prepare_request_builder() -> GetPostureTemplate {
1570    ///   # panic!();
1571    ///   // ... details omitted ...
1572    /// }
1573    /// ```
1574    #[derive(Clone, Debug)]
1575    pub struct GetPostureTemplate(RequestBuilder<crate::model::GetPostureTemplateRequest>);
1576
1577    impl GetPostureTemplate {
1578        pub(crate) fn new(
1579            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1580        ) -> Self {
1581            Self(RequestBuilder::new(stub))
1582        }
1583
1584        /// Sets the full request, replacing any prior values.
1585        pub fn with_request<V: Into<crate::model::GetPostureTemplateRequest>>(
1586            mut self,
1587            v: V,
1588        ) -> Self {
1589            self.0.request = v.into();
1590            self
1591        }
1592
1593        /// Sets all the options, replacing any prior values.
1594        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1595            self.0.options = v.into();
1596            self
1597        }
1598
1599        /// Sends the request.
1600        pub async fn send(self) -> Result<crate::model::PostureTemplate> {
1601            (*self.0.stub)
1602                .get_posture_template(self.0.request, self.0.options)
1603                .await
1604                .map(gax::response::Response::into_body)
1605        }
1606
1607        /// Sets the value of [name][crate::model::GetPostureTemplateRequest::name].
1608        ///
1609        /// This is a **required** field for requests.
1610        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1611            self.0.request.name = v.into();
1612            self
1613        }
1614
1615        /// Sets the value of [revision_id][crate::model::GetPostureTemplateRequest::revision_id].
1616        pub fn set_revision_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
1617            self.0.request.revision_id = v.into();
1618            self
1619        }
1620    }
1621
1622    #[doc(hidden)]
1623    impl gax::options::internal::RequestBuilder for GetPostureTemplate {
1624        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1625            &mut self.0.options
1626        }
1627    }
1628
1629    /// The request builder for [SecurityPosture::list_locations][crate::client::SecurityPosture::list_locations] calls.
1630    ///
1631    /// # Example
1632    /// ```no_run
1633    /// # use google_cloud_securityposture_v1::builder;
1634    /// use builder::security_posture::ListLocations;
1635    /// # tokio_test::block_on(async {
1636    /// use gax::paginator::ItemPaginator;
1637    ///
1638    /// let builder = prepare_request_builder();
1639    /// let mut items = builder.by_item();
1640    /// while let Some(result) = items.next().await {
1641    ///   let item = result?;
1642    /// }
1643    /// # gax::Result::<()>::Ok(()) });
1644    ///
1645    /// fn prepare_request_builder() -> ListLocations {
1646    ///   # panic!();
1647    ///   // ... details omitted ...
1648    /// }
1649    /// ```
1650    #[derive(Clone, Debug)]
1651    pub struct ListLocations(RequestBuilder<location::model::ListLocationsRequest>);
1652
1653    impl ListLocations {
1654        pub(crate) fn new(
1655            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1656        ) -> Self {
1657            Self(RequestBuilder::new(stub))
1658        }
1659
1660        /// Sets the full request, replacing any prior values.
1661        pub fn with_request<V: Into<location::model::ListLocationsRequest>>(
1662            mut self,
1663            v: V,
1664        ) -> Self {
1665            self.0.request = v.into();
1666            self
1667        }
1668
1669        /// Sets all the options, replacing any prior values.
1670        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1671            self.0.options = v.into();
1672            self
1673        }
1674
1675        /// Sends the request.
1676        pub async fn send(self) -> Result<location::model::ListLocationsResponse> {
1677            (*self.0.stub)
1678                .list_locations(self.0.request, self.0.options)
1679                .await
1680                .map(gax::response::Response::into_body)
1681        }
1682
1683        /// Streams each page in the collection.
1684        pub fn by_page(
1685            self,
1686        ) -> impl gax::paginator::Paginator<location::model::ListLocationsResponse, gax::error::Error>
1687        {
1688            use std::clone::Clone;
1689            let token = self.0.request.page_token.clone();
1690            let execute = move |token: String| {
1691                let mut builder = self.clone();
1692                builder.0.request = builder.0.request.set_page_token(token);
1693                builder.send()
1694            };
1695            gax::paginator::internal::new_paginator(token, execute)
1696        }
1697
1698        /// Streams each item in the collection.
1699        pub fn by_item(
1700            self,
1701        ) -> impl gax::paginator::ItemPaginator<location::model::ListLocationsResponse, gax::error::Error>
1702        {
1703            use gax::paginator::Paginator;
1704            self.by_page().items()
1705        }
1706
1707        /// Sets the value of [name][location::model::ListLocationsRequest::name].
1708        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1709            self.0.request.name = v.into();
1710            self
1711        }
1712
1713        /// Sets the value of [filter][location::model::ListLocationsRequest::filter].
1714        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1715            self.0.request.filter = v.into();
1716            self
1717        }
1718
1719        /// Sets the value of [page_size][location::model::ListLocationsRequest::page_size].
1720        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1721            self.0.request.page_size = v.into();
1722            self
1723        }
1724
1725        /// Sets the value of [page_token][location::model::ListLocationsRequest::page_token].
1726        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1727            self.0.request.page_token = v.into();
1728            self
1729        }
1730    }
1731
1732    #[doc(hidden)]
1733    impl gax::options::internal::RequestBuilder for ListLocations {
1734        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1735            &mut self.0.options
1736        }
1737    }
1738
1739    /// The request builder for [SecurityPosture::get_location][crate::client::SecurityPosture::get_location] calls.
1740    ///
1741    /// # Example
1742    /// ```no_run
1743    /// # use google_cloud_securityposture_v1::builder;
1744    /// use builder::security_posture::GetLocation;
1745    /// # tokio_test::block_on(async {
1746    ///
1747    /// let builder = prepare_request_builder();
1748    /// let response = builder.send().await?;
1749    /// # gax::Result::<()>::Ok(()) });
1750    ///
1751    /// fn prepare_request_builder() -> GetLocation {
1752    ///   # panic!();
1753    ///   // ... details omitted ...
1754    /// }
1755    /// ```
1756    #[derive(Clone, Debug)]
1757    pub struct GetLocation(RequestBuilder<location::model::GetLocationRequest>);
1758
1759    impl GetLocation {
1760        pub(crate) fn new(
1761            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1762        ) -> Self {
1763            Self(RequestBuilder::new(stub))
1764        }
1765
1766        /// Sets the full request, replacing any prior values.
1767        pub fn with_request<V: Into<location::model::GetLocationRequest>>(mut self, v: V) -> Self {
1768            self.0.request = v.into();
1769            self
1770        }
1771
1772        /// Sets all the options, replacing any prior values.
1773        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1774            self.0.options = v.into();
1775            self
1776        }
1777
1778        /// Sends the request.
1779        pub async fn send(self) -> Result<location::model::Location> {
1780            (*self.0.stub)
1781                .get_location(self.0.request, self.0.options)
1782                .await
1783                .map(gax::response::Response::into_body)
1784        }
1785
1786        /// Sets the value of [name][location::model::GetLocationRequest::name].
1787        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1788            self.0.request.name = v.into();
1789            self
1790        }
1791    }
1792
1793    #[doc(hidden)]
1794    impl gax::options::internal::RequestBuilder for GetLocation {
1795        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1796            &mut self.0.options
1797        }
1798    }
1799
1800    /// The request builder for [SecurityPosture::list_operations][crate::client::SecurityPosture::list_operations] calls.
1801    ///
1802    /// # Example
1803    /// ```no_run
1804    /// # use google_cloud_securityposture_v1::builder;
1805    /// use builder::security_posture::ListOperations;
1806    /// # tokio_test::block_on(async {
1807    /// use gax::paginator::ItemPaginator;
1808    ///
1809    /// let builder = prepare_request_builder();
1810    /// let mut items = builder.by_item();
1811    /// while let Some(result) = items.next().await {
1812    ///   let item = result?;
1813    /// }
1814    /// # gax::Result::<()>::Ok(()) });
1815    ///
1816    /// fn prepare_request_builder() -> ListOperations {
1817    ///   # panic!();
1818    ///   // ... details omitted ...
1819    /// }
1820    /// ```
1821    #[derive(Clone, Debug)]
1822    pub struct ListOperations(RequestBuilder<longrunning::model::ListOperationsRequest>);
1823
1824    impl ListOperations {
1825        pub(crate) fn new(
1826            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1827        ) -> Self {
1828            Self(RequestBuilder::new(stub))
1829        }
1830
1831        /// Sets the full request, replacing any prior values.
1832        pub fn with_request<V: Into<longrunning::model::ListOperationsRequest>>(
1833            mut self,
1834            v: V,
1835        ) -> Self {
1836            self.0.request = v.into();
1837            self
1838        }
1839
1840        /// Sets all the options, replacing any prior values.
1841        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1842            self.0.options = v.into();
1843            self
1844        }
1845
1846        /// Sends the request.
1847        pub async fn send(self) -> Result<longrunning::model::ListOperationsResponse> {
1848            (*self.0.stub)
1849                .list_operations(self.0.request, self.0.options)
1850                .await
1851                .map(gax::response::Response::into_body)
1852        }
1853
1854        /// Streams each page in the collection.
1855        pub fn by_page(
1856            self,
1857        ) -> impl gax::paginator::Paginator<longrunning::model::ListOperationsResponse, gax::error::Error>
1858        {
1859            use std::clone::Clone;
1860            let token = self.0.request.page_token.clone();
1861            let execute = move |token: String| {
1862                let mut builder = self.clone();
1863                builder.0.request = builder.0.request.set_page_token(token);
1864                builder.send()
1865            };
1866            gax::paginator::internal::new_paginator(token, execute)
1867        }
1868
1869        /// Streams each item in the collection.
1870        pub fn by_item(
1871            self,
1872        ) -> impl gax::paginator::ItemPaginator<
1873            longrunning::model::ListOperationsResponse,
1874            gax::error::Error,
1875        > {
1876            use gax::paginator::Paginator;
1877            self.by_page().items()
1878        }
1879
1880        /// Sets the value of [name][longrunning::model::ListOperationsRequest::name].
1881        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1882            self.0.request.name = v.into();
1883            self
1884        }
1885
1886        /// Sets the value of [filter][longrunning::model::ListOperationsRequest::filter].
1887        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
1888            self.0.request.filter = v.into();
1889            self
1890        }
1891
1892        /// Sets the value of [page_size][longrunning::model::ListOperationsRequest::page_size].
1893        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1894            self.0.request.page_size = v.into();
1895            self
1896        }
1897
1898        /// Sets the value of [page_token][longrunning::model::ListOperationsRequest::page_token].
1899        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
1900            self.0.request.page_token = v.into();
1901            self
1902        }
1903
1904        /// Sets the value of [return_partial_success][longrunning::model::ListOperationsRequest::return_partial_success].
1905        pub fn set_return_partial_success<T: Into<bool>>(mut self, v: T) -> Self {
1906            self.0.request.return_partial_success = v.into();
1907            self
1908        }
1909    }
1910
1911    #[doc(hidden)]
1912    impl gax::options::internal::RequestBuilder for ListOperations {
1913        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1914            &mut self.0.options
1915        }
1916    }
1917
1918    /// The request builder for [SecurityPosture::get_operation][crate::client::SecurityPosture::get_operation] calls.
1919    ///
1920    /// # Example
1921    /// ```no_run
1922    /// # use google_cloud_securityposture_v1::builder;
1923    /// use builder::security_posture::GetOperation;
1924    /// # tokio_test::block_on(async {
1925    ///
1926    /// let builder = prepare_request_builder();
1927    /// let response = builder.send().await?;
1928    /// # gax::Result::<()>::Ok(()) });
1929    ///
1930    /// fn prepare_request_builder() -> GetOperation {
1931    ///   # panic!();
1932    ///   // ... details omitted ...
1933    /// }
1934    /// ```
1935    #[derive(Clone, Debug)]
1936    pub struct GetOperation(RequestBuilder<longrunning::model::GetOperationRequest>);
1937
1938    impl GetOperation {
1939        pub(crate) fn new(
1940            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
1941        ) -> Self {
1942            Self(RequestBuilder::new(stub))
1943        }
1944
1945        /// Sets the full request, replacing any prior values.
1946        pub fn with_request<V: Into<longrunning::model::GetOperationRequest>>(
1947            mut self,
1948            v: V,
1949        ) -> Self {
1950            self.0.request = v.into();
1951            self
1952        }
1953
1954        /// Sets all the options, replacing any prior values.
1955        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1956            self.0.options = v.into();
1957            self
1958        }
1959
1960        /// Sends the request.
1961        pub async fn send(self) -> Result<longrunning::model::Operation> {
1962            (*self.0.stub)
1963                .get_operation(self.0.request, self.0.options)
1964                .await
1965                .map(gax::response::Response::into_body)
1966        }
1967
1968        /// Sets the value of [name][longrunning::model::GetOperationRequest::name].
1969        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
1970            self.0.request.name = v.into();
1971            self
1972        }
1973    }
1974
1975    #[doc(hidden)]
1976    impl gax::options::internal::RequestBuilder for GetOperation {
1977        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1978            &mut self.0.options
1979        }
1980    }
1981
1982    /// The request builder for [SecurityPosture::delete_operation][crate::client::SecurityPosture::delete_operation] calls.
1983    ///
1984    /// # Example
1985    /// ```no_run
1986    /// # use google_cloud_securityposture_v1::builder;
1987    /// use builder::security_posture::DeleteOperation;
1988    /// # tokio_test::block_on(async {
1989    ///
1990    /// let builder = prepare_request_builder();
1991    /// let response = builder.send().await?;
1992    /// # gax::Result::<()>::Ok(()) });
1993    ///
1994    /// fn prepare_request_builder() -> DeleteOperation {
1995    ///   # panic!();
1996    ///   // ... details omitted ...
1997    /// }
1998    /// ```
1999    #[derive(Clone, Debug)]
2000    pub struct DeleteOperation(RequestBuilder<longrunning::model::DeleteOperationRequest>);
2001
2002    impl DeleteOperation {
2003        pub(crate) fn new(
2004            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
2005        ) -> Self {
2006            Self(RequestBuilder::new(stub))
2007        }
2008
2009        /// Sets the full request, replacing any prior values.
2010        pub fn with_request<V: Into<longrunning::model::DeleteOperationRequest>>(
2011            mut self,
2012            v: V,
2013        ) -> Self {
2014            self.0.request = v.into();
2015            self
2016        }
2017
2018        /// Sets all the options, replacing any prior values.
2019        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2020            self.0.options = v.into();
2021            self
2022        }
2023
2024        /// Sends the request.
2025        pub async fn send(self) -> Result<()> {
2026            (*self.0.stub)
2027                .delete_operation(self.0.request, self.0.options)
2028                .await
2029                .map(gax::response::Response::into_body)
2030        }
2031
2032        /// Sets the value of [name][longrunning::model::DeleteOperationRequest::name].
2033        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2034            self.0.request.name = v.into();
2035            self
2036        }
2037    }
2038
2039    #[doc(hidden)]
2040    impl gax::options::internal::RequestBuilder for DeleteOperation {
2041        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2042            &mut self.0.options
2043        }
2044    }
2045
2046    /// The request builder for [SecurityPosture::cancel_operation][crate::client::SecurityPosture::cancel_operation] calls.
2047    ///
2048    /// # Example
2049    /// ```no_run
2050    /// # use google_cloud_securityposture_v1::builder;
2051    /// use builder::security_posture::CancelOperation;
2052    /// # tokio_test::block_on(async {
2053    ///
2054    /// let builder = prepare_request_builder();
2055    /// let response = builder.send().await?;
2056    /// # gax::Result::<()>::Ok(()) });
2057    ///
2058    /// fn prepare_request_builder() -> CancelOperation {
2059    ///   # panic!();
2060    ///   // ... details omitted ...
2061    /// }
2062    /// ```
2063    #[derive(Clone, Debug)]
2064    pub struct CancelOperation(RequestBuilder<longrunning::model::CancelOperationRequest>);
2065
2066    impl CancelOperation {
2067        pub(crate) fn new(
2068            stub: std::sync::Arc<dyn super::super::stub::dynamic::SecurityPosture>,
2069        ) -> Self {
2070            Self(RequestBuilder::new(stub))
2071        }
2072
2073        /// Sets the full request, replacing any prior values.
2074        pub fn with_request<V: Into<longrunning::model::CancelOperationRequest>>(
2075            mut self,
2076            v: V,
2077        ) -> Self {
2078            self.0.request = v.into();
2079            self
2080        }
2081
2082        /// Sets all the options, replacing any prior values.
2083        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
2084            self.0.options = v.into();
2085            self
2086        }
2087
2088        /// Sends the request.
2089        pub async fn send(self) -> Result<()> {
2090            (*self.0.stub)
2091                .cancel_operation(self.0.request, self.0.options)
2092                .await
2093                .map(gax::response::Response::into_body)
2094        }
2095
2096        /// Sets the value of [name][longrunning::model::CancelOperationRequest::name].
2097        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
2098            self.0.request.name = v.into();
2099            self
2100        }
2101    }
2102
2103    #[doc(hidden)]
2104    impl gax::options::internal::RequestBuilder for CancelOperation {
2105        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
2106            &mut self.0.options
2107        }
2108    }
2109}