1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 package webrisk
52
53 import (
54 "bytes"
55 "context"
56 "encoding/json"
57 "errors"
58 "fmt"
59 "io"
60 "net/http"
61 "net/url"
62 "strconv"
63 "strings"
64
65 googleapi "google.golang.org/api/googleapi"
66 internal "google.golang.org/api/internal"
67 gensupport "google.golang.org/api/internal/gensupport"
68 option "google.golang.org/api/option"
69 internaloption "google.golang.org/api/option/internaloption"
70 htransport "google.golang.org/api/transport/http"
71 )
72
73
74
75 var _ = bytes.NewBuffer
76 var _ = strconv.Itoa
77 var _ = fmt.Sprintf
78 var _ = json.NewDecoder
79 var _ = io.Copy
80 var _ = url.Parse
81 var _ = gensupport.MarshalJSON
82 var _ = googleapi.Version
83 var _ = errors.New
84 var _ = strings.Replace
85 var _ = context.Canceled
86 var _ = internaloption.WithDefaultEndpoint
87 var _ = internal.Version
88
89 const apiId = "webrisk:v1"
90 const apiName = "webrisk"
91 const apiVersion = "v1"
92 const basePath = "https://webrisk.googleapis.com/"
93 const basePathTemplate = "https://webrisk.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://webrisk.mtls.googleapis.com/"
95
96
97 const (
98
99
100 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
101 )
102
103
104 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
105 scopesOption := internaloption.WithDefaultScopes(
106 "https://www.googleapis.com/auth/cloud-platform",
107 )
108
109 opts = append([]option.ClientOption{scopesOption}, opts...)
110 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
111 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
112 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
113 opts = append(opts, internaloption.EnableNewAuthLibrary())
114 client, endpoint, err := htransport.NewClient(ctx, opts...)
115 if err != nil {
116 return nil, err
117 }
118 s, err := New(client)
119 if err != nil {
120 return nil, err
121 }
122 if endpoint != "" {
123 s.BasePath = endpoint
124 }
125 return s, nil
126 }
127
128
129
130
131
132
133 func New(client *http.Client) (*Service, error) {
134 if client == nil {
135 return nil, errors.New("client is nil")
136 }
137 s := &Service{client: client, BasePath: basePath}
138 s.Hashes = NewHashesService(s)
139 s.Projects = NewProjectsService(s)
140 s.ThreatLists = NewThreatListsService(s)
141 s.Uris = NewUrisService(s)
142 return s, nil
143 }
144
145 type Service struct {
146 client *http.Client
147 BasePath string
148 UserAgent string
149
150 Hashes *HashesService
151
152 Projects *ProjectsService
153
154 ThreatLists *ThreatListsService
155
156 Uris *UrisService
157 }
158
159 func (s *Service) userAgent() string {
160 if s.UserAgent == "" {
161 return googleapi.UserAgent
162 }
163 return googleapi.UserAgent + " " + s.UserAgent
164 }
165
166 func NewHashesService(s *Service) *HashesService {
167 rs := &HashesService{s: s}
168 return rs
169 }
170
171 type HashesService struct {
172 s *Service
173 }
174
175 func NewProjectsService(s *Service) *ProjectsService {
176 rs := &ProjectsService{s: s}
177 rs.Operations = NewProjectsOperationsService(s)
178 rs.Submissions = NewProjectsSubmissionsService(s)
179 return rs
180 }
181
182 type ProjectsService struct {
183 s *Service
184
185 Operations *ProjectsOperationsService
186
187 Submissions *ProjectsSubmissionsService
188 }
189
190 func NewProjectsOperationsService(s *Service) *ProjectsOperationsService {
191 rs := &ProjectsOperationsService{s: s}
192 return rs
193 }
194
195 type ProjectsOperationsService struct {
196 s *Service
197 }
198
199 func NewProjectsSubmissionsService(s *Service) *ProjectsSubmissionsService {
200 rs := &ProjectsSubmissionsService{s: s}
201 return rs
202 }
203
204 type ProjectsSubmissionsService struct {
205 s *Service
206 }
207
208 func NewThreatListsService(s *Service) *ThreatListsService {
209 rs := &ThreatListsService{s: s}
210 return rs
211 }
212
213 type ThreatListsService struct {
214 s *Service
215 }
216
217 func NewUrisService(s *Service) *UrisService {
218 rs := &UrisService{s: s}
219 return rs
220 }
221
222 type UrisService struct {
223 s *Service
224 }
225
226 type GoogleCloudWebriskV1ComputeThreatListDiffResponse struct {
227
228 Additions *GoogleCloudWebriskV1ThreatEntryAdditions `json:"additions,omitempty"`
229
230
231
232
233 Checksum *GoogleCloudWebriskV1ComputeThreatListDiffResponseChecksum `json:"checksum,omitempty"`
234
235
236
237
238 NewVersionToken string `json:"newVersionToken,omitempty"`
239
240
241
242
243 RecommendedNextDiff string `json:"recommendedNextDiff,omitempty"`
244
245
246 Removals *GoogleCloudWebriskV1ThreatEntryRemovals `json:"removals,omitempty"`
247
248
249
250
251
252
253
254
255
256
257 ResponseType string `json:"responseType,omitempty"`
258
259
260 googleapi.ServerResponse `json:"-"`
261
262
263
264
265
266 ForceSendFields []string `json:"-"`
267
268
269
270
271 NullFields []string `json:"-"`
272 }
273
274 func (s *GoogleCloudWebriskV1ComputeThreatListDiffResponse) MarshalJSON() ([]byte, error) {
275 type NoMethod GoogleCloudWebriskV1ComputeThreatListDiffResponse
276 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
277 }
278
279
280
281 type GoogleCloudWebriskV1ComputeThreatListDiffResponseChecksum struct {
282
283
284 Sha256 string `json:"sha256,omitempty"`
285
286
287
288
289
290 ForceSendFields []string `json:"-"`
291
292
293
294
295 NullFields []string `json:"-"`
296 }
297
298 func (s *GoogleCloudWebriskV1ComputeThreatListDiffResponseChecksum) MarshalJSON() ([]byte, error) {
299 type NoMethod GoogleCloudWebriskV1ComputeThreatListDiffResponseChecksum
300 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
301 }
302
303
304
305
306
307
308
309 type GoogleCloudWebriskV1RawHashes struct {
310
311
312
313 PrefixSize int64 `json:"prefixSize,omitempty"`
314
315
316
317 RawHashes string `json:"rawHashes,omitempty"`
318
319
320
321
322
323 ForceSendFields []string `json:"-"`
324
325
326
327
328 NullFields []string `json:"-"`
329 }
330
331 func (s *GoogleCloudWebriskV1RawHashes) MarshalJSON() ([]byte, error) {
332 type NoMethod GoogleCloudWebriskV1RawHashes
333 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
334 }
335
336
337
338 type GoogleCloudWebriskV1RawIndices struct {
339
340 Indices []int64 `json:"indices,omitempty"`
341
342
343
344
345
346 ForceSendFields []string `json:"-"`
347
348
349
350
351 NullFields []string `json:"-"`
352 }
353
354 func (s *GoogleCloudWebriskV1RawIndices) MarshalJSON() ([]byte, error) {
355 type NoMethod GoogleCloudWebriskV1RawIndices
356 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
357 }
358
359
360
361 type GoogleCloudWebriskV1RiceDeltaEncoding struct {
362
363
364 EncodedData string `json:"encodedData,omitempty"`
365
366
367
368 EntryCount int64 `json:"entryCount,omitempty"`
369
370
371
372 FirstValue int64 `json:"firstValue,omitempty,string"`
373
374
375 RiceParameter int64 `json:"riceParameter,omitempty"`
376
377
378
379
380
381 ForceSendFields []string `json:"-"`
382
383
384
385
386 NullFields []string `json:"-"`
387 }
388
389 func (s *GoogleCloudWebriskV1RiceDeltaEncoding) MarshalJSON() ([]byte, error) {
390 type NoMethod GoogleCloudWebriskV1RiceDeltaEncoding
391 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
392 }
393
394 type GoogleCloudWebriskV1SearchHashesResponse struct {
395
396
397 NegativeExpireTime string `json:"negativeExpireTime,omitempty"`
398
399
400 Threats []*GoogleCloudWebriskV1SearchHashesResponseThreatHash `json:"threats,omitempty"`
401
402
403 googleapi.ServerResponse `json:"-"`
404
405
406
407
408
409 ForceSendFields []string `json:"-"`
410
411
412
413
414 NullFields []string `json:"-"`
415 }
416
417 func (s *GoogleCloudWebriskV1SearchHashesResponse) MarshalJSON() ([]byte, error) {
418 type NoMethod GoogleCloudWebriskV1SearchHashesResponse
419 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
420 }
421
422
423
424 type GoogleCloudWebriskV1SearchHashesResponseThreatHash struct {
425
426
427 ExpireTime string `json:"expireTime,omitempty"`
428
429
430 Hash string `json:"hash,omitempty"`
431
432
433
434
435
436
437
438
439
440
441
442 ThreatTypes []string `json:"threatTypes,omitempty"`
443
444
445
446
447
448 ForceSendFields []string `json:"-"`
449
450
451
452
453 NullFields []string `json:"-"`
454 }
455
456 func (s *GoogleCloudWebriskV1SearchHashesResponseThreatHash) MarshalJSON() ([]byte, error) {
457 type NoMethod GoogleCloudWebriskV1SearchHashesResponseThreatHash
458 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
459 }
460
461 type GoogleCloudWebriskV1SearchUrisResponse struct {
462
463
464 Threat *GoogleCloudWebriskV1SearchUrisResponseThreatUri `json:"threat,omitempty"`
465
466
467 googleapi.ServerResponse `json:"-"`
468
469
470
471
472
473 ForceSendFields []string `json:"-"`
474
475
476
477
478 NullFields []string `json:"-"`
479 }
480
481 func (s *GoogleCloudWebriskV1SearchUrisResponse) MarshalJSON() ([]byte, error) {
482 type NoMethod GoogleCloudWebriskV1SearchUrisResponse
483 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
484 }
485
486
487
488 type GoogleCloudWebriskV1SearchUrisResponseThreatUri struct {
489
490
491 ExpireTime string `json:"expireTime,omitempty"`
492
493
494
495
496
497
498
499
500
501
502 ThreatTypes []string `json:"threatTypes,omitempty"`
503
504
505
506
507
508 ForceSendFields []string `json:"-"`
509
510
511
512
513 NullFields []string `json:"-"`
514 }
515
516 func (s *GoogleCloudWebriskV1SearchUrisResponseThreatUri) MarshalJSON() ([]byte, error) {
517 type NoMethod GoogleCloudWebriskV1SearchUrisResponseThreatUri
518 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
519 }
520
521
522
523 type GoogleCloudWebriskV1Submission struct {
524
525
526 Uri string `json:"uri,omitempty"`
527
528
529 googleapi.ServerResponse `json:"-"`
530
531
532
533
534
535 ForceSendFields []string `json:"-"`
536
537
538
539
540 NullFields []string `json:"-"`
541 }
542
543 func (s *GoogleCloudWebriskV1Submission) MarshalJSON() ([]byte, error) {
544 type NoMethod GoogleCloudWebriskV1Submission
545 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
546 }
547
548
549
550
551 type GoogleCloudWebriskV1ThreatEntryAdditions struct {
552
553
554 RawHashes []*GoogleCloudWebriskV1RawHashes `json:"rawHashes,omitempty"`
555
556
557
558 RiceHashes *GoogleCloudWebriskV1RiceDeltaEncoding `json:"riceHashes,omitempty"`
559
560
561
562
563
564 ForceSendFields []string `json:"-"`
565
566
567
568
569 NullFields []string `json:"-"`
570 }
571
572 func (s *GoogleCloudWebriskV1ThreatEntryAdditions) MarshalJSON() ([]byte, error) {
573 type NoMethod GoogleCloudWebriskV1ThreatEntryAdditions
574 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
575 }
576
577
578
579 type GoogleCloudWebriskV1ThreatEntryRemovals struct {
580
581 RawIndices *GoogleCloudWebriskV1RawIndices `json:"rawIndices,omitempty"`
582
583
584
585
586 RiceIndices *GoogleCloudWebriskV1RiceDeltaEncoding `json:"riceIndices,omitempty"`
587
588
589
590
591
592 ForceSendFields []string `json:"-"`
593
594
595
596
597 NullFields []string `json:"-"`
598 }
599
600 func (s *GoogleCloudWebriskV1ThreatEntryRemovals) MarshalJSON() ([]byte, error) {
601 type NoMethod GoogleCloudWebriskV1ThreatEntryRemovals
602 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
603 }
604
605
606
607 type GoogleLongrunningCancelOperationRequest struct {
608 }
609
610
611
612 type GoogleLongrunningListOperationsResponse struct {
613
614 NextPageToken string `json:"nextPageToken,omitempty"`
615
616
617 Operations []*GoogleLongrunningOperation `json:"operations,omitempty"`
618
619
620 googleapi.ServerResponse `json:"-"`
621
622
623
624
625
626 ForceSendFields []string `json:"-"`
627
628
629
630
631 NullFields []string `json:"-"`
632 }
633
634 func (s *GoogleLongrunningListOperationsResponse) MarshalJSON() ([]byte, error) {
635 type NoMethod GoogleLongrunningListOperationsResponse
636 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
637 }
638
639
640
641 type GoogleLongrunningOperation struct {
642
643
644
645 Done bool `json:"done,omitempty"`
646
647 Error *GoogleRpcStatus `json:"error,omitempty"`
648
649 Metadata googleapi.RawMessage `json:"metadata,omitempty"`
650
651 Name string `json:"name,omitempty"`
652
653
654
655
656
657
658
659 Response googleapi.RawMessage `json:"response,omitempty"`
660
661
662 googleapi.ServerResponse `json:"-"`
663
664
665
666
667
668 ForceSendFields []string `json:"-"`
669
670
671
672
673 NullFields []string `json:"-"`
674 }
675
676 func (s *GoogleLongrunningOperation) MarshalJSON() ([]byte, error) {
677 type NoMethod GoogleLongrunningOperation
678 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
679 }
680
681
682
683
684
685
686 type GoogleProtobufEmpty struct {
687
688 googleapi.ServerResponse `json:"-"`
689 }
690
691
692
693
694
695
696
697 type GoogleRpcStatus struct {
698
699 Code int64 `json:"code,omitempty"`
700
701
702 Details []googleapi.RawMessage `json:"details,omitempty"`
703
704
705
706 Message string `json:"message,omitempty"`
707
708
709
710
711
712 ForceSendFields []string `json:"-"`
713
714
715
716
717 NullFields []string `json:"-"`
718 }
719
720 func (s *GoogleRpcStatus) MarshalJSON() ([]byte, error) {
721 type NoMethod GoogleRpcStatus
722 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
723 }
724
725 type HashesSearchCall struct {
726 s *Service
727 urlParams_ gensupport.URLParams
728 ifNoneMatch_ string
729 ctx_ context.Context
730 header_ http.Header
731 }
732
733
734
735
736
737 func (r *HashesService) Search() *HashesSearchCall {
738 c := &HashesSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
739 return c
740 }
741
742
743
744
745
746
747 func (c *HashesSearchCall) HashPrefix(hashPrefix string) *HashesSearchCall {
748 c.urlParams_.Set("hashPrefix", hashPrefix)
749 return c
750 }
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767 func (c *HashesSearchCall) ThreatTypes(threatTypes ...string) *HashesSearchCall {
768 c.urlParams_.SetMulti("threatTypes", append([]string{}, threatTypes...))
769 return c
770 }
771
772
773
774
775 func (c *HashesSearchCall) Fields(s ...googleapi.Field) *HashesSearchCall {
776 c.urlParams_.Set("fields", googleapi.CombineFields(s))
777 return c
778 }
779
780
781
782
783 func (c *HashesSearchCall) IfNoneMatch(entityTag string) *HashesSearchCall {
784 c.ifNoneMatch_ = entityTag
785 return c
786 }
787
788
789 func (c *HashesSearchCall) Context(ctx context.Context) *HashesSearchCall {
790 c.ctx_ = ctx
791 return c
792 }
793
794
795
796 func (c *HashesSearchCall) Header() http.Header {
797 if c.header_ == nil {
798 c.header_ = make(http.Header)
799 }
800 return c.header_
801 }
802
803 func (c *HashesSearchCall) doRequest(alt string) (*http.Response, error) {
804 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
805 if c.ifNoneMatch_ != "" {
806 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
807 }
808 var body io.Reader = nil
809 c.urlParams_.Set("alt", alt)
810 c.urlParams_.Set("prettyPrint", "false")
811 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/hashes:search")
812 urls += "?" + c.urlParams_.Encode()
813 req, err := http.NewRequest("GET", urls, body)
814 if err != nil {
815 return nil, err
816 }
817 req.Header = reqHeaders
818 return gensupport.SendRequest(c.ctx_, c.s.client, req)
819 }
820
821
822
823
824
825
826
827 func (c *HashesSearchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudWebriskV1SearchHashesResponse, error) {
828 gensupport.SetOptions(c.urlParams_, opts...)
829 res, err := c.doRequest("json")
830 if res != nil && res.StatusCode == http.StatusNotModified {
831 if res.Body != nil {
832 res.Body.Close()
833 }
834 return nil, gensupport.WrapError(&googleapi.Error{
835 Code: res.StatusCode,
836 Header: res.Header,
837 })
838 }
839 if err != nil {
840 return nil, err
841 }
842 defer googleapi.CloseBody(res)
843 if err := googleapi.CheckResponse(res); err != nil {
844 return nil, gensupport.WrapError(err)
845 }
846 ret := &GoogleCloudWebriskV1SearchHashesResponse{
847 ServerResponse: googleapi.ServerResponse{
848 Header: res.Header,
849 HTTPStatusCode: res.StatusCode,
850 },
851 }
852 target := &ret
853 if err := gensupport.DecodeResponse(target, res); err != nil {
854 return nil, err
855 }
856 return ret, nil
857 }
858
859 type ProjectsOperationsCancelCall struct {
860 s *Service
861 name string
862 googlelongrunningcanceloperationrequest *GoogleLongrunningCancelOperationRequest
863 urlParams_ gensupport.URLParams
864 ctx_ context.Context
865 header_ http.Header
866 }
867
868
869
870
871
872
873
874
875
876
877
878
879 func (r *ProjectsOperationsService) Cancel(name string, googlelongrunningcanceloperationrequest *GoogleLongrunningCancelOperationRequest) *ProjectsOperationsCancelCall {
880 c := &ProjectsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
881 c.name = name
882 c.googlelongrunningcanceloperationrequest = googlelongrunningcanceloperationrequest
883 return c
884 }
885
886
887
888
889 func (c *ProjectsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsOperationsCancelCall {
890 c.urlParams_.Set("fields", googleapi.CombineFields(s))
891 return c
892 }
893
894
895 func (c *ProjectsOperationsCancelCall) Context(ctx context.Context) *ProjectsOperationsCancelCall {
896 c.ctx_ = ctx
897 return c
898 }
899
900
901
902 func (c *ProjectsOperationsCancelCall) Header() http.Header {
903 if c.header_ == nil {
904 c.header_ = make(http.Header)
905 }
906 return c.header_
907 }
908
909 func (c *ProjectsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
910 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
911 var body io.Reader = nil
912 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlelongrunningcanceloperationrequest)
913 if err != nil {
914 return nil, err
915 }
916 c.urlParams_.Set("alt", alt)
917 c.urlParams_.Set("prettyPrint", "false")
918 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:cancel")
919 urls += "?" + c.urlParams_.Encode()
920 req, err := http.NewRequest("POST", urls, body)
921 if err != nil {
922 return nil, err
923 }
924 req.Header = reqHeaders
925 googleapi.Expand(req.URL, map[string]string{
926 "name": c.name,
927 })
928 return gensupport.SendRequest(c.ctx_, c.s.client, req)
929 }
930
931
932
933
934
935
936
937 func (c *ProjectsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) {
938 gensupport.SetOptions(c.urlParams_, opts...)
939 res, err := c.doRequest("json")
940 if res != nil && res.StatusCode == http.StatusNotModified {
941 if res.Body != nil {
942 res.Body.Close()
943 }
944 return nil, gensupport.WrapError(&googleapi.Error{
945 Code: res.StatusCode,
946 Header: res.Header,
947 })
948 }
949 if err != nil {
950 return nil, err
951 }
952 defer googleapi.CloseBody(res)
953 if err := googleapi.CheckResponse(res); err != nil {
954 return nil, gensupport.WrapError(err)
955 }
956 ret := &GoogleProtobufEmpty{
957 ServerResponse: googleapi.ServerResponse{
958 Header: res.Header,
959 HTTPStatusCode: res.StatusCode,
960 },
961 }
962 target := &ret
963 if err := gensupport.DecodeResponse(target, res); err != nil {
964 return nil, err
965 }
966 return ret, nil
967 }
968
969 type ProjectsOperationsDeleteCall struct {
970 s *Service
971 name string
972 urlParams_ gensupport.URLParams
973 ctx_ context.Context
974 header_ http.Header
975 }
976
977
978
979
980
981
982
983 func (r *ProjectsOperationsService) Delete(name string) *ProjectsOperationsDeleteCall {
984 c := &ProjectsOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
985 c.name = name
986 return c
987 }
988
989
990
991
992 func (c *ProjectsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsOperationsDeleteCall {
993 c.urlParams_.Set("fields", googleapi.CombineFields(s))
994 return c
995 }
996
997
998 func (c *ProjectsOperationsDeleteCall) Context(ctx context.Context) *ProjectsOperationsDeleteCall {
999 c.ctx_ = ctx
1000 return c
1001 }
1002
1003
1004
1005 func (c *ProjectsOperationsDeleteCall) Header() http.Header {
1006 if c.header_ == nil {
1007 c.header_ = make(http.Header)
1008 }
1009 return c.header_
1010 }
1011
1012 func (c *ProjectsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
1013 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1014 var body io.Reader = nil
1015 c.urlParams_.Set("alt", alt)
1016 c.urlParams_.Set("prettyPrint", "false")
1017 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1018 urls += "?" + c.urlParams_.Encode()
1019 req, err := http.NewRequest("DELETE", urls, body)
1020 if err != nil {
1021 return nil, err
1022 }
1023 req.Header = reqHeaders
1024 googleapi.Expand(req.URL, map[string]string{
1025 "name": c.name,
1026 })
1027 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1028 }
1029
1030
1031
1032
1033
1034
1035
1036 func (c *ProjectsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*GoogleProtobufEmpty, error) {
1037 gensupport.SetOptions(c.urlParams_, opts...)
1038 res, err := c.doRequest("json")
1039 if res != nil && res.StatusCode == http.StatusNotModified {
1040 if res.Body != nil {
1041 res.Body.Close()
1042 }
1043 return nil, gensupport.WrapError(&googleapi.Error{
1044 Code: res.StatusCode,
1045 Header: res.Header,
1046 })
1047 }
1048 if err != nil {
1049 return nil, err
1050 }
1051 defer googleapi.CloseBody(res)
1052 if err := googleapi.CheckResponse(res); err != nil {
1053 return nil, gensupport.WrapError(err)
1054 }
1055 ret := &GoogleProtobufEmpty{
1056 ServerResponse: googleapi.ServerResponse{
1057 Header: res.Header,
1058 HTTPStatusCode: res.StatusCode,
1059 },
1060 }
1061 target := &ret
1062 if err := gensupport.DecodeResponse(target, res); err != nil {
1063 return nil, err
1064 }
1065 return ret, nil
1066 }
1067
1068 type ProjectsOperationsGetCall struct {
1069 s *Service
1070 name string
1071 urlParams_ gensupport.URLParams
1072 ifNoneMatch_ string
1073 ctx_ context.Context
1074 header_ http.Header
1075 }
1076
1077
1078
1079
1080
1081
1082 func (r *ProjectsOperationsService) Get(name string) *ProjectsOperationsGetCall {
1083 c := &ProjectsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1084 c.name = name
1085 return c
1086 }
1087
1088
1089
1090
1091 func (c *ProjectsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsOperationsGetCall {
1092 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1093 return c
1094 }
1095
1096
1097
1098
1099 func (c *ProjectsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsOperationsGetCall {
1100 c.ifNoneMatch_ = entityTag
1101 return c
1102 }
1103
1104
1105 func (c *ProjectsOperationsGetCall) Context(ctx context.Context) *ProjectsOperationsGetCall {
1106 c.ctx_ = ctx
1107 return c
1108 }
1109
1110
1111
1112 func (c *ProjectsOperationsGetCall) Header() http.Header {
1113 if c.header_ == nil {
1114 c.header_ = make(http.Header)
1115 }
1116 return c.header_
1117 }
1118
1119 func (c *ProjectsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
1120 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1121 if c.ifNoneMatch_ != "" {
1122 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1123 }
1124 var body io.Reader = nil
1125 c.urlParams_.Set("alt", alt)
1126 c.urlParams_.Set("prettyPrint", "false")
1127 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
1128 urls += "?" + c.urlParams_.Encode()
1129 req, err := http.NewRequest("GET", urls, body)
1130 if err != nil {
1131 return nil, err
1132 }
1133 req.Header = reqHeaders
1134 googleapi.Expand(req.URL, map[string]string{
1135 "name": c.name,
1136 })
1137 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1138 }
1139
1140
1141
1142
1143
1144
1145
1146 func (c *ProjectsOperationsGetCall) Do(opts ...googleapi.CallOption) (*GoogleLongrunningOperation, error) {
1147 gensupport.SetOptions(c.urlParams_, opts...)
1148 res, err := c.doRequest("json")
1149 if res != nil && res.StatusCode == http.StatusNotModified {
1150 if res.Body != nil {
1151 res.Body.Close()
1152 }
1153 return nil, gensupport.WrapError(&googleapi.Error{
1154 Code: res.StatusCode,
1155 Header: res.Header,
1156 })
1157 }
1158 if err != nil {
1159 return nil, err
1160 }
1161 defer googleapi.CloseBody(res)
1162 if err := googleapi.CheckResponse(res); err != nil {
1163 return nil, gensupport.WrapError(err)
1164 }
1165 ret := &GoogleLongrunningOperation{
1166 ServerResponse: googleapi.ServerResponse{
1167 Header: res.Header,
1168 HTTPStatusCode: res.StatusCode,
1169 },
1170 }
1171 target := &ret
1172 if err := gensupport.DecodeResponse(target, res); err != nil {
1173 return nil, err
1174 }
1175 return ret, nil
1176 }
1177
1178 type ProjectsOperationsListCall struct {
1179 s *Service
1180 name string
1181 urlParams_ gensupport.URLParams
1182 ifNoneMatch_ string
1183 ctx_ context.Context
1184 header_ http.Header
1185 }
1186
1187
1188
1189
1190
1191 func (r *ProjectsOperationsService) List(name string) *ProjectsOperationsListCall {
1192 c := &ProjectsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1193 c.name = name
1194 return c
1195 }
1196
1197
1198 func (c *ProjectsOperationsListCall) Filter(filter string) *ProjectsOperationsListCall {
1199 c.urlParams_.Set("filter", filter)
1200 return c
1201 }
1202
1203
1204
1205 func (c *ProjectsOperationsListCall) PageSize(pageSize int64) *ProjectsOperationsListCall {
1206 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1207 return c
1208 }
1209
1210
1211
1212 func (c *ProjectsOperationsListCall) PageToken(pageToken string) *ProjectsOperationsListCall {
1213 c.urlParams_.Set("pageToken", pageToken)
1214 return c
1215 }
1216
1217
1218
1219
1220 func (c *ProjectsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsOperationsListCall {
1221 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1222 return c
1223 }
1224
1225
1226
1227
1228 func (c *ProjectsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsOperationsListCall {
1229 c.ifNoneMatch_ = entityTag
1230 return c
1231 }
1232
1233
1234 func (c *ProjectsOperationsListCall) Context(ctx context.Context) *ProjectsOperationsListCall {
1235 c.ctx_ = ctx
1236 return c
1237 }
1238
1239
1240
1241 func (c *ProjectsOperationsListCall) Header() http.Header {
1242 if c.header_ == nil {
1243 c.header_ = make(http.Header)
1244 }
1245 return c.header_
1246 }
1247
1248 func (c *ProjectsOperationsListCall) doRequest(alt string) (*http.Response, error) {
1249 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1250 if c.ifNoneMatch_ != "" {
1251 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1252 }
1253 var body io.Reader = nil
1254 c.urlParams_.Set("alt", alt)
1255 c.urlParams_.Set("prettyPrint", "false")
1256 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}/operations")
1257 urls += "?" + c.urlParams_.Encode()
1258 req, err := http.NewRequest("GET", urls, body)
1259 if err != nil {
1260 return nil, err
1261 }
1262 req.Header = reqHeaders
1263 googleapi.Expand(req.URL, map[string]string{
1264 "name": c.name,
1265 })
1266 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1267 }
1268
1269
1270
1271
1272
1273
1274
1275 func (c *ProjectsOperationsListCall) Do(opts ...googleapi.CallOption) (*GoogleLongrunningListOperationsResponse, error) {
1276 gensupport.SetOptions(c.urlParams_, opts...)
1277 res, err := c.doRequest("json")
1278 if res != nil && res.StatusCode == http.StatusNotModified {
1279 if res.Body != nil {
1280 res.Body.Close()
1281 }
1282 return nil, gensupport.WrapError(&googleapi.Error{
1283 Code: res.StatusCode,
1284 Header: res.Header,
1285 })
1286 }
1287 if err != nil {
1288 return nil, err
1289 }
1290 defer googleapi.CloseBody(res)
1291 if err := googleapi.CheckResponse(res); err != nil {
1292 return nil, gensupport.WrapError(err)
1293 }
1294 ret := &GoogleLongrunningListOperationsResponse{
1295 ServerResponse: googleapi.ServerResponse{
1296 Header: res.Header,
1297 HTTPStatusCode: res.StatusCode,
1298 },
1299 }
1300 target := &ret
1301 if err := gensupport.DecodeResponse(target, res); err != nil {
1302 return nil, err
1303 }
1304 return ret, nil
1305 }
1306
1307
1308
1309
1310 func (c *ProjectsOperationsListCall) Pages(ctx context.Context, f func(*GoogleLongrunningListOperationsResponse) error) error {
1311 c.ctx_ = ctx
1312 defer c.PageToken(c.urlParams_.Get("pageToken"))
1313 for {
1314 x, err := c.Do()
1315 if err != nil {
1316 return err
1317 }
1318 if err := f(x); err != nil {
1319 return err
1320 }
1321 if x.NextPageToken == "" {
1322 return nil
1323 }
1324 c.PageToken(x.NextPageToken)
1325 }
1326 }
1327
1328 type ProjectsSubmissionsCreateCall struct {
1329 s *Service
1330 parent string
1331 googlecloudwebriskv1submission *GoogleCloudWebriskV1Submission
1332 urlParams_ gensupport.URLParams
1333 ctx_ context.Context
1334 header_ http.Header
1335 }
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347 func (r *ProjectsSubmissionsService) Create(parent string, googlecloudwebriskv1submission *GoogleCloudWebriskV1Submission) *ProjectsSubmissionsCreateCall {
1348 c := &ProjectsSubmissionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1349 c.parent = parent
1350 c.googlecloudwebriskv1submission = googlecloudwebriskv1submission
1351 return c
1352 }
1353
1354
1355
1356
1357 func (c *ProjectsSubmissionsCreateCall) Fields(s ...googleapi.Field) *ProjectsSubmissionsCreateCall {
1358 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1359 return c
1360 }
1361
1362
1363 func (c *ProjectsSubmissionsCreateCall) Context(ctx context.Context) *ProjectsSubmissionsCreateCall {
1364 c.ctx_ = ctx
1365 return c
1366 }
1367
1368
1369
1370 func (c *ProjectsSubmissionsCreateCall) Header() http.Header {
1371 if c.header_ == nil {
1372 c.header_ = make(http.Header)
1373 }
1374 return c.header_
1375 }
1376
1377 func (c *ProjectsSubmissionsCreateCall) doRequest(alt string) (*http.Response, error) {
1378 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1379 var body io.Reader = nil
1380 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudwebriskv1submission)
1381 if err != nil {
1382 return nil, err
1383 }
1384 c.urlParams_.Set("alt", alt)
1385 c.urlParams_.Set("prettyPrint", "false")
1386 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+parent}/submissions")
1387 urls += "?" + c.urlParams_.Encode()
1388 req, err := http.NewRequest("POST", urls, body)
1389 if err != nil {
1390 return nil, err
1391 }
1392 req.Header = reqHeaders
1393 googleapi.Expand(req.URL, map[string]string{
1394 "parent": c.parent,
1395 })
1396 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1397 }
1398
1399
1400
1401
1402
1403
1404
1405 func (c *ProjectsSubmissionsCreateCall) Do(opts ...googleapi.CallOption) (*GoogleCloudWebriskV1Submission, error) {
1406 gensupport.SetOptions(c.urlParams_, opts...)
1407 res, err := c.doRequest("json")
1408 if res != nil && res.StatusCode == http.StatusNotModified {
1409 if res.Body != nil {
1410 res.Body.Close()
1411 }
1412 return nil, gensupport.WrapError(&googleapi.Error{
1413 Code: res.StatusCode,
1414 Header: res.Header,
1415 })
1416 }
1417 if err != nil {
1418 return nil, err
1419 }
1420 defer googleapi.CloseBody(res)
1421 if err := googleapi.CheckResponse(res); err != nil {
1422 return nil, gensupport.WrapError(err)
1423 }
1424 ret := &GoogleCloudWebriskV1Submission{
1425 ServerResponse: googleapi.ServerResponse{
1426 Header: res.Header,
1427 HTTPStatusCode: res.StatusCode,
1428 },
1429 }
1430 target := &ret
1431 if err := gensupport.DecodeResponse(target, res); err != nil {
1432 return nil, err
1433 }
1434 return ret, nil
1435 }
1436
1437 type ThreatListsComputeDiffCall struct {
1438 s *Service
1439 urlParams_ gensupport.URLParams
1440 ifNoneMatch_ string
1441 ctx_ context.Context
1442 header_ http.Header
1443 }
1444
1445
1446
1447
1448
1449
1450
1451 func (r *ThreatListsService) ComputeDiff() *ThreatListsComputeDiffCall {
1452 c := &ThreatListsComputeDiffCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1453 return c
1454 }
1455
1456
1457
1458
1459
1460 func (c *ThreatListsComputeDiffCall) ConstraintsMaxDatabaseEntries(constraintsMaxDatabaseEntries int64) *ThreatListsComputeDiffCall {
1461 c.urlParams_.Set("constraints.maxDatabaseEntries", fmt.Sprint(constraintsMaxDatabaseEntries))
1462 return c
1463 }
1464
1465
1466
1467
1468
1469 func (c *ThreatListsComputeDiffCall) ConstraintsMaxDiffEntries(constraintsMaxDiffEntries int64) *ThreatListsComputeDiffCall {
1470 c.urlParams_.Set("constraints.maxDiffEntries", fmt.Sprint(constraintsMaxDiffEntries))
1471 return c
1472 }
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483 func (c *ThreatListsComputeDiffCall) ConstraintsSupportedCompressions(constraintsSupportedCompressions ...string) *ThreatListsComputeDiffCall {
1484 c.urlParams_.SetMulti("constraints.supportedCompressions", append([]string{}, constraintsSupportedCompressions...))
1485 return c
1486 }
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505 func (c *ThreatListsComputeDiffCall) ThreatType(threatType string) *ThreatListsComputeDiffCall {
1506 c.urlParams_.Set("threatType", threatType)
1507 return c
1508 }
1509
1510
1511
1512
1513
1514
1515 func (c *ThreatListsComputeDiffCall) VersionToken(versionToken string) *ThreatListsComputeDiffCall {
1516 c.urlParams_.Set("versionToken", versionToken)
1517 return c
1518 }
1519
1520
1521
1522
1523 func (c *ThreatListsComputeDiffCall) Fields(s ...googleapi.Field) *ThreatListsComputeDiffCall {
1524 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1525 return c
1526 }
1527
1528
1529
1530
1531 func (c *ThreatListsComputeDiffCall) IfNoneMatch(entityTag string) *ThreatListsComputeDiffCall {
1532 c.ifNoneMatch_ = entityTag
1533 return c
1534 }
1535
1536
1537 func (c *ThreatListsComputeDiffCall) Context(ctx context.Context) *ThreatListsComputeDiffCall {
1538 c.ctx_ = ctx
1539 return c
1540 }
1541
1542
1543
1544 func (c *ThreatListsComputeDiffCall) Header() http.Header {
1545 if c.header_ == nil {
1546 c.header_ = make(http.Header)
1547 }
1548 return c.header_
1549 }
1550
1551 func (c *ThreatListsComputeDiffCall) doRequest(alt string) (*http.Response, error) {
1552 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1553 if c.ifNoneMatch_ != "" {
1554 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1555 }
1556 var body io.Reader = nil
1557 c.urlParams_.Set("alt", alt)
1558 c.urlParams_.Set("prettyPrint", "false")
1559 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/threatLists:computeDiff")
1560 urls += "?" + c.urlParams_.Encode()
1561 req, err := http.NewRequest("GET", urls, body)
1562 if err != nil {
1563 return nil, err
1564 }
1565 req.Header = reqHeaders
1566 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1567 }
1568
1569
1570
1571
1572
1573
1574
1575 func (c *ThreatListsComputeDiffCall) Do(opts ...googleapi.CallOption) (*GoogleCloudWebriskV1ComputeThreatListDiffResponse, error) {
1576 gensupport.SetOptions(c.urlParams_, opts...)
1577 res, err := c.doRequest("json")
1578 if res != nil && res.StatusCode == http.StatusNotModified {
1579 if res.Body != nil {
1580 res.Body.Close()
1581 }
1582 return nil, gensupport.WrapError(&googleapi.Error{
1583 Code: res.StatusCode,
1584 Header: res.Header,
1585 })
1586 }
1587 if err != nil {
1588 return nil, err
1589 }
1590 defer googleapi.CloseBody(res)
1591 if err := googleapi.CheckResponse(res); err != nil {
1592 return nil, gensupport.WrapError(err)
1593 }
1594 ret := &GoogleCloudWebriskV1ComputeThreatListDiffResponse{
1595 ServerResponse: googleapi.ServerResponse{
1596 Header: res.Header,
1597 HTTPStatusCode: res.StatusCode,
1598 },
1599 }
1600 target := &ret
1601 if err := gensupport.DecodeResponse(target, res); err != nil {
1602 return nil, err
1603 }
1604 return ret, nil
1605 }
1606
1607 type UrisSearchCall struct {
1608 s *Service
1609 urlParams_ gensupport.URLParams
1610 ifNoneMatch_ string
1611 ctx_ context.Context
1612 header_ http.Header
1613 }
1614
1615
1616
1617
1618
1619 func (r *UrisService) Search() *UrisSearchCall {
1620 c := &UrisSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1621 return c
1622 }
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639 func (c *UrisSearchCall) ThreatTypes(threatTypes ...string) *UrisSearchCall {
1640 c.urlParams_.SetMulti("threatTypes", append([]string{}, threatTypes...))
1641 return c
1642 }
1643
1644
1645
1646 func (c *UrisSearchCall) Uri(uri string) *UrisSearchCall {
1647 c.urlParams_.Set("uri", uri)
1648 return c
1649 }
1650
1651
1652
1653
1654 func (c *UrisSearchCall) Fields(s ...googleapi.Field) *UrisSearchCall {
1655 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1656 return c
1657 }
1658
1659
1660
1661
1662 func (c *UrisSearchCall) IfNoneMatch(entityTag string) *UrisSearchCall {
1663 c.ifNoneMatch_ = entityTag
1664 return c
1665 }
1666
1667
1668 func (c *UrisSearchCall) Context(ctx context.Context) *UrisSearchCall {
1669 c.ctx_ = ctx
1670 return c
1671 }
1672
1673
1674
1675 func (c *UrisSearchCall) Header() http.Header {
1676 if c.header_ == nil {
1677 c.header_ = make(http.Header)
1678 }
1679 return c.header_
1680 }
1681
1682 func (c *UrisSearchCall) doRequest(alt string) (*http.Response, error) {
1683 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1684 if c.ifNoneMatch_ != "" {
1685 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1686 }
1687 var body io.Reader = nil
1688 c.urlParams_.Set("alt", alt)
1689 c.urlParams_.Set("prettyPrint", "false")
1690 urls := googleapi.ResolveRelative(c.s.BasePath, "v1/uris:search")
1691 urls += "?" + c.urlParams_.Encode()
1692 req, err := http.NewRequest("GET", urls, body)
1693 if err != nil {
1694 return nil, err
1695 }
1696 req.Header = reqHeaders
1697 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1698 }
1699
1700
1701
1702
1703
1704
1705
1706 func (c *UrisSearchCall) Do(opts ...googleapi.CallOption) (*GoogleCloudWebriskV1SearchUrisResponse, error) {
1707 gensupport.SetOptions(c.urlParams_, opts...)
1708 res, err := c.doRequest("json")
1709 if res != nil && res.StatusCode == http.StatusNotModified {
1710 if res.Body != nil {
1711 res.Body.Close()
1712 }
1713 return nil, gensupport.WrapError(&googleapi.Error{
1714 Code: res.StatusCode,
1715 Header: res.Header,
1716 })
1717 }
1718 if err != nil {
1719 return nil, err
1720 }
1721 defer googleapi.CloseBody(res)
1722 if err := googleapi.CheckResponse(res); err != nil {
1723 return nil, gensupport.WrapError(err)
1724 }
1725 ret := &GoogleCloudWebriskV1SearchUrisResponse{
1726 ServerResponse: googleapi.ServerResponse{
1727 Header: res.Header,
1728 HTTPStatusCode: res.StatusCode,
1729 },
1730 }
1731 target := &ret
1732 if err := gensupport.DecodeResponse(target, res); err != nil {
1733 return nil, err
1734 }
1735 return ret, nil
1736 }
1737
View as plain text