google_cloud_websecurityscanner_v1/
builder.rs1pub mod web_security_scanner {
18 use crate::Result;
19
20 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 #[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 #[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 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 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
111 self.0.options = v.into();
112 self
113 }
114
115 pub async fn send(self) -> Result<crate::model::ScanConfig> {
117 (*self.0.stub)
118 .create_scan_config(self.0.request, self.0.options)
119 .await
120 .map(gax::response::Response::into_body)
121 }
122
123 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 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 pub fn set_or_clear_scan_config<T>(mut self, v: std::option::Option<T>) -> Self
140 where
141 T: std::convert::Into<crate::model::ScanConfig>,
142 {
143 self.0.request.scan_config = v.map(|x| x.into());
144 self
145 }
146 }
147
148 #[doc(hidden)]
149 impl gax::options::internal::RequestBuilder for CreateScanConfig {
150 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
151 &mut self.0.options
152 }
153 }
154
155 #[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 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 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
192 self.0.options = v.into();
193 self
194 }
195
196 pub async fn send(self) -> Result<()> {
198 (*self.0.stub)
199 .delete_scan_config(self.0.request, self.0.options)
200 .await
201 .map(gax::response::Response::into_body)
202 }
203
204 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
206 self.0.request.name = v.into();
207 self
208 }
209 }
210
211 #[doc(hidden)]
212 impl gax::options::internal::RequestBuilder for DeleteScanConfig {
213 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
214 &mut self.0.options
215 }
216 }
217
218 #[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 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 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
252 self.0.options = v.into();
253 self
254 }
255
256 pub async fn send(self) -> Result<crate::model::ScanConfig> {
258 (*self.0.stub)
259 .get_scan_config(self.0.request, self.0.options)
260 .await
261 .map(gax::response::Response::into_body)
262 }
263
264 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
266 self.0.request.name = v.into();
267 self
268 }
269 }
270
271 #[doc(hidden)]
272 impl gax::options::internal::RequestBuilder for GetScanConfig {
273 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
274 &mut self.0.options
275 }
276 }
277
278 #[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 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 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
316 self.0.options = v.into();
317 self
318 }
319
320 pub async fn send(self) -> Result<crate::model::ListScanConfigsResponse> {
322 (*self.0.stub)
323 .list_scan_configs(self.0.request, self.0.options)
324 .await
325 .map(gax::response::Response::into_body)
326 }
327
328 pub fn by_page(
330 self,
331 ) -> impl gax::paginator::Paginator<crate::model::ListScanConfigsResponse, gax::error::Error>
332 {
333 use std::clone::Clone;
334 let token = self.0.request.page_token.clone();
335 let execute = move |token: String| {
336 let mut builder = self.clone();
337 builder.0.request = builder.0.request.set_page_token(token);
338 builder.send()
339 };
340 gax::paginator::internal::new_paginator(token, execute)
341 }
342
343 pub fn by_item(
345 self,
346 ) -> impl gax::paginator::ItemPaginator<crate::model::ListScanConfigsResponse, gax::error::Error>
347 {
348 use gax::paginator::Paginator;
349 self.by_page().items()
350 }
351
352 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
354 self.0.request.parent = v.into();
355 self
356 }
357
358 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
360 self.0.request.page_token = v.into();
361 self
362 }
363
364 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
366 self.0.request.page_size = v.into();
367 self
368 }
369 }
370
371 #[doc(hidden)]
372 impl gax::options::internal::RequestBuilder for ListScanConfigs {
373 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
374 &mut self.0.options
375 }
376 }
377
378 #[derive(Clone, Debug)]
395 pub struct UpdateScanConfig(RequestBuilder<crate::model::UpdateScanConfigRequest>);
396
397 impl UpdateScanConfig {
398 pub(crate) fn new(
399 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
400 ) -> Self {
401 Self(RequestBuilder::new(stub))
402 }
403
404 pub fn with_request<V: Into<crate::model::UpdateScanConfigRequest>>(
406 mut self,
407 v: V,
408 ) -> Self {
409 self.0.request = v.into();
410 self
411 }
412
413 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
415 self.0.options = v.into();
416 self
417 }
418
419 pub async fn send(self) -> Result<crate::model::ScanConfig> {
421 (*self.0.stub)
422 .update_scan_config(self.0.request, self.0.options)
423 .await
424 .map(gax::response::Response::into_body)
425 }
426
427 pub fn set_scan_config<T>(mut self, v: T) -> Self
429 where
430 T: std::convert::Into<crate::model::ScanConfig>,
431 {
432 self.0.request.scan_config = std::option::Option::Some(v.into());
433 self
434 }
435
436 pub fn set_or_clear_scan_config<T>(mut self, v: std::option::Option<T>) -> Self
438 where
439 T: std::convert::Into<crate::model::ScanConfig>,
440 {
441 self.0.request.scan_config = v.map(|x| x.into());
442 self
443 }
444
445 pub fn set_update_mask<T>(mut self, v: T) -> Self
447 where
448 T: std::convert::Into<wkt::FieldMask>,
449 {
450 self.0.request.update_mask = std::option::Option::Some(v.into());
451 self
452 }
453
454 pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
456 where
457 T: std::convert::Into<wkt::FieldMask>,
458 {
459 self.0.request.update_mask = v.map(|x| x.into());
460 self
461 }
462 }
463
464 #[doc(hidden)]
465 impl gax::options::internal::RequestBuilder for UpdateScanConfig {
466 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
467 &mut self.0.options
468 }
469 }
470
471 #[derive(Clone, Debug)]
488 pub struct StartScanRun(RequestBuilder<crate::model::StartScanRunRequest>);
489
490 impl StartScanRun {
491 pub(crate) fn new(
492 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
493 ) -> Self {
494 Self(RequestBuilder::new(stub))
495 }
496
497 pub fn with_request<V: Into<crate::model::StartScanRunRequest>>(mut self, v: V) -> Self {
499 self.0.request = v.into();
500 self
501 }
502
503 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
505 self.0.options = v.into();
506 self
507 }
508
509 pub async fn send(self) -> Result<crate::model::ScanRun> {
511 (*self.0.stub)
512 .start_scan_run(self.0.request, self.0.options)
513 .await
514 .map(gax::response::Response::into_body)
515 }
516
517 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
519 self.0.request.name = v.into();
520 self
521 }
522 }
523
524 #[doc(hidden)]
525 impl gax::options::internal::RequestBuilder for StartScanRun {
526 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
527 &mut self.0.options
528 }
529 }
530
531 #[derive(Clone, Debug)]
548 pub struct GetScanRun(RequestBuilder<crate::model::GetScanRunRequest>);
549
550 impl GetScanRun {
551 pub(crate) fn new(
552 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
553 ) -> Self {
554 Self(RequestBuilder::new(stub))
555 }
556
557 pub fn with_request<V: Into<crate::model::GetScanRunRequest>>(mut self, v: V) -> Self {
559 self.0.request = v.into();
560 self
561 }
562
563 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
565 self.0.options = v.into();
566 self
567 }
568
569 pub async fn send(self) -> Result<crate::model::ScanRun> {
571 (*self.0.stub)
572 .get_scan_run(self.0.request, self.0.options)
573 .await
574 .map(gax::response::Response::into_body)
575 }
576
577 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
579 self.0.request.name = v.into();
580 self
581 }
582 }
583
584 #[doc(hidden)]
585 impl gax::options::internal::RequestBuilder for GetScanRun {
586 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
587 &mut self.0.options
588 }
589 }
590
591 #[derive(Clone, Debug)]
612 pub struct ListScanRuns(RequestBuilder<crate::model::ListScanRunsRequest>);
613
614 impl ListScanRuns {
615 pub(crate) fn new(
616 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
617 ) -> Self {
618 Self(RequestBuilder::new(stub))
619 }
620
621 pub fn with_request<V: Into<crate::model::ListScanRunsRequest>>(mut self, v: V) -> Self {
623 self.0.request = v.into();
624 self
625 }
626
627 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
629 self.0.options = v.into();
630 self
631 }
632
633 pub async fn send(self) -> Result<crate::model::ListScanRunsResponse> {
635 (*self.0.stub)
636 .list_scan_runs(self.0.request, self.0.options)
637 .await
638 .map(gax::response::Response::into_body)
639 }
640
641 pub fn by_page(
643 self,
644 ) -> impl gax::paginator::Paginator<crate::model::ListScanRunsResponse, gax::error::Error>
645 {
646 use std::clone::Clone;
647 let token = self.0.request.page_token.clone();
648 let execute = move |token: String| {
649 let mut builder = self.clone();
650 builder.0.request = builder.0.request.set_page_token(token);
651 builder.send()
652 };
653 gax::paginator::internal::new_paginator(token, execute)
654 }
655
656 pub fn by_item(
658 self,
659 ) -> impl gax::paginator::ItemPaginator<crate::model::ListScanRunsResponse, gax::error::Error>
660 {
661 use gax::paginator::Paginator;
662 self.by_page().items()
663 }
664
665 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
667 self.0.request.parent = v.into();
668 self
669 }
670
671 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
673 self.0.request.page_token = v.into();
674 self
675 }
676
677 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
679 self.0.request.page_size = v.into();
680 self
681 }
682 }
683
684 #[doc(hidden)]
685 impl gax::options::internal::RequestBuilder for ListScanRuns {
686 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
687 &mut self.0.options
688 }
689 }
690
691 #[derive(Clone, Debug)]
708 pub struct StopScanRun(RequestBuilder<crate::model::StopScanRunRequest>);
709
710 impl StopScanRun {
711 pub(crate) fn new(
712 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
713 ) -> Self {
714 Self(RequestBuilder::new(stub))
715 }
716
717 pub fn with_request<V: Into<crate::model::StopScanRunRequest>>(mut self, v: V) -> Self {
719 self.0.request = v.into();
720 self
721 }
722
723 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
725 self.0.options = v.into();
726 self
727 }
728
729 pub async fn send(self) -> Result<crate::model::ScanRun> {
731 (*self.0.stub)
732 .stop_scan_run(self.0.request, self.0.options)
733 .await
734 .map(gax::response::Response::into_body)
735 }
736
737 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
739 self.0.request.name = v.into();
740 self
741 }
742 }
743
744 #[doc(hidden)]
745 impl gax::options::internal::RequestBuilder for StopScanRun {
746 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
747 &mut self.0.options
748 }
749 }
750
751 #[derive(Clone, Debug)]
772 pub struct ListCrawledUrls(RequestBuilder<crate::model::ListCrawledUrlsRequest>);
773
774 impl ListCrawledUrls {
775 pub(crate) fn new(
776 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
777 ) -> Self {
778 Self(RequestBuilder::new(stub))
779 }
780
781 pub fn with_request<V: Into<crate::model::ListCrawledUrlsRequest>>(mut self, v: V) -> Self {
783 self.0.request = v.into();
784 self
785 }
786
787 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
789 self.0.options = v.into();
790 self
791 }
792
793 pub async fn send(self) -> Result<crate::model::ListCrawledUrlsResponse> {
795 (*self.0.stub)
796 .list_crawled_urls(self.0.request, self.0.options)
797 .await
798 .map(gax::response::Response::into_body)
799 }
800
801 pub fn by_page(
803 self,
804 ) -> impl gax::paginator::Paginator<crate::model::ListCrawledUrlsResponse, gax::error::Error>
805 {
806 use std::clone::Clone;
807 let token = self.0.request.page_token.clone();
808 let execute = move |token: String| {
809 let mut builder = self.clone();
810 builder.0.request = builder.0.request.set_page_token(token);
811 builder.send()
812 };
813 gax::paginator::internal::new_paginator(token, execute)
814 }
815
816 pub fn by_item(
818 self,
819 ) -> impl gax::paginator::ItemPaginator<crate::model::ListCrawledUrlsResponse, gax::error::Error>
820 {
821 use gax::paginator::Paginator;
822 self.by_page().items()
823 }
824
825 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
827 self.0.request.parent = v.into();
828 self
829 }
830
831 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
833 self.0.request.page_token = v.into();
834 self
835 }
836
837 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
839 self.0.request.page_size = v.into();
840 self
841 }
842 }
843
844 #[doc(hidden)]
845 impl gax::options::internal::RequestBuilder for ListCrawledUrls {
846 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
847 &mut self.0.options
848 }
849 }
850
851 #[derive(Clone, Debug)]
868 pub struct GetFinding(RequestBuilder<crate::model::GetFindingRequest>);
869
870 impl GetFinding {
871 pub(crate) fn new(
872 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
873 ) -> Self {
874 Self(RequestBuilder::new(stub))
875 }
876
877 pub fn with_request<V: Into<crate::model::GetFindingRequest>>(mut self, v: V) -> Self {
879 self.0.request = v.into();
880 self
881 }
882
883 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
885 self.0.options = v.into();
886 self
887 }
888
889 pub async fn send(self) -> Result<crate::model::Finding> {
891 (*self.0.stub)
892 .get_finding(self.0.request, self.0.options)
893 .await
894 .map(gax::response::Response::into_body)
895 }
896
897 pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
899 self.0.request.name = v.into();
900 self
901 }
902 }
903
904 #[doc(hidden)]
905 impl gax::options::internal::RequestBuilder for GetFinding {
906 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
907 &mut self.0.options
908 }
909 }
910
911 #[derive(Clone, Debug)]
932 pub struct ListFindings(RequestBuilder<crate::model::ListFindingsRequest>);
933
934 impl ListFindings {
935 pub(crate) fn new(
936 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
937 ) -> Self {
938 Self(RequestBuilder::new(stub))
939 }
940
941 pub fn with_request<V: Into<crate::model::ListFindingsRequest>>(mut self, v: V) -> Self {
943 self.0.request = v.into();
944 self
945 }
946
947 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
949 self.0.options = v.into();
950 self
951 }
952
953 pub async fn send(self) -> Result<crate::model::ListFindingsResponse> {
955 (*self.0.stub)
956 .list_findings(self.0.request, self.0.options)
957 .await
958 .map(gax::response::Response::into_body)
959 }
960
961 pub fn by_page(
963 self,
964 ) -> impl gax::paginator::Paginator<crate::model::ListFindingsResponse, gax::error::Error>
965 {
966 use std::clone::Clone;
967 let token = self.0.request.page_token.clone();
968 let execute = move |token: String| {
969 let mut builder = self.clone();
970 builder.0.request = builder.0.request.set_page_token(token);
971 builder.send()
972 };
973 gax::paginator::internal::new_paginator(token, execute)
974 }
975
976 pub fn by_item(
978 self,
979 ) -> impl gax::paginator::ItemPaginator<crate::model::ListFindingsResponse, gax::error::Error>
980 {
981 use gax::paginator::Paginator;
982 self.by_page().items()
983 }
984
985 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
987 self.0.request.parent = v.into();
988 self
989 }
990
991 pub fn set_filter<T: Into<std::string::String>>(mut self, v: T) -> Self {
993 self.0.request.filter = v.into();
994 self
995 }
996
997 pub fn set_page_token<T: Into<std::string::String>>(mut self, v: T) -> Self {
999 self.0.request.page_token = v.into();
1000 self
1001 }
1002
1003 pub fn set_page_size<T: Into<i32>>(mut self, v: T) -> Self {
1005 self.0.request.page_size = v.into();
1006 self
1007 }
1008 }
1009
1010 #[doc(hidden)]
1011 impl gax::options::internal::RequestBuilder for ListFindings {
1012 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1013 &mut self.0.options
1014 }
1015 }
1016
1017 #[derive(Clone, Debug)]
1034 pub struct ListFindingTypeStats(RequestBuilder<crate::model::ListFindingTypeStatsRequest>);
1035
1036 impl ListFindingTypeStats {
1037 pub(crate) fn new(
1038 stub: std::sync::Arc<dyn super::super::stub::dynamic::WebSecurityScanner>,
1039 ) -> Self {
1040 Self(RequestBuilder::new(stub))
1041 }
1042
1043 pub fn with_request<V: Into<crate::model::ListFindingTypeStatsRequest>>(
1045 mut self,
1046 v: V,
1047 ) -> Self {
1048 self.0.request = v.into();
1049 self
1050 }
1051
1052 pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
1054 self.0.options = v.into();
1055 self
1056 }
1057
1058 pub async fn send(self) -> Result<crate::model::ListFindingTypeStatsResponse> {
1060 (*self.0.stub)
1061 .list_finding_type_stats(self.0.request, self.0.options)
1062 .await
1063 .map(gax::response::Response::into_body)
1064 }
1065
1066 pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
1068 self.0.request.parent = v.into();
1069 self
1070 }
1071 }
1072
1073 #[doc(hidden)]
1074 impl gax::options::internal::RequestBuilder for ListFindingTypeStats {
1075 fn request_options(&mut self) -> &mut gax::options::RequestOptions {
1076 &mut self.0.options
1077 }
1078 }
1079}