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