google_cloud_websecurityscanner_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 web_security_scanner {
18    use crate::Result;
19
20    /// A builder for [WebSecurityScanner][crate::client::WebSecurityScanner].
21    ///
22    /// ```
23    /// # async fn sample() -> gax::client_builder::Result<()> {
24    /// # use google_cloud_websecurityscanner_v1::*;
25    /// # use builder::web_security_scanner::ClientBuilder;
26    /// # use client::WebSecurityScanner;
27    /// let builder : ClientBuilder = WebSecurityScanner::builder();
28    /// let client = builder
29    ///     .with_endpoint("https://websecurityscanner.googleapis.com")
30    ///     .build().await?;
31    /// # 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::WebSecurityScanner;
38        pub struct Factory;
39        impl gax::client_builder::internal::ClientFactory for Factory {
40            type Client = WebSecurityScanner;
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::WebSecurityScanner] 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::WebSecurityScanner>,
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::WebSecurityScanner>,
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 [WebSecurityScanner::create_scan_config][crate::client::WebSecurityScanner::create_scan_config] calls.
75    ///
76    /// # Example
77    /// ```
78    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::CreateScanConfig;
79    /// # async fn sample() -> gax::Result<()> {
80    ///
81    /// let builder = prepare_request_builder();
82    /// let response = builder.send().await?;
83    /// # Ok(()) }
84    ///
85    /// fn prepare_request_builder() -> CreateScanConfig {
86    ///   # panic!();
87    ///   // ... details omitted ...
88    /// }
89    /// ```
90    #[derive(Clone, Debug)]
91    pub struct CreateScanConfig(RequestBuilder<crate::model::CreateScanConfigRequest>);
92
93    impl CreateScanConfig {
94        pub(crate) fn new(
95            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
96        ) -> Self {
97            Self(RequestBuilder::new(stub))
98        }
99
100        /// Sets the full request, replacing any prior values.
101        pub fn with_request<V: Into<crate::model::CreateScanConfigRequest>>(
102            mut self,
103            v: V,
104        ) -> Self {
105            self.0.request = v.into();
106            self
107        }
108
109        /// Sets all the options, replacing any prior values.
110        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
111            self.0.options = v.into();
112            self
113        }
114
115        /// Sends the request.
116        pub async fn send(self) -> Result<crate::model::ScanConfig> {
117            (*self.0.stub)
118                .create_scan_config(self.0.request, self.0.options)
119                .await
120                .map(gax::response::Response::into_body)
121        }
122
123        /// Sets the value of [parent][crate::model::CreateScanConfigRequest::parent].
124        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
125            self.0.request.parent = v.into();
126            self
127        }
128
129        /// Sets the value of [scan_config][crate::model::CreateScanConfigRequest::scan_config].
130        pub fn set_scan_config<T>(mut self, v: T) -> Self
131        where
132            T: std::convert::Into<crate::model::ScanConfig>,
133        {
134            self.0.request.scan_config = std::option::Option::Some(v.into());
135            self
136        }
137
138        /// Sets or clears the value of [scan_config][crate::model::CreateScanConfigRequest::scan_config].
139        pub fn set_or_clear_scan_config<T>(mut self, v: std::option::Option<T>) -> Self
140        where
141            T: std::convert::Into<crate::model::ScanConfig>,
142        {
143            self.0.request.scan_config = v.map(|x| x.into());
144            self
145        }
146    }
147
148    #[doc(hidden)]
149    impl gax::options::internal::RequestBuilder for CreateScanConfig {
150        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
151            &mut self.0.options
152        }
153    }
154
155    /// The request builder for [WebSecurityScanner::delete_scan_config][crate::client::WebSecurityScanner::delete_scan_config] calls.
156    ///
157    /// # Example
158    /// ```
159    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::DeleteScanConfig;
160    /// # async fn sample() -> gax::Result<()> {
161    ///
162    /// let builder = prepare_request_builder();
163    /// let response = builder.send().await?;
164    /// # Ok(()) }
165    ///
166    /// fn prepare_request_builder() -> DeleteScanConfig {
167    ///   # panic!();
168    ///   // ... details omitted ...
169    /// }
170    /// ```
171    #[derive(Clone, Debug)]
172    pub struct DeleteScanConfig(RequestBuilder<crate::model::DeleteScanConfigRequest>);
173
174    impl DeleteScanConfig {
175        pub(crate) fn new(
176            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
177        ) -> Self {
178            Self(RequestBuilder::new(stub))
179        }
180
181        /// Sets the full request, replacing any prior values.
182        pub fn with_request<V: Into<crate::model::DeleteScanConfigRequest>>(
183            mut self,
184            v: V,
185        ) -> Self {
186            self.0.request = v.into();
187            self
188        }
189
190        /// Sets all the options, replacing any prior values.
191        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
192            self.0.options = v.into();
193            self
194        }
195
196        /// Sends the request.
197        pub async fn send(self) -> Result<()> {
198            (*self.0.stub)
199                .delete_scan_config(self.0.request, self.0.options)
200                .await
201                .map(gax::response::Response::into_body)
202        }
203
204        /// Sets the value of [name][crate::model::DeleteScanConfigRequest::name].
205        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
206            self.0.request.name = v.into();
207            self
208        }
209    }
210
211    #[doc(hidden)]
212    impl gax::options::internal::RequestBuilder for DeleteScanConfig {
213        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
214            &mut self.0.options
215        }
216    }
217
218    /// The request builder for [WebSecurityScanner::get_scan_config][crate::client::WebSecurityScanner::get_scan_config] calls.
219    ///
220    /// # Example
221    /// ```
222    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::GetScanConfig;
223    /// # async fn sample() -> gax::Result<()> {
224    ///
225    /// let builder = prepare_request_builder();
226    /// let response = builder.send().await?;
227    /// # Ok(()) }
228    ///
229    /// fn prepare_request_builder() -> GetScanConfig {
230    ///   # panic!();
231    ///   // ... details omitted ...
232    /// }
233    /// ```
234    #[derive(Clone, Debug)]
235    pub struct GetScanConfig(RequestBuilder<crate::model::GetScanConfigRequest>);
236
237    impl GetScanConfig {
238        pub(crate) fn new(
239            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
240        ) -> Self {
241            Self(RequestBuilder::new(stub))
242        }
243
244        /// Sets the full request, replacing any prior values.
245        pub fn with_request<V: Into<crate::model::GetScanConfigRequest>>(mut self, v: V) -> Self {
246            self.0.request = v.into();
247            self
248        }
249
250        /// Sets all the options, replacing any prior values.
251        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
252            self.0.options = v.into();
253            self
254        }
255
256        /// Sends the request.
257        pub async fn send(self) -> Result<crate::model::ScanConfig> {
258            (*self.0.stub)
259                .get_scan_config(self.0.request, self.0.options)
260                .await
261                .map(gax::response::Response::into_body)
262        }
263
264        /// Sets the value of [name][crate::model::GetScanConfigRequest::name].
265        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
266            self.0.request.name = v.into();
267            self
268        }
269    }
270
271    #[doc(hidden)]
272    impl gax::options::internal::RequestBuilder for GetScanConfig {
273        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
274            &mut self.0.options
275        }
276    }
277
278    /// The request builder for [WebSecurityScanner::list_scan_configs][crate::client::WebSecurityScanner::list_scan_configs] calls.
279    ///
280    /// # Example
281    /// ```
282    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::ListScanConfigs;
283    /// # async fn sample() -> gax::Result<()> {
284    /// use gax::paginator::ItemPaginator;
285    ///
286    /// let builder = prepare_request_builder();
287    /// let mut items = builder.by_item();
288    /// while let Some(result) = items.next().await {
289    ///   let item = result?;
290    /// }
291    /// # Ok(()) }
292    ///
293    /// fn prepare_request_builder() -> ListScanConfigs {
294    ///   # panic!();
295    ///   // ... details omitted ...
296    /// }
297    /// ```
298    #[derive(Clone, Debug)]
299    pub struct ListScanConfigs(RequestBuilder<crate::model::ListScanConfigsRequest>);
300
301    impl ListScanConfigs {
302        pub(crate) fn new(
303            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
304        ) -> Self {
305            Self(RequestBuilder::new(stub))
306        }
307
308        /// Sets the full request, replacing any prior values.
309        pub fn with_request<V: Into<crate::model::ListScanConfigsRequest>>(mut self, v: V) -> Self {
310            self.0.request = v.into();
311            self
312        }
313
314        /// Sets all the options, replacing any prior values.
315        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
316            self.0.options = v.into();
317            self
318        }
319
320        /// Sends the request.
321        pub async fn send(self) -> Result<crate::model::ListScanConfigsResponse> {
322            (*self.0.stub)
323                .list_scan_configs(self.0.request, self.0.options)
324                .await
325                .map(gax::response::Response::into_body)
326        }
327
328        /// Streams each page in the collection.
329        pub fn by_page(
330            self,
331        ) -> impl gax::paginator::Paginator<crate::model::ListScanConfigsResponse, gax::error::Error>
332        {
333            use std::clone::Clone;
334            let token = self.0.request.page_token.clone();
335            let execute = move |token: String| {
336                let mut builder = self.clone();
337                builder.0.request = builder.0.request.set_page_token(token);
338                builder.send()
339            };
340            gax::paginator::internal::new_paginator(token, execute)
341        }
342
343        /// Streams each item in the collection.
344        pub fn by_item(
345            self,
346        ) -> impl gax::paginator::ItemPaginator<crate::model::ListScanConfigsResponse, gax::error::Error>
347        {
348            use gax::paginator::Paginator;
349            self.by_page().items()
350        }
351
352        /// Sets the value of [parent][crate::model::ListScanConfigsRequest::parent].
353        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
354            self.0.request.parent = v.into();
355            self
356        }
357
358        /// Sets the value of [page_token][crate::model::ListScanConfigsRequest::page_token].
359        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
360            self.0.request.page_token = v.into();
361            self
362        }
363
364        /// Sets the value of [page_size][crate::model::ListScanConfigsRequest::page_size].
365        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
366            self.0.request.page_size = v.into();
367            self
368        }
369    }
370
371    #[doc(hidden)]
372    impl gax::options::internal::RequestBuilder for ListScanConfigs {
373        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
374            &mut self.0.options
375        }
376    }
377
378    /// The request builder for [WebSecurityScanner::update_scan_config][crate::client::WebSecurityScanner::update_scan_config] calls.
379    ///
380    /// # Example
381    /// ```
382    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::UpdateScanConfig;
383    /// # async fn sample() -> gax::Result<()> {
384    ///
385    /// let builder = prepare_request_builder();
386    /// let response = builder.send().await?;
387    /// # Ok(()) }
388    ///
389    /// fn prepare_request_builder() -> UpdateScanConfig {
390    ///   # panic!();
391    ///   // ... details omitted ...
392    /// }
393    /// ```
394    #[derive(Clone, Debug)]
395    pub struct UpdateScanConfig(RequestBuilder<crate::model::UpdateScanConfigRequest>);
396
397    impl UpdateScanConfig {
398        pub(crate) fn new(
399            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
400        ) -> Self {
401            Self(RequestBuilder::new(stub))
402        }
403
404        /// Sets the full request, replacing any prior values.
405        pub fn with_request<V: Into<crate::model::UpdateScanConfigRequest>>(
406            mut self,
407            v: V,
408        ) -> Self {
409            self.0.request = v.into();
410            self
411        }
412
413        /// Sets all the options, replacing any prior values.
414        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
415            self.0.options = v.into();
416            self
417        }
418
419        /// Sends the request.
420        pub async fn send(self) -> Result<crate::model::ScanConfig> {
421            (*self.0.stub)
422                .update_scan_config(self.0.request, self.0.options)
423                .await
424                .map(gax::response::Response::into_body)
425        }
426
427        /// Sets the value of [scan_config][crate::model::UpdateScanConfigRequest::scan_config].
428        pub fn set_scan_config<T>(mut self, v: T) -> Self
429        where
430            T: std::convert::Into<crate::model::ScanConfig>,
431        {
432            self.0.request.scan_config = std::option::Option::Some(v.into());
433            self
434        }
435
436        /// Sets or clears the value of [scan_config][crate::model::UpdateScanConfigRequest::scan_config].
437        pub fn set_or_clear_scan_config<T>(mut self, v: std::option::Option<T>) -> Self
438        where
439            T: std::convert::Into<crate::model::ScanConfig>,
440        {
441            self.0.request.scan_config = v.map(|x| x.into());
442            self
443        }
444
445        /// Sets the value of [update_mask][crate::model::UpdateScanConfigRequest::update_mask].
446        pub fn set_update_mask<T>(mut self, v: T) -> Self
447        where
448            T: std::convert::Into<wkt::FieldMask>,
449        {
450            self.0.request.update_mask = std::option::Option::Some(v.into());
451            self
452        }
453
454        /// Sets or clears the value of [update_mask][crate::model::UpdateScanConfigRequest::update_mask].
455        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
456        where
457            T: std::convert::Into<wkt::FieldMask>,
458        {
459            self.0.request.update_mask = v.map(|x| x.into());
460            self
461        }
462    }
463
464    #[doc(hidden)]
465    impl gax::options::internal::RequestBuilder for UpdateScanConfig {
466        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
467            &mut self.0.options
468        }
469    }
470
471    /// The request builder for [WebSecurityScanner::start_scan_run][crate::client::WebSecurityScanner::start_scan_run] calls.
472    ///
473    /// # Example
474    /// ```
475    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::StartScanRun;
476    /// # async fn sample() -> gax::Result<()> {
477    ///
478    /// let builder = prepare_request_builder();
479    /// let response = builder.send().await?;
480    /// # Ok(()) }
481    ///
482    /// fn prepare_request_builder() -> StartScanRun {
483    ///   # panic!();
484    ///   // ... details omitted ...
485    /// }
486    /// ```
487    #[derive(Clone, Debug)]
488    pub struct StartScanRun(RequestBuilder<crate::model::StartScanRunRequest>);
489
490    impl StartScanRun {
491        pub(crate) fn new(
492            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
493        ) -> Self {
494            Self(RequestBuilder::new(stub))
495        }
496
497        /// Sets the full request, replacing any prior values.
498        pub fn with_request<V: Into<crate::model::StartScanRunRequest>>(mut self, v: V) -> Self {
499            self.0.request = v.into();
500            self
501        }
502
503        /// Sets all the options, replacing any prior values.
504        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
505            self.0.options = v.into();
506            self
507        }
508
509        /// Sends the request.
510        pub async fn send(self) -> Result<crate::model::ScanRun> {
511            (*self.0.stub)
512                .start_scan_run(self.0.request, self.0.options)
513                .await
514                .map(gax::response::Response::into_body)
515        }
516
517        /// Sets the value of [name][crate::model::StartScanRunRequest::name].
518        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
519            self.0.request.name = v.into();
520            self
521        }
522    }
523
524    #[doc(hidden)]
525    impl gax::options::internal::RequestBuilder for StartScanRun {
526        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
527            &mut self.0.options
528        }
529    }
530
531    /// The request builder for [WebSecurityScanner::get_scan_run][crate::client::WebSecurityScanner::get_scan_run] calls.
532    ///
533    /// # Example
534    /// ```
535    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::GetScanRun;
536    /// # async fn sample() -> gax::Result<()> {
537    ///
538    /// let builder = prepare_request_builder();
539    /// let response = builder.send().await?;
540    /// # Ok(()) }
541    ///
542    /// fn prepare_request_builder() -> GetScanRun {
543    ///   # panic!();
544    ///   // ... details omitted ...
545    /// }
546    /// ```
547    #[derive(Clone, Debug)]
548    pub struct GetScanRun(RequestBuilder<crate::model::GetScanRunRequest>);
549
550    impl GetScanRun {
551        pub(crate) fn new(
552            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
553        ) -> Self {
554            Self(RequestBuilder::new(stub))
555        }
556
557        /// Sets the full request, replacing any prior values.
558        pub fn with_request<V: Into<crate::model::GetScanRunRequest>>(mut self, v: V) -> Self {
559            self.0.request = v.into();
560            self
561        }
562
563        /// Sets all the options, replacing any prior values.
564        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
565            self.0.options = v.into();
566            self
567        }
568
569        /// Sends the request.
570        pub async fn send(self) -> Result<crate::model::ScanRun> {
571            (*self.0.stub)
572                .get_scan_run(self.0.request, self.0.options)
573                .await
574                .map(gax::response::Response::into_body)
575        }
576
577        /// Sets the value of [name][crate::model::GetScanRunRequest::name].
578        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
579            self.0.request.name = v.into();
580            self
581        }
582    }
583
584    #[doc(hidden)]
585    impl gax::options::internal::RequestBuilder for GetScanRun {
586        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
587            &mut self.0.options
588        }
589    }
590
591    /// The request builder for [WebSecurityScanner::list_scan_runs][crate::client::WebSecurityScanner::list_scan_runs] calls.
592    ///
593    /// # Example
594    /// ```
595    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::ListScanRuns;
596    /// # async fn sample() -> gax::Result<()> {
597    /// use gax::paginator::ItemPaginator;
598    ///
599    /// let builder = prepare_request_builder();
600    /// let mut items = builder.by_item();
601    /// while let Some(result) = items.next().await {
602    ///   let item = result?;
603    /// }
604    /// # Ok(()) }
605    ///
606    /// fn prepare_request_builder() -> ListScanRuns {
607    ///   # panic!();
608    ///   // ... details omitted ...
609    /// }
610    /// ```
611    #[derive(Clone, Debug)]
612    pub struct ListScanRuns(RequestBuilder<crate::model::ListScanRunsRequest>);
613
614    impl ListScanRuns {
615        pub(crate) fn new(
616            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
617        ) -> Self {
618            Self(RequestBuilder::new(stub))
619        }
620
621        /// Sets the full request, replacing any prior values.
622        pub fn with_request<V: Into<crate::model::ListScanRunsRequest>>(mut self, v: V) -> Self {
623            self.0.request = v.into();
624            self
625        }
626
627        /// Sets all the options, replacing any prior values.
628        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
629            self.0.options = v.into();
630            self
631        }
632
633        /// Sends the request.
634        pub async fn send(self) -> Result<crate::model::ListScanRunsResponse> {
635            (*self.0.stub)
636                .list_scan_runs(self.0.request, self.0.options)
637                .await
638                .map(gax::response::Response::into_body)
639        }
640
641        /// Streams each page in the collection.
642        pub fn by_page(
643            self,
644        ) -> impl gax::paginator::Paginator<crate::model::ListScanRunsResponse, gax::error::Error>
645        {
646            use std::clone::Clone;
647            let token = self.0.request.page_token.clone();
648            let execute = move |token: String| {
649                let mut builder = self.clone();
650                builder.0.request = builder.0.request.set_page_token(token);
651                builder.send()
652            };
653            gax::paginator::internal::new_paginator(token, execute)
654        }
655
656        /// Streams each item in the collection.
657        pub fn by_item(
658            self,
659        ) -> impl gax::paginator::ItemPaginator<crate::model::ListScanRunsResponse, gax::error::Error>
660        {
661            use gax::paginator::Paginator;
662            self.by_page().items()
663        }
664
665        /// Sets the value of [parent][crate::model::ListScanRunsRequest::parent].
666        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
667            self.0.request.parent = v.into();
668            self
669        }
670
671        /// Sets the value of [page_token][crate::model::ListScanRunsRequest::page_token].
672        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
673            self.0.request.page_token = v.into();
674            self
675        }
676
677        /// Sets the value of [page_size][crate::model::ListScanRunsRequest::page_size].
678        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
679            self.0.request.page_size = v.into();
680            self
681        }
682    }
683
684    #[doc(hidden)]
685    impl gax::options::internal::RequestBuilder for ListScanRuns {
686        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
687            &mut self.0.options
688        }
689    }
690
691    /// The request builder for [WebSecurityScanner::stop_scan_run][crate::client::WebSecurityScanner::stop_scan_run] calls.
692    ///
693    /// # Example
694    /// ```
695    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::StopScanRun;
696    /// # async fn sample() -> gax::Result<()> {
697    ///
698    /// let builder = prepare_request_builder();
699    /// let response = builder.send().await?;
700    /// # Ok(()) }
701    ///
702    /// fn prepare_request_builder() -> StopScanRun {
703    ///   # panic!();
704    ///   // ... details omitted ...
705    /// }
706    /// ```
707    #[derive(Clone, Debug)]
708    pub struct StopScanRun(RequestBuilder<crate::model::StopScanRunRequest>);
709
710    impl StopScanRun {
711        pub(crate) fn new(
712            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
713        ) -> Self {
714            Self(RequestBuilder::new(stub))
715        }
716
717        /// Sets the full request, replacing any prior values.
718        pub fn with_request<V: Into<crate::model::StopScanRunRequest>>(mut self, v: V) -> Self {
719            self.0.request = v.into();
720            self
721        }
722
723        /// Sets all the options, replacing any prior values.
724        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
725            self.0.options = v.into();
726            self
727        }
728
729        /// Sends the request.
730        pub async fn send(self) -> Result<crate::model::ScanRun> {
731            (*self.0.stub)
732                .stop_scan_run(self.0.request, self.0.options)
733                .await
734                .map(gax::response::Response::into_body)
735        }
736
737        /// Sets the value of [name][crate::model::StopScanRunRequest::name].
738        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
739            self.0.request.name = v.into();
740            self
741        }
742    }
743
744    #[doc(hidden)]
745    impl gax::options::internal::RequestBuilder for StopScanRun {
746        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
747            &mut self.0.options
748        }
749    }
750
751    /// The request builder for [WebSecurityScanner::list_crawled_urls][crate::client::WebSecurityScanner::list_crawled_urls] calls.
752    ///
753    /// # Example
754    /// ```
755    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::ListCrawledUrls;
756    /// # async fn sample() -> gax::Result<()> {
757    /// use gax::paginator::ItemPaginator;
758    ///
759    /// let builder = prepare_request_builder();
760    /// let mut items = builder.by_item();
761    /// while let Some(result) = items.next().await {
762    ///   let item = result?;
763    /// }
764    /// # Ok(()) }
765    ///
766    /// fn prepare_request_builder() -> ListCrawledUrls {
767    ///   # panic!();
768    ///   // ... details omitted ...
769    /// }
770    /// ```
771    #[derive(Clone, Debug)]
772    pub struct ListCrawledUrls(RequestBuilder<crate::model::ListCrawledUrlsRequest>);
773
774    impl ListCrawledUrls {
775        pub(crate) fn new(
776            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
777        ) -> Self {
778            Self(RequestBuilder::new(stub))
779        }
780
781        /// Sets the full request, replacing any prior values.
782        pub fn with_request<V: Into<crate::model::ListCrawledUrlsRequest>>(mut self, v: V) -> Self {
783            self.0.request = v.into();
784            self
785        }
786
787        /// Sets all the options, replacing any prior values.
788        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
789            self.0.options = v.into();
790            self
791        }
792
793        /// Sends the request.
794        pub async fn send(self) -> Result<crate::model::ListCrawledUrlsResponse> {
795            (*self.0.stub)
796                .list_crawled_urls(self.0.request, self.0.options)
797                .await
798                .map(gax::response::Response::into_body)
799        }
800
801        /// Streams each page in the collection.
802        pub fn by_page(
803            self,
804        ) -> impl gax::paginator::Paginator<crate::model::ListCrawledUrlsResponse, gax::error::Error>
805        {
806            use std::clone::Clone;
807            let token = self.0.request.page_token.clone();
808            let execute = move |token: String| {
809                let mut builder = self.clone();
810                builder.0.request = builder.0.request.set_page_token(token);
811                builder.send()
812            };
813            gax::paginator::internal::new_paginator(token, execute)
814        }
815
816        /// Streams each item in the collection.
817        pub fn by_item(
818            self,
819        ) -> impl gax::paginator::ItemPaginator<crate::model::ListCrawledUrlsResponse, gax::error::Error>
820        {
821            use gax::paginator::Paginator;
822            self.by_page().items()
823        }
824
825        /// Sets the value of [parent][crate::model::ListCrawledUrlsRequest::parent].
826        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
827            self.0.request.parent = v.into();
828            self
829        }
830
831        /// Sets the value of [page_token][crate::model::ListCrawledUrlsRequest::page_token].
832        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
833            self.0.request.page_token = v.into();
834            self
835        }
836
837        /// Sets the value of [page_size][crate::model::ListCrawledUrlsRequest::page_size].
838        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
839            self.0.request.page_size = v.into();
840            self
841        }
842    }
843
844    #[doc(hidden)]
845    impl gax::options::internal::RequestBuilder for ListCrawledUrls {
846        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
847            &mut self.0.options
848        }
849    }
850
851    /// The request builder for [WebSecurityScanner::get_finding][crate::client::WebSecurityScanner::get_finding] calls.
852    ///
853    /// # Example
854    /// ```
855    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::GetFinding;
856    /// # async fn sample() -> gax::Result<()> {
857    ///
858    /// let builder = prepare_request_builder();
859    /// let response = builder.send().await?;
860    /// # Ok(()) }
861    ///
862    /// fn prepare_request_builder() -> GetFinding {
863    ///   # panic!();
864    ///   // ... details omitted ...
865    /// }
866    /// ```
867    #[derive(Clone, Debug)]
868    pub struct GetFinding(RequestBuilder<crate::model::GetFindingRequest>);
869
870    impl GetFinding {
871        pub(crate) fn new(
872            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
873        ) -> Self {
874            Self(RequestBuilder::new(stub))
875        }
876
877        /// Sets the full request, replacing any prior values.
878        pub fn with_request<V: Into<crate::model::GetFindingRequest>>(mut self, v: V) -> Self {
879            self.0.request = v.into();
880            self
881        }
882
883        /// Sets all the options, replacing any prior values.
884        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
885            self.0.options = v.into();
886            self
887        }
888
889        /// Sends the request.
890        pub async fn send(self) -> Result<crate::model::Finding> {
891            (*self.0.stub)
892                .get_finding(self.0.request, self.0.options)
893                .await
894                .map(gax::response::Response::into_body)
895        }
896
897        /// Sets the value of [name][crate::model::GetFindingRequest::name].
898        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
899            self.0.request.name = v.into();
900            self
901        }
902    }
903
904    #[doc(hidden)]
905    impl gax::options::internal::RequestBuilder for GetFinding {
906        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
907            &mut self.0.options
908        }
909    }
910
911    /// The request builder for [WebSecurityScanner::list_findings][crate::client::WebSecurityScanner::list_findings] calls.
912    ///
913    /// # Example
914    /// ```
915    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::ListFindings;
916    /// # async fn sample() -> gax::Result<()> {
917    /// use gax::paginator::ItemPaginator;
918    ///
919    /// let builder = prepare_request_builder();
920    /// let mut items = builder.by_item();
921    /// while let Some(result) = items.next().await {
922    ///   let item = result?;
923    /// }
924    /// # Ok(()) }
925    ///
926    /// fn prepare_request_builder() -> ListFindings {
927    ///   # panic!();
928    ///   // ... details omitted ...
929    /// }
930    /// ```
931    #[derive(Clone, Debug)]
932    pub struct ListFindings(RequestBuilder<crate::model::ListFindingsRequest>);
933
934    impl ListFindings {
935        pub(crate) fn new(
936            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
937        ) -> Self {
938            Self(RequestBuilder::new(stub))
939        }
940
941        /// Sets the full request, replacing any prior values.
942        pub fn with_request<V: Into<crate::model::ListFindingsRequest>>(mut self, v: V) -> Self {
943            self.0.request = v.into();
944            self
945        }
946
947        /// Sets all the options, replacing any prior values.
948        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
949            self.0.options = v.into();
950            self
951        }
952
953        /// Sends the request.
954        pub async fn send(self) -> Result<crate::model::ListFindingsResponse> {
955            (*self.0.stub)
956                .list_findings(self.0.request, self.0.options)
957                .await
958                .map(gax::response::Response::into_body)
959        }
960
961        /// Streams each page in the collection.
962        pub fn by_page(
963            self,
964        ) -> impl gax::paginator::Paginator<crate::model::ListFindingsResponse, gax::error::Error>
965        {
966            use std::clone::Clone;
967            let token = self.0.request.page_token.clone();
968            let execute = move |token: String| {
969                let mut builder = self.clone();
970                builder.0.request = builder.0.request.set_page_token(token);
971                builder.send()
972            };
973            gax::paginator::internal::new_paginator(token, execute)
974        }
975
976        /// Streams each item in the collection.
977        pub fn by_item(
978            self,
979        ) -> impl gax::paginator::ItemPaginator<crate::model::ListFindingsResponse, gax::error::Error>
980        {
981            use gax::paginator::Paginator;
982            self.by_page().items()
983        }
984
985        /// Sets the value of [parent][crate::model::ListFindingsRequest::parent].
986        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
987            self.0.request.parent = v.into();
988            self
989        }
990
991        /// Sets the value of [filter][crate::model::ListFindingsRequest::filter].
992        pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
993            self.0.request.filter = v.into();
994            self
995        }
996
997        /// Sets the value of [page_token][crate::model::ListFindingsRequest::page_token].
998        pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
999            self.0.request.page_token = v.into();
1000            self
1001        }
1002
1003        /// Sets the value of [page_size][crate::model::ListFindingsRequest::page_size].
1004        pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1005            self.0.request.page_size = v.into();
1006            self
1007        }
1008    }
1009
1010    #[doc(hidden)]
1011    impl gax::options::internal::RequestBuilder for ListFindings {
1012        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1013            &mut self.0.options
1014        }
1015    }
1016
1017    /// The request builder for [WebSecurityScanner::list_finding_type_stats][crate::client::WebSecurityScanner::list_finding_type_stats] calls.
1018    ///
1019    /// # Example
1020    /// ```
1021    /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::ListFindingTypeStats;
1022    /// # async fn sample() -> gax::Result<()> {
1023    ///
1024    /// let builder = prepare_request_builder();
1025    /// let response = builder.send().await?;
1026    /// # Ok(()) }
1027    ///
1028    /// fn prepare_request_builder() -> ListFindingTypeStats {
1029    ///   # panic!();
1030    ///   // ... details omitted ...
1031    /// }
1032    /// ```
1033    #[derive(Clone, Debug)]
1034    pub struct ListFindingTypeStats(RequestBuilder<crate::model::ListFindingTypeStatsRequest>);
1035
1036    impl ListFindingTypeStats {
1037        pub(crate) fn new(
1038            stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
1039        ) -> Self {
1040            Self(RequestBuilder::new(stub))
1041        }
1042
1043        /// Sets the full request, replacing any prior values.
1044        pub fn with_request<V: Into<crate::model::ListFindingTypeStatsRequest>>(
1045            mut self,
1046            v: V,
1047        ) -> Self {
1048            self.0.request = v.into();
1049            self
1050        }
1051
1052        /// Sets all the options, replacing any prior values.
1053        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1054            self.0.options = v.into();
1055            self
1056        }
1057
1058        /// Sends the request.
1059        pub async fn send(self) -> Result<crate::model::ListFindingTypeStatsResponse> {
1060            (*self.0.stub)
1061                .list_finding_type_stats(self.0.request, self.0.options)
1062                .await
1063                .map(gax::response::Response::into_body)
1064        }
1065
1066        /// Sets the value of [parent][crate::model::ListFindingTypeStatsRequest::parent].
1067        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1068            self.0.request.parent = v.into();
1069            self
1070        }
1071    }
1072
1073    #[doc(hidden)]
1074    impl gax::options::internal::RequestBuilder for ListFindingTypeStats {
1075        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1076            &mut self.0.options
1077        }
1078    }
1079}