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
17/// Request and client builders for [WebSecurityScanner][crate::client::WebSecurityScanner].
18pub mod web_security_scanner {
19 use crate::Result;
20
21 /// A builder for [WebSecurityScanner][crate::client::WebSecurityScanner].
22 ///
23 /// ```
24 /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
25 /// # use google_cloud_websecurityscanner_v1::*;
26 /// # use builder::web_security_scanner::ClientBuilder;
27 /// # use client::WebSecurityScanner;
28 /// let builder : ClientBuilder = WebSecurityScanner::builder();
29 /// let client = builder
30 /// .with_endpoint("https://websecurityscanner.googleapis.com")
31 /// .build().await?;
32 /// # Ok(()) }
33 /// ```
34 pub type ClientBuilder = crate::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 crate::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 ) -> crate::ClientBuilderResult<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: crate::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: crate::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() -> google_cloud_websecurityscanner_v1::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<crate::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(crate::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 crate::RequestBuilder for CreateScanConfig {
150 fn request_options(&mut self) -> &mut crate::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() -> google_cloud_websecurityscanner_v1::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<crate::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(crate::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 crate::RequestBuilder for DeleteScanConfig {
213 fn request_options(&mut self) -> &mut crate::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() -> google_cloud_websecurityscanner_v1::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<crate::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(crate::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 crate::RequestBuilder for GetScanConfig {
273 fn request_options(&mut self) -> &mut crate::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() -> google_cloud_websecurityscanner_v1::Result<()> {
284 /// use google_cloud_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<crate::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(crate::Response::into_body)
326 }
327
328 /// Streams each page in the collection.
329 pub fn by_page(
330 self,
331 ) -> impl google_cloud_gax::paginator::Paginator<
332 crate::model::ListScanConfigsResponse,
333 crate::Error,
334 > {
335 use std::clone::Clone;
336 let token = self.0.request.page_token.clone();
337 let execute = move |token: String| {
338 let mut builder = self.clone();
339 builder.0.request = builder.0.request.set_page_token(token);
340 builder.send()
341 };
342 google_cloud_gax::paginator::internal::new_paginator(token, execute)
343 }
344
345 /// Streams each item in the collection.
346 pub fn by_item(
347 self,
348 ) -> impl google_cloud_gax::paginator::ItemPaginator<
349 crate::model::ListScanConfigsResponse,
350 crate::Error,
351 > {
352 use google_cloud_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 crate::RequestBuilder for ListScanConfigs {
377 fn request_options(&mut self) -> &mut crate::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 /// ```
386 /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::UpdateScanConfig;
387 /// # async fn sample() -> google_cloud_websecurityscanner_v1::Result<()> {
388 ///
389 /// let builder = prepare_request_builder();
390 /// let response = builder.send().await?;
391 /// # Ok(()) }
392 ///
393 /// fn prepare_request_builder() -> UpdateScanConfig {
394 /// # panic!();
395 /// // ... details omitted ...
396 /// }
397 /// ```
398 #[derive(Clone, Debug)]
399 pub struct UpdateScanConfig(RequestBuilder<crate::model::UpdateScanConfigRequest>);
400
401 impl UpdateScanConfig {
402 pub(crate) fn new(
403 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
404 ) -> Self {
405 Self(RequestBuilder::new(stub))
406 }
407
408 /// Sets the full request, replacing any prior values.
409 pub fn with_request<V: Into<crate::model::UpdateScanConfigRequest>>(
410 mut self,
411 v: V,
412 ) -> Self {
413 self.0.request = v.into();
414 self
415 }
416
417 /// Sets all the options, replacing any prior values.
418 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
419 self.0.options = v.into();
420 self
421 }
422
423 /// Sends the request.
424 pub async fn send(self) -> Result<crate::model::ScanConfig> {
425 (*self.0.stub)
426 .update_scan_config(self.0.request, self.0.options)
427 .await
428 .map(crate::Response::into_body)
429 }
430
431 /// Sets the value of [scan_config][crate::model::UpdateScanConfigRequest::scan_config].
432 pub fn set_scan_config<T>(mut self, v: T) -> Self
433 where
434 T: std::convert::Into<crate::model::ScanConfig>,
435 {
436 self.0.request.scan_config = std::option::Option::Some(v.into());
437 self
438 }
439
440 /// Sets or clears the value of [scan_config][crate::model::UpdateScanConfigRequest::scan_config].
441 pub fn set_or_clear_scan_config<T>(mut self, v: std::option::Option<T>) -> Self
442 where
443 T: std::convert::Into<crate::model::ScanConfig>,
444 {
445 self.0.request.scan_config = v.map(|x| x.into());
446 self
447 }
448
449 /// Sets the value of [update_mask][crate::model::UpdateScanConfigRequest::update_mask].
450 pub fn set_update_mask<T>(mut self, v: T) -> Self
451 where
452 T: std::convert::Into<wkt::FieldMask>,
453 {
454 self.0.request.update_mask = std::option::Option::Some(v.into());
455 self
456 }
457
458 /// Sets or clears the value of [update_mask][crate::model::UpdateScanConfigRequest::update_mask].
459 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
460 where
461 T: std::convert::Into<wkt::FieldMask>,
462 {
463 self.0.request.update_mask = v.map(|x| x.into());
464 self
465 }
466 }
467
468 #[doc(hidden)]
469 impl crate::RequestBuilder for UpdateScanConfig {
470 fn request_options(&mut self) -> &mut crate::RequestOptions {
471 &mut self.0.options
472 }
473 }
474
475 /// The request builder for [WebSecurityScanner::start_scan_run][crate::client::WebSecurityScanner::start_scan_run] calls.
476 ///
477 /// # Example
478 /// ```
479 /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::StartScanRun;
480 /// # async fn sample() -> google_cloud_websecurityscanner_v1::Result<()> {
481 ///
482 /// let builder = prepare_request_builder();
483 /// let response = builder.send().await?;
484 /// # Ok(()) }
485 ///
486 /// fn prepare_request_builder() -> StartScanRun {
487 /// # panic!();
488 /// // ... details omitted ...
489 /// }
490 /// ```
491 #[derive(Clone, Debug)]
492 pub struct StartScanRun(RequestBuilder<crate::model::StartScanRunRequest>);
493
494 impl StartScanRun {
495 pub(crate) fn new(
496 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
497 ) -> Self {
498 Self(RequestBuilder::new(stub))
499 }
500
501 /// Sets the full request, replacing any prior values.
502 pub fn with_request<V: Into<crate::model::StartScanRunRequest>>(mut self, v: V) -> Self {
503 self.0.request = v.into();
504 self
505 }
506
507 /// Sets all the options, replacing any prior values.
508 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
509 self.0.options = v.into();
510 self
511 }
512
513 /// Sends the request.
514 pub async fn send(self) -> Result<crate::model::ScanRun> {
515 (*self.0.stub)
516 .start_scan_run(self.0.request, self.0.options)
517 .await
518 .map(crate::Response::into_body)
519 }
520
521 /// Sets the value of [name][crate::model::StartScanRunRequest::name].
522 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
523 self.0.request.name = v.into();
524 self
525 }
526 }
527
528 #[doc(hidden)]
529 impl crate::RequestBuilder for StartScanRun {
530 fn request_options(&mut self) -> &mut crate::RequestOptions {
531 &mut self.0.options
532 }
533 }
534
535 /// The request builder for [WebSecurityScanner::get_scan_run][crate::client::WebSecurityScanner::get_scan_run] calls.
536 ///
537 /// # Example
538 /// ```
539 /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::GetScanRun;
540 /// # async fn sample() -> google_cloud_websecurityscanner_v1::Result<()> {
541 ///
542 /// let builder = prepare_request_builder();
543 /// let response = builder.send().await?;
544 /// # Ok(()) }
545 ///
546 /// fn prepare_request_builder() -> GetScanRun {
547 /// # panic!();
548 /// // ... details omitted ...
549 /// }
550 /// ```
551 #[derive(Clone, Debug)]
552 pub struct GetScanRun(RequestBuilder<crate::model::GetScanRunRequest>);
553
554 impl GetScanRun {
555 pub(crate) fn new(
556 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
557 ) -> Self {
558 Self(RequestBuilder::new(stub))
559 }
560
561 /// Sets the full request, replacing any prior values.
562 pub fn with_request<V: Into<crate::model::GetScanRunRequest>>(mut self, v: V) -> Self {
563 self.0.request = v.into();
564 self
565 }
566
567 /// Sets all the options, replacing any prior values.
568 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
569 self.0.options = v.into();
570 self
571 }
572
573 /// Sends the request.
574 pub async fn send(self) -> Result<crate::model::ScanRun> {
575 (*self.0.stub)
576 .get_scan_run(self.0.request, self.0.options)
577 .await
578 .map(crate::Response::into_body)
579 }
580
581 /// Sets the value of [name][crate::model::GetScanRunRequest::name].
582 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
583 self.0.request.name = v.into();
584 self
585 }
586 }
587
588 #[doc(hidden)]
589 impl crate::RequestBuilder for GetScanRun {
590 fn request_options(&mut self) -> &mut crate::RequestOptions {
591 &mut self.0.options
592 }
593 }
594
595 /// The request builder for [WebSecurityScanner::list_scan_runs][crate::client::WebSecurityScanner::list_scan_runs] calls.
596 ///
597 /// # Example
598 /// ```
599 /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::ListScanRuns;
600 /// # async fn sample() -> google_cloud_websecurityscanner_v1::Result<()> {
601 /// use google_cloud_gax::paginator::ItemPaginator;
602 ///
603 /// let builder = prepare_request_builder();
604 /// let mut items = builder.by_item();
605 /// while let Some(result) = items.next().await {
606 /// let item = result?;
607 /// }
608 /// # Ok(()) }
609 ///
610 /// fn prepare_request_builder() -> ListScanRuns {
611 /// # panic!();
612 /// // ... details omitted ...
613 /// }
614 /// ```
615 #[derive(Clone, Debug)]
616 pub struct ListScanRuns(RequestBuilder<crate::model::ListScanRunsRequest>);
617
618 impl ListScanRuns {
619 pub(crate) fn new(
620 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
621 ) -> Self {
622 Self(RequestBuilder::new(stub))
623 }
624
625 /// Sets the full request, replacing any prior values.
626 pub fn with_request<V: Into<crate::model::ListScanRunsRequest>>(mut self, v: V) -> Self {
627 self.0.request = v.into();
628 self
629 }
630
631 /// Sets all the options, replacing any prior values.
632 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
633 self.0.options = v.into();
634 self
635 }
636
637 /// Sends the request.
638 pub async fn send(self) -> Result<crate::model::ListScanRunsResponse> {
639 (*self.0.stub)
640 .list_scan_runs(self.0.request, self.0.options)
641 .await
642 .map(crate::Response::into_body)
643 }
644
645 /// Streams each page in the collection.
646 pub fn by_page(
647 self,
648 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListScanRunsResponse, crate::Error>
649 {
650 use std::clone::Clone;
651 let token = self.0.request.page_token.clone();
652 let execute = move |token: String| {
653 let mut builder = self.clone();
654 builder.0.request = builder.0.request.set_page_token(token);
655 builder.send()
656 };
657 google_cloud_gax::paginator::internal::new_paginator(token, execute)
658 }
659
660 /// Streams each item in the collection.
661 pub fn by_item(
662 self,
663 ) -> impl google_cloud_gax::paginator::ItemPaginator<
664 crate::model::ListScanRunsResponse,
665 crate::Error,
666 > {
667 use google_cloud_gax::paginator::Paginator;
668 self.by_page().items()
669 }
670
671 /// Sets the value of [parent][crate::model::ListScanRunsRequest::parent].
672 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
673 self.0.request.parent = v.into();
674 self
675 }
676
677 /// Sets the value of [page_token][crate::model::ListScanRunsRequest::page_token].
678 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
679 self.0.request.page_token = v.into();
680 self
681 }
682
683 /// Sets the value of [page_size][crate::model::ListScanRunsRequest::page_size].
684 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
685 self.0.request.page_size = v.into();
686 self
687 }
688 }
689
690 #[doc(hidden)]
691 impl crate::RequestBuilder for ListScanRuns {
692 fn request_options(&mut self) -> &mut crate::RequestOptions {
693 &mut self.0.options
694 }
695 }
696
697 /// The request builder for [WebSecurityScanner::stop_scan_run][crate::client::WebSecurityScanner::stop_scan_run] calls.
698 ///
699 /// # Example
700 /// ```
701 /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::StopScanRun;
702 /// # async fn sample() -> google_cloud_websecurityscanner_v1::Result<()> {
703 ///
704 /// let builder = prepare_request_builder();
705 /// let response = builder.send().await?;
706 /// # Ok(()) }
707 ///
708 /// fn prepare_request_builder() -> StopScanRun {
709 /// # panic!();
710 /// // ... details omitted ...
711 /// }
712 /// ```
713 #[derive(Clone, Debug)]
714 pub struct StopScanRun(RequestBuilder<crate::model::StopScanRunRequest>);
715
716 impl StopScanRun {
717 pub(crate) fn new(
718 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
719 ) -> Self {
720 Self(RequestBuilder::new(stub))
721 }
722
723 /// Sets the full request, replacing any prior values.
724 pub fn with_request<V: Into<crate::model::StopScanRunRequest>>(mut self, v: V) -> Self {
725 self.0.request = v.into();
726 self
727 }
728
729 /// Sets all the options, replacing any prior values.
730 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
731 self.0.options = v.into();
732 self
733 }
734
735 /// Sends the request.
736 pub async fn send(self) -> Result<crate::model::ScanRun> {
737 (*self.0.stub)
738 .stop_scan_run(self.0.request, self.0.options)
739 .await
740 .map(crate::Response::into_body)
741 }
742
743 /// Sets the value of [name][crate::model::StopScanRunRequest::name].
744 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
745 self.0.request.name = v.into();
746 self
747 }
748 }
749
750 #[doc(hidden)]
751 impl crate::RequestBuilder for StopScanRun {
752 fn request_options(&mut self) -> &mut crate::RequestOptions {
753 &mut self.0.options
754 }
755 }
756
757 /// The request builder for [WebSecurityScanner::list_crawled_urls][crate::client::WebSecurityScanner::list_crawled_urls] calls.
758 ///
759 /// # Example
760 /// ```
761 /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::ListCrawledUrls;
762 /// # async fn sample() -> google_cloud_websecurityscanner_v1::Result<()> {
763 /// use google_cloud_gax::paginator::ItemPaginator;
764 ///
765 /// let builder = prepare_request_builder();
766 /// let mut items = builder.by_item();
767 /// while let Some(result) = items.next().await {
768 /// let item = result?;
769 /// }
770 /// # Ok(()) }
771 ///
772 /// fn prepare_request_builder() -> ListCrawledUrls {
773 /// # panic!();
774 /// // ... details omitted ...
775 /// }
776 /// ```
777 #[derive(Clone, Debug)]
778 pub struct ListCrawledUrls(RequestBuilder<crate::model::ListCrawledUrlsRequest>);
779
780 impl ListCrawledUrls {
781 pub(crate) fn new(
782 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
783 ) -> Self {
784 Self(RequestBuilder::new(stub))
785 }
786
787 /// Sets the full request, replacing any prior values.
788 pub fn with_request<V: Into<crate::model::ListCrawledUrlsRequest>>(mut self, v: V) -> Self {
789 self.0.request = v.into();
790 self
791 }
792
793 /// Sets all the options, replacing any prior values.
794 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
795 self.0.options = v.into();
796 self
797 }
798
799 /// Sends the request.
800 pub async fn send(self) -> Result<crate::model::ListCrawledUrlsResponse> {
801 (*self.0.stub)
802 .list_crawled_urls(self.0.request, self.0.options)
803 .await
804 .map(crate::Response::into_body)
805 }
806
807 /// Streams each page in the collection.
808 pub fn by_page(
809 self,
810 ) -> impl google_cloud_gax::paginator::Paginator<
811 crate::model::ListCrawledUrlsResponse,
812 crate::Error,
813 > {
814 use std::clone::Clone;
815 let token = self.0.request.page_token.clone();
816 let execute = move |token: String| {
817 let mut builder = self.clone();
818 builder.0.request = builder.0.request.set_page_token(token);
819 builder.send()
820 };
821 google_cloud_gax::paginator::internal::new_paginator(token, execute)
822 }
823
824 /// Streams each item in the collection.
825 pub fn by_item(
826 self,
827 ) -> impl google_cloud_gax::paginator::ItemPaginator<
828 crate::model::ListCrawledUrlsResponse,
829 crate::Error,
830 > {
831 use google_cloud_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 crate::RequestBuilder for ListCrawledUrls {
856 fn request_options(&mut self) -> &mut crate::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 /// ```
865 /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::GetFinding;
866 /// # async fn sample() -> google_cloud_websecurityscanner_v1::Result<()> {
867 ///
868 /// let builder = prepare_request_builder();
869 /// let response = builder.send().await?;
870 /// # Ok(()) }
871 ///
872 /// fn prepare_request_builder() -> GetFinding {
873 /// # panic!();
874 /// // ... details omitted ...
875 /// }
876 /// ```
877 #[derive(Clone, Debug)]
878 pub struct GetFinding(RequestBuilder<crate::model::GetFindingRequest>);
879
880 impl GetFinding {
881 pub(crate) fn new(
882 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
883 ) -> Self {
884 Self(RequestBuilder::new(stub))
885 }
886
887 /// Sets the full request, replacing any prior values.
888 pub fn with_request<V: Into<crate::model::GetFindingRequest>>(mut self, v: V) -> Self {
889 self.0.request = v.into();
890 self
891 }
892
893 /// Sets all the options, replacing any prior values.
894 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
895 self.0.options = v.into();
896 self
897 }
898
899 /// Sends the request.
900 pub async fn send(self) -> Result<crate::model::Finding> {
901 (*self.0.stub)
902 .get_finding(self.0.request, self.0.options)
903 .await
904 .map(crate::Response::into_body)
905 }
906
907 /// Sets the value of [name][crate::model::GetFindingRequest::name].
908 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
909 self.0.request.name = v.into();
910 self
911 }
912 }
913
914 #[doc(hidden)]
915 impl crate::RequestBuilder for GetFinding {
916 fn request_options(&mut self) -> &mut crate::RequestOptions {
917 &mut self.0.options
918 }
919 }
920
921 /// The request builder for [WebSecurityScanner::list_findings][crate::client::WebSecurityScanner::list_findings] calls.
922 ///
923 /// # Example
924 /// ```
925 /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::ListFindings;
926 /// # async fn sample() -> google_cloud_websecurityscanner_v1::Result<()> {
927 /// use google_cloud_gax::paginator::ItemPaginator;
928 ///
929 /// let builder = prepare_request_builder();
930 /// let mut items = builder.by_item();
931 /// while let Some(result) = items.next().await {
932 /// let item = result?;
933 /// }
934 /// # Ok(()) }
935 ///
936 /// fn prepare_request_builder() -> ListFindings {
937 /// # panic!();
938 /// // ... details omitted ...
939 /// }
940 /// ```
941 #[derive(Clone, Debug)]
942 pub struct ListFindings(RequestBuilder<crate::model::ListFindingsRequest>);
943
944 impl ListFindings {
945 pub(crate) fn new(
946 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
947 ) -> Self {
948 Self(RequestBuilder::new(stub))
949 }
950
951 /// Sets the full request, replacing any prior values.
952 pub fn with_request<V: Into<crate::model::ListFindingsRequest>>(mut self, v: V) -> Self {
953 self.0.request = v.into();
954 self
955 }
956
957 /// Sets all the options, replacing any prior values.
958 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
959 self.0.options = v.into();
960 self
961 }
962
963 /// Sends the request.
964 pub async fn send(self) -> Result<crate::model::ListFindingsResponse> {
965 (*self.0.stub)
966 .list_findings(self.0.request, self.0.options)
967 .await
968 .map(crate::Response::into_body)
969 }
970
971 /// Streams each page in the collection.
972 pub fn by_page(
973 self,
974 ) -> impl google_cloud_gax::paginator::Paginator<crate::model::ListFindingsResponse, crate::Error>
975 {
976 use std::clone::Clone;
977 let token = self.0.request.page_token.clone();
978 let execute = move |token: String| {
979 let mut builder = self.clone();
980 builder.0.request = builder.0.request.set_page_token(token);
981 builder.send()
982 };
983 google_cloud_gax::paginator::internal::new_paginator(token, execute)
984 }
985
986 /// Streams each item in the collection.
987 pub fn by_item(
988 self,
989 ) -> impl google_cloud_gax::paginator::ItemPaginator<
990 crate::model::ListFindingsResponse,
991 crate::Error,
992 > {
993 use google_cloud_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 crate::RequestBuilder for ListFindings {
1024 fn request_options(&mut self) -> &mut crate::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 /// ```
1033 /// # use google_cloud_websecurityscanner_v1::builder::web_security_scanner::ListFindingTypeStats;
1034 /// # async fn sample() -> google_cloud_websecurityscanner_v1::Result<()> {
1035 ///
1036 /// let builder = prepare_request_builder();
1037 /// let response = builder.send().await?;
1038 /// # Ok(()) }
1039 ///
1040 /// fn prepare_request_builder() -> ListFindingTypeStats {
1041 /// # panic!();
1042 /// // ... details omitted ...
1043 /// }
1044 /// ```
1045 #[derive(Clone, Debug)]
1046 pub struct ListFindingTypeStats(RequestBuilder<crate::model::ListFindingTypeStatsRequest>);
1047
1048 impl ListFindingTypeStats {
1049 pub(crate) fn new(
1050 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
1051 ) -> Self {
1052 Self(RequestBuilder::new(stub))
1053 }
1054
1055 /// Sets the full request, replacing any prior values.
1056 pub fn with_request<V: Into<crate::model::ListFindingTypeStatsRequest>>(
1057 mut self,
1058 v: V,
1059 ) -> Self {
1060 self.0.request = v.into();
1061 self
1062 }
1063
1064 /// Sets all the options, replacing any prior values.
1065 pub fn with_options<V: Into<crate::RequestOptions>>(mut self, v: V) -> Self {
1066 self.0.options = v.into();
1067 self
1068 }
1069
1070 /// Sends the request.
1071 pub async fn send(self) -> Result<crate::model::ListFindingTypeStatsResponse> {
1072 (*self.0.stub)
1073 .list_finding_type_stats(self.0.request, self.0.options)
1074 .await
1075 .map(crate::Response::into_body)
1076 }
1077
1078 /// Sets the value of [parent][crate::model::ListFindingTypeStatsRequest::parent].
1079 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1080 self.0.request.parent = v.into();
1081 self
1082 }
1083 }
1084
1085 #[doc(hidden)]
1086 impl crate::RequestBuilder for ListFindingTypeStats {
1087 fn request_options(&mut self) -> &mut crate::RequestOptions {
1088 &mut self.0.options
1089 }
1090 }
1091}