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