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