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 eventarc
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 = "eventarc:v1beta1"
90 const apiName = "eventarc"
91 const apiVersion = "v1beta1"
92 const basePath = "https://eventarc.googleapis.com/"
93 const basePathTemplate = "https://eventarc.UNIVERSE_DOMAIN/"
94 const mtlsBasePath = "https://eventarc.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.Projects = NewProjectsService(s)
139 return s, nil
140 }
141
142 type Service struct {
143 client *http.Client
144 BasePath string
145 UserAgent string
146
147 Projects *ProjectsService
148 }
149
150 func (s *Service) userAgent() string {
151 if s.UserAgent == "" {
152 return googleapi.UserAgent
153 }
154 return googleapi.UserAgent + " " + s.UserAgent
155 }
156
157 func NewProjectsService(s *Service) *ProjectsService {
158 rs := &ProjectsService{s: s}
159 rs.Locations = NewProjectsLocationsService(s)
160 return rs
161 }
162
163 type ProjectsService struct {
164 s *Service
165
166 Locations *ProjectsLocationsService
167 }
168
169 func NewProjectsLocationsService(s *Service) *ProjectsLocationsService {
170 rs := &ProjectsLocationsService{s: s}
171 rs.Operations = NewProjectsLocationsOperationsService(s)
172 rs.Triggers = NewProjectsLocationsTriggersService(s)
173 return rs
174 }
175
176 type ProjectsLocationsService struct {
177 s *Service
178
179 Operations *ProjectsLocationsOperationsService
180
181 Triggers *ProjectsLocationsTriggersService
182 }
183
184 func NewProjectsLocationsOperationsService(s *Service) *ProjectsLocationsOperationsService {
185 rs := &ProjectsLocationsOperationsService{s: s}
186 return rs
187 }
188
189 type ProjectsLocationsOperationsService struct {
190 s *Service
191 }
192
193 func NewProjectsLocationsTriggersService(s *Service) *ProjectsLocationsTriggersService {
194 rs := &ProjectsLocationsTriggersService{s: s}
195 return rs
196 }
197
198 type ProjectsLocationsTriggersService struct {
199 s *Service
200 }
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218 type AuditConfig struct {
219
220 AuditLogConfigs []*AuditLogConfig `json:"auditLogConfigs,omitempty"`
221
222
223
224 Service string `json:"service,omitempty"`
225
226
227
228
229
230 ForceSendFields []string `json:"-"`
231
232
233
234
235 NullFields []string `json:"-"`
236 }
237
238 func (s *AuditConfig) MarshalJSON() ([]byte, error) {
239 type NoMethod AuditConfig
240 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
241 }
242
243
244
245
246
247
248 type AuditLogConfig struct {
249
250
251 ExemptedMembers []string `json:"exemptedMembers,omitempty"`
252
253
254
255
256
257
258
259 LogType string `json:"logType,omitempty"`
260
261
262
263
264
265 ForceSendFields []string `json:"-"`
266
267
268
269
270 NullFields []string `json:"-"`
271 }
272
273 func (s *AuditLogConfig) MarshalJSON() ([]byte, error) {
274 type NoMethod AuditLogConfig
275 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
276 }
277
278
279 type Binding struct {
280
281
282
283
284
285
286
287
288 Condition *Expr `json:"condition,omitempty"`
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351 Members []string `json:"members,omitempty"`
352
353
354
355
356
357
358 Role string `json:"role,omitempty"`
359
360
361
362
363
364 ForceSendFields []string `json:"-"`
365
366
367
368
369 NullFields []string `json:"-"`
370 }
371
372 func (s *Binding) MarshalJSON() ([]byte, error) {
373 type NoMethod Binding
374 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
375 }
376
377
378 type CancelOperationRequest struct {
379 }
380
381
382 type CloudRunService struct {
383
384
385
386 Path string `json:"path,omitempty"`
387
388 Region string `json:"region,omitempty"`
389
390
391
392
393 Service string `json:"service,omitempty"`
394
395
396
397
398
399 ForceSendFields []string `json:"-"`
400
401
402
403
404 NullFields []string `json:"-"`
405 }
406
407 func (s *CloudRunService) MarshalJSON() ([]byte, error) {
408 type NoMethod CloudRunService
409 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
410 }
411
412
413 type Destination struct {
414
415
416 CloudRunService *CloudRunService `json:"cloudRunService,omitempty"`
417
418
419
420
421
422 ForceSendFields []string `json:"-"`
423
424
425
426
427 NullFields []string `json:"-"`
428 }
429
430 func (s *Destination) MarshalJSON() ([]byte, error) {
431 type NoMethod Destination
432 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
433 }
434
435
436
437
438
439 type Empty struct {
440
441 googleapi.ServerResponse `json:"-"`
442 }
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460 type Expr struct {
461
462
463 Description string `json:"description,omitempty"`
464
465
466 Expression string `json:"expression,omitempty"`
467
468
469 Location string `json:"location,omitempty"`
470
471
472
473 Title string `json:"title,omitempty"`
474
475
476
477
478
479 ForceSendFields []string `json:"-"`
480
481
482
483
484 NullFields []string `json:"-"`
485 }
486
487 func (s *Expr) MarshalJSON() ([]byte, error) {
488 type NoMethod Expr
489 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
490 }
491
492
493 type ListLocationsResponse struct {
494
495
496 Locations []*Location `json:"locations,omitempty"`
497
498 NextPageToken string `json:"nextPageToken,omitempty"`
499
500
501 googleapi.ServerResponse `json:"-"`
502
503
504
505
506
507 ForceSendFields []string `json:"-"`
508
509
510
511
512 NullFields []string `json:"-"`
513 }
514
515 func (s *ListLocationsResponse) MarshalJSON() ([]byte, error) {
516 type NoMethod ListLocationsResponse
517 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
518 }
519
520
521 type ListOperationsResponse struct {
522
523 NextPageToken string `json:"nextPageToken,omitempty"`
524
525
526 Operations []*Operation `json:"operations,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 *ListOperationsResponse) MarshalJSON() ([]byte, error) {
544 type NoMethod ListOperationsResponse
545 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
546 }
547
548
549 type ListTriggersResponse struct {
550
551
552 NextPageToken string `json:"nextPageToken,omitempty"`
553
554 Triggers []*Trigger `json:"triggers,omitempty"`
555
556 Unreachable []string `json:"unreachable,omitempty"`
557
558
559 googleapi.ServerResponse `json:"-"`
560
561
562
563
564
565 ForceSendFields []string `json:"-"`
566
567
568
569
570 NullFields []string `json:"-"`
571 }
572
573 func (s *ListTriggersResponse) MarshalJSON() ([]byte, error) {
574 type NoMethod ListTriggersResponse
575 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
576 }
577
578
579 type Location struct {
580
581
582 DisplayName string `json:"displayName,omitempty"`
583
584
585 Labels map[string]string `json:"labels,omitempty"`
586
587 LocationId string `json:"locationId,omitempty"`
588
589
590 Metadata googleapi.RawMessage `json:"metadata,omitempty"`
591
592
593
594 Name string `json:"name,omitempty"`
595
596
597 googleapi.ServerResponse `json:"-"`
598
599
600
601
602
603 ForceSendFields []string `json:"-"`
604
605
606
607
608 NullFields []string `json:"-"`
609 }
610
611 func (s *Location) MarshalJSON() ([]byte, error) {
612 type NoMethod Location
613 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
614 }
615
616
617
618 type MatchingCriteria struct {
619
620
621
622 Attribute string `json:"attribute,omitempty"`
623
624 Value string `json:"value,omitempty"`
625
626
627
628
629
630 ForceSendFields []string `json:"-"`
631
632
633
634
635 NullFields []string `json:"-"`
636 }
637
638 func (s *MatchingCriteria) MarshalJSON() ([]byte, error) {
639 type NoMethod MatchingCriteria
640 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
641 }
642
643
644
645 type Operation struct {
646
647
648
649 Done bool `json:"done,omitempty"`
650
651 Error *Status `json:"error,omitempty"`
652
653
654
655
656 Metadata googleapi.RawMessage `json:"metadata,omitempty"`
657
658
659
660 Name string `json:"name,omitempty"`
661
662
663
664
665
666
667
668 Response googleapi.RawMessage `json:"response,omitempty"`
669
670
671 googleapi.ServerResponse `json:"-"`
672
673
674
675
676
677 ForceSendFields []string `json:"-"`
678
679
680
681
682 NullFields []string `json:"-"`
683 }
684
685 func (s *Operation) MarshalJSON() ([]byte, error) {
686 type NoMethod Operation
687 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
688 }
689
690
691 type OperationMetadata struct {
692
693 ApiVersion string `json:"apiVersion,omitempty"`
694
695 CreateTime string `json:"createTime,omitempty"`
696
697 EndTime string `json:"endTime,omitempty"`
698
699
700
701
702 RequestedCancellation bool `json:"requestedCancellation,omitempty"`
703
704 StatusMessage string `json:"statusMessage,omitempty"`
705
706
707 Target string `json:"target,omitempty"`
708
709 Verb string `json:"verb,omitempty"`
710
711
712
713
714
715 ForceSendFields []string `json:"-"`
716
717
718
719
720 NullFields []string `json:"-"`
721 }
722
723 func (s *OperationMetadata) MarshalJSON() ([]byte, error) {
724 type NoMethod OperationMetadata
725 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
726 }
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758 type Policy struct {
759
760 AuditConfigs []*AuditConfig `json:"auditConfigs,omitempty"`
761
762
763
764
765
766
767
768
769
770 Bindings []*Binding `json:"bindings,omitempty"`
771
772
773
774
775
776
777
778
779
780
781
782 Etag string `json:"etag,omitempty"`
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798 Version int64 `json:"version,omitempty"`
799
800
801 googleapi.ServerResponse `json:"-"`
802
803
804
805
806
807 ForceSendFields []string `json:"-"`
808
809
810
811
812 NullFields []string `json:"-"`
813 }
814
815 func (s *Policy) MarshalJSON() ([]byte, error) {
816 type NoMethod Policy
817 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
818 }
819
820
821 type Pubsub struct {
822
823
824
825 Subscription string `json:"subscription,omitempty"`
826
827
828
829
830
831
832 Topic string `json:"topic,omitempty"`
833
834
835
836
837
838 ForceSendFields []string `json:"-"`
839
840
841
842
843 NullFields []string `json:"-"`
844 }
845
846 func (s *Pubsub) MarshalJSON() ([]byte, error) {
847 type NoMethod Pubsub
848 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
849 }
850
851
852 type SetIamPolicyRequest struct {
853
854
855
856
857 Policy *Policy `json:"policy,omitempty"`
858
859
860
861 UpdateMask string `json:"updateMask,omitempty"`
862
863
864
865
866
867 ForceSendFields []string `json:"-"`
868
869
870
871
872 NullFields []string `json:"-"`
873 }
874
875 func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
876 type NoMethod SetIamPolicyRequest
877 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
878 }
879
880
881
882
883
884
885
886 type Status struct {
887
888 Code int64 `json:"code,omitempty"`
889
890
891 Details []googleapi.RawMessage `json:"details,omitempty"`
892
893
894
895 Message string `json:"message,omitempty"`
896
897
898
899
900
901 ForceSendFields []string `json:"-"`
902
903
904
905
906 NullFields []string `json:"-"`
907 }
908
909 func (s *Status) MarshalJSON() ([]byte, error) {
910 type NoMethod Status
911 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
912 }
913
914
915 type TestIamPermissionsRequest struct {
916
917
918
919
920 Permissions []string `json:"permissions,omitempty"`
921
922
923
924
925
926 ForceSendFields []string `json:"-"`
927
928
929
930
931 NullFields []string `json:"-"`
932 }
933
934 func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
935 type NoMethod TestIamPermissionsRequest
936 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
937 }
938
939
940
941 type TestIamPermissionsResponse struct {
942
943
944 Permissions []string `json:"permissions,omitempty"`
945
946
947 googleapi.ServerResponse `json:"-"`
948
949
950
951
952
953 ForceSendFields []string `json:"-"`
954
955
956
957
958 NullFields []string `json:"-"`
959 }
960
961 func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
962 type NoMethod TestIamPermissionsResponse
963 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
964 }
965
966
967
968 type Transport struct {
969
970
971 Pubsub *Pubsub `json:"pubsub,omitempty"`
972
973
974
975
976
977 ForceSendFields []string `json:"-"`
978
979
980
981
982 NullFields []string `json:"-"`
983 }
984
985 func (s *Transport) MarshalJSON() ([]byte, error) {
986 type NoMethod Transport
987 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
988 }
989
990
991 type Trigger struct {
992
993 CreateTime string `json:"createTime,omitempty"`
994
995
996 Destination *Destination `json:"destination,omitempty"`
997
998
999
1000 Etag string `json:"etag,omitempty"`
1001
1002
1003 Labels map[string]string `json:"labels,omitempty"`
1004
1005
1006
1007 MatchingCriteria []*MatchingCriteria `json:"matchingCriteria,omitempty"`
1008
1009
1010
1011 Name string `json:"name,omitempty"`
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023 ServiceAccount string `json:"serviceAccount,omitempty"`
1024
1025
1026
1027
1028 Transport *Transport `json:"transport,omitempty"`
1029
1030 UpdateTime string `json:"updateTime,omitempty"`
1031
1032
1033 googleapi.ServerResponse `json:"-"`
1034
1035
1036
1037
1038
1039 ForceSendFields []string `json:"-"`
1040
1041
1042
1043
1044 NullFields []string `json:"-"`
1045 }
1046
1047 func (s *Trigger) MarshalJSON() ([]byte, error) {
1048 type NoMethod Trigger
1049 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1050 }
1051
1052 type ProjectsLocationsGetCall struct {
1053 s *Service
1054 name string
1055 urlParams_ gensupport.URLParams
1056 ifNoneMatch_ string
1057 ctx_ context.Context
1058 header_ http.Header
1059 }
1060
1061
1062
1063
1064 func (r *ProjectsLocationsService) Get(name string) *ProjectsLocationsGetCall {
1065 c := &ProjectsLocationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1066 c.name = name
1067 return c
1068 }
1069
1070
1071
1072
1073 func (c *ProjectsLocationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsGetCall {
1074 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1075 return c
1076 }
1077
1078
1079
1080
1081 func (c *ProjectsLocationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsGetCall {
1082 c.ifNoneMatch_ = entityTag
1083 return c
1084 }
1085
1086
1087 func (c *ProjectsLocationsGetCall) Context(ctx context.Context) *ProjectsLocationsGetCall {
1088 c.ctx_ = ctx
1089 return c
1090 }
1091
1092
1093
1094 func (c *ProjectsLocationsGetCall) Header() http.Header {
1095 if c.header_ == nil {
1096 c.header_ = make(http.Header)
1097 }
1098 return c.header_
1099 }
1100
1101 func (c *ProjectsLocationsGetCall) doRequest(alt string) (*http.Response, error) {
1102 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1103 if c.ifNoneMatch_ != "" {
1104 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1105 }
1106 var body io.Reader = nil
1107 c.urlParams_.Set("alt", alt)
1108 c.urlParams_.Set("prettyPrint", "false")
1109 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
1110 urls += "?" + c.urlParams_.Encode()
1111 req, err := http.NewRequest("GET", urls, body)
1112 if err != nil {
1113 return nil, err
1114 }
1115 req.Header = reqHeaders
1116 googleapi.Expand(req.URL, map[string]string{
1117 "name": c.name,
1118 })
1119 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1120 }
1121
1122
1123
1124
1125
1126
1127 func (c *ProjectsLocationsGetCall) Do(opts ...googleapi.CallOption) (*Location, error) {
1128 gensupport.SetOptions(c.urlParams_, opts...)
1129 res, err := c.doRequest("json")
1130 if res != nil && res.StatusCode == http.StatusNotModified {
1131 if res.Body != nil {
1132 res.Body.Close()
1133 }
1134 return nil, gensupport.WrapError(&googleapi.Error{
1135 Code: res.StatusCode,
1136 Header: res.Header,
1137 })
1138 }
1139 if err != nil {
1140 return nil, err
1141 }
1142 defer googleapi.CloseBody(res)
1143 if err := googleapi.CheckResponse(res); err != nil {
1144 return nil, gensupport.WrapError(err)
1145 }
1146 ret := &Location{
1147 ServerResponse: googleapi.ServerResponse{
1148 Header: res.Header,
1149 HTTPStatusCode: res.StatusCode,
1150 },
1151 }
1152 target := &ret
1153 if err := gensupport.DecodeResponse(target, res); err != nil {
1154 return nil, err
1155 }
1156 return ret, nil
1157 }
1158
1159 type ProjectsLocationsListCall struct {
1160 s *Service
1161 name string
1162 urlParams_ gensupport.URLParams
1163 ifNoneMatch_ string
1164 ctx_ context.Context
1165 header_ http.Header
1166 }
1167
1168
1169
1170
1171 func (r *ProjectsLocationsService) List(name string) *ProjectsLocationsListCall {
1172 c := &ProjectsLocationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1173 c.name = name
1174 return c
1175 }
1176
1177
1178
1179
1180
1181 func (c *ProjectsLocationsListCall) Filter(filter string) *ProjectsLocationsListCall {
1182 c.urlParams_.Set("filter", filter)
1183 return c
1184 }
1185
1186
1187
1188 func (c *ProjectsLocationsListCall) PageSize(pageSize int64) *ProjectsLocationsListCall {
1189 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1190 return c
1191 }
1192
1193
1194
1195
1196 func (c *ProjectsLocationsListCall) PageToken(pageToken string) *ProjectsLocationsListCall {
1197 c.urlParams_.Set("pageToken", pageToken)
1198 return c
1199 }
1200
1201
1202
1203
1204 func (c *ProjectsLocationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsListCall {
1205 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1206 return c
1207 }
1208
1209
1210
1211
1212 func (c *ProjectsLocationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsListCall {
1213 c.ifNoneMatch_ = entityTag
1214 return c
1215 }
1216
1217
1218 func (c *ProjectsLocationsListCall) Context(ctx context.Context) *ProjectsLocationsListCall {
1219 c.ctx_ = ctx
1220 return c
1221 }
1222
1223
1224
1225 func (c *ProjectsLocationsListCall) Header() http.Header {
1226 if c.header_ == nil {
1227 c.header_ = make(http.Header)
1228 }
1229 return c.header_
1230 }
1231
1232 func (c *ProjectsLocationsListCall) doRequest(alt string) (*http.Response, error) {
1233 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1234 if c.ifNoneMatch_ != "" {
1235 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1236 }
1237 var body io.Reader = nil
1238 c.urlParams_.Set("alt", alt)
1239 c.urlParams_.Set("prettyPrint", "false")
1240 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}/locations")
1241 urls += "?" + c.urlParams_.Encode()
1242 req, err := http.NewRequest("GET", urls, body)
1243 if err != nil {
1244 return nil, err
1245 }
1246 req.Header = reqHeaders
1247 googleapi.Expand(req.URL, map[string]string{
1248 "name": c.name,
1249 })
1250 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1251 }
1252
1253
1254
1255
1256
1257
1258
1259 func (c *ProjectsLocationsListCall) Do(opts ...googleapi.CallOption) (*ListLocationsResponse, error) {
1260 gensupport.SetOptions(c.urlParams_, opts...)
1261 res, err := c.doRequest("json")
1262 if res != nil && res.StatusCode == http.StatusNotModified {
1263 if res.Body != nil {
1264 res.Body.Close()
1265 }
1266 return nil, gensupport.WrapError(&googleapi.Error{
1267 Code: res.StatusCode,
1268 Header: res.Header,
1269 })
1270 }
1271 if err != nil {
1272 return nil, err
1273 }
1274 defer googleapi.CloseBody(res)
1275 if err := googleapi.CheckResponse(res); err != nil {
1276 return nil, gensupport.WrapError(err)
1277 }
1278 ret := &ListLocationsResponse{
1279 ServerResponse: googleapi.ServerResponse{
1280 Header: res.Header,
1281 HTTPStatusCode: res.StatusCode,
1282 },
1283 }
1284 target := &ret
1285 if err := gensupport.DecodeResponse(target, res); err != nil {
1286 return nil, err
1287 }
1288 return ret, nil
1289 }
1290
1291
1292
1293
1294 func (c *ProjectsLocationsListCall) Pages(ctx context.Context, f func(*ListLocationsResponse) error) error {
1295 c.ctx_ = ctx
1296 defer c.PageToken(c.urlParams_.Get("pageToken"))
1297 for {
1298 x, err := c.Do()
1299 if err != nil {
1300 return err
1301 }
1302 if err := f(x); err != nil {
1303 return err
1304 }
1305 if x.NextPageToken == "" {
1306 return nil
1307 }
1308 c.PageToken(x.NextPageToken)
1309 }
1310 }
1311
1312 type ProjectsLocationsOperationsCancelCall struct {
1313 s *Service
1314 name string
1315 canceloperationrequest *CancelOperationRequest
1316 urlParams_ gensupport.URLParams
1317 ctx_ context.Context
1318 header_ http.Header
1319 }
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332 func (r *ProjectsLocationsOperationsService) Cancel(name string, canceloperationrequest *CancelOperationRequest) *ProjectsLocationsOperationsCancelCall {
1333 c := &ProjectsLocationsOperationsCancelCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1334 c.name = name
1335 c.canceloperationrequest = canceloperationrequest
1336 return c
1337 }
1338
1339
1340
1341
1342 func (c *ProjectsLocationsOperationsCancelCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsCancelCall {
1343 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1344 return c
1345 }
1346
1347
1348 func (c *ProjectsLocationsOperationsCancelCall) Context(ctx context.Context) *ProjectsLocationsOperationsCancelCall {
1349 c.ctx_ = ctx
1350 return c
1351 }
1352
1353
1354
1355 func (c *ProjectsLocationsOperationsCancelCall) Header() http.Header {
1356 if c.header_ == nil {
1357 c.header_ = make(http.Header)
1358 }
1359 return c.header_
1360 }
1361
1362 func (c *ProjectsLocationsOperationsCancelCall) doRequest(alt string) (*http.Response, error) {
1363 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1364 var body io.Reader = nil
1365 body, err := googleapi.WithoutDataWrapper.JSONReader(c.canceloperationrequest)
1366 if err != nil {
1367 return nil, err
1368 }
1369 c.urlParams_.Set("alt", alt)
1370 c.urlParams_.Set("prettyPrint", "false")
1371 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}:cancel")
1372 urls += "?" + c.urlParams_.Encode()
1373 req, err := http.NewRequest("POST", urls, body)
1374 if err != nil {
1375 return nil, err
1376 }
1377 req.Header = reqHeaders
1378 googleapi.Expand(req.URL, map[string]string{
1379 "name": c.name,
1380 })
1381 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1382 }
1383
1384
1385
1386
1387
1388
1389 func (c *ProjectsLocationsOperationsCancelCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1390 gensupport.SetOptions(c.urlParams_, opts...)
1391 res, err := c.doRequest("json")
1392 if res != nil && res.StatusCode == http.StatusNotModified {
1393 if res.Body != nil {
1394 res.Body.Close()
1395 }
1396 return nil, gensupport.WrapError(&googleapi.Error{
1397 Code: res.StatusCode,
1398 Header: res.Header,
1399 })
1400 }
1401 if err != nil {
1402 return nil, err
1403 }
1404 defer googleapi.CloseBody(res)
1405 if err := googleapi.CheckResponse(res); err != nil {
1406 return nil, gensupport.WrapError(err)
1407 }
1408 ret := &Empty{
1409 ServerResponse: googleapi.ServerResponse{
1410 Header: res.Header,
1411 HTTPStatusCode: res.StatusCode,
1412 },
1413 }
1414 target := &ret
1415 if err := gensupport.DecodeResponse(target, res); err != nil {
1416 return nil, err
1417 }
1418 return ret, nil
1419 }
1420
1421 type ProjectsLocationsOperationsDeleteCall struct {
1422 s *Service
1423 name string
1424 urlParams_ gensupport.URLParams
1425 ctx_ context.Context
1426 header_ http.Header
1427 }
1428
1429
1430
1431
1432
1433
1434
1435 func (r *ProjectsLocationsOperationsService) Delete(name string) *ProjectsLocationsOperationsDeleteCall {
1436 c := &ProjectsLocationsOperationsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1437 c.name = name
1438 return c
1439 }
1440
1441
1442
1443
1444 func (c *ProjectsLocationsOperationsDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsDeleteCall {
1445 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1446 return c
1447 }
1448
1449
1450 func (c *ProjectsLocationsOperationsDeleteCall) Context(ctx context.Context) *ProjectsLocationsOperationsDeleteCall {
1451 c.ctx_ = ctx
1452 return c
1453 }
1454
1455
1456
1457 func (c *ProjectsLocationsOperationsDeleteCall) Header() http.Header {
1458 if c.header_ == nil {
1459 c.header_ = make(http.Header)
1460 }
1461 return c.header_
1462 }
1463
1464 func (c *ProjectsLocationsOperationsDeleteCall) doRequest(alt string) (*http.Response, error) {
1465 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1466 var body io.Reader = nil
1467 c.urlParams_.Set("alt", alt)
1468 c.urlParams_.Set("prettyPrint", "false")
1469 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
1470 urls += "?" + c.urlParams_.Encode()
1471 req, err := http.NewRequest("DELETE", urls, body)
1472 if err != nil {
1473 return nil, err
1474 }
1475 req.Header = reqHeaders
1476 googleapi.Expand(req.URL, map[string]string{
1477 "name": c.name,
1478 })
1479 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1480 }
1481
1482
1483
1484
1485
1486
1487 func (c *ProjectsLocationsOperationsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1488 gensupport.SetOptions(c.urlParams_, opts...)
1489 res, err := c.doRequest("json")
1490 if res != nil && res.StatusCode == http.StatusNotModified {
1491 if res.Body != nil {
1492 res.Body.Close()
1493 }
1494 return nil, gensupport.WrapError(&googleapi.Error{
1495 Code: res.StatusCode,
1496 Header: res.Header,
1497 })
1498 }
1499 if err != nil {
1500 return nil, err
1501 }
1502 defer googleapi.CloseBody(res)
1503 if err := googleapi.CheckResponse(res); err != nil {
1504 return nil, gensupport.WrapError(err)
1505 }
1506 ret := &Empty{
1507 ServerResponse: googleapi.ServerResponse{
1508 Header: res.Header,
1509 HTTPStatusCode: res.StatusCode,
1510 },
1511 }
1512 target := &ret
1513 if err := gensupport.DecodeResponse(target, res); err != nil {
1514 return nil, err
1515 }
1516 return ret, nil
1517 }
1518
1519 type ProjectsLocationsOperationsGetCall struct {
1520 s *Service
1521 name string
1522 urlParams_ gensupport.URLParams
1523 ifNoneMatch_ string
1524 ctx_ context.Context
1525 header_ http.Header
1526 }
1527
1528
1529
1530
1531
1532
1533 func (r *ProjectsLocationsOperationsService) Get(name string) *ProjectsLocationsOperationsGetCall {
1534 c := &ProjectsLocationsOperationsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1535 c.name = name
1536 return c
1537 }
1538
1539
1540
1541
1542 func (c *ProjectsLocationsOperationsGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsGetCall {
1543 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1544 return c
1545 }
1546
1547
1548
1549
1550 func (c *ProjectsLocationsOperationsGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsGetCall {
1551 c.ifNoneMatch_ = entityTag
1552 return c
1553 }
1554
1555
1556 func (c *ProjectsLocationsOperationsGetCall) Context(ctx context.Context) *ProjectsLocationsOperationsGetCall {
1557 c.ctx_ = ctx
1558 return c
1559 }
1560
1561
1562
1563 func (c *ProjectsLocationsOperationsGetCall) Header() http.Header {
1564 if c.header_ == nil {
1565 c.header_ = make(http.Header)
1566 }
1567 return c.header_
1568 }
1569
1570 func (c *ProjectsLocationsOperationsGetCall) doRequest(alt string) (*http.Response, error) {
1571 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1572 if c.ifNoneMatch_ != "" {
1573 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1574 }
1575 var body io.Reader = nil
1576 c.urlParams_.Set("alt", alt)
1577 c.urlParams_.Set("prettyPrint", "false")
1578 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
1579 urls += "?" + c.urlParams_.Encode()
1580 req, err := http.NewRequest("GET", urls, body)
1581 if err != nil {
1582 return nil, err
1583 }
1584 req.Header = reqHeaders
1585 googleapi.Expand(req.URL, map[string]string{
1586 "name": c.name,
1587 })
1588 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1589 }
1590
1591
1592
1593
1594
1595
1596 func (c *ProjectsLocationsOperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1597 gensupport.SetOptions(c.urlParams_, opts...)
1598 res, err := c.doRequest("json")
1599 if res != nil && res.StatusCode == http.StatusNotModified {
1600 if res.Body != nil {
1601 res.Body.Close()
1602 }
1603 return nil, gensupport.WrapError(&googleapi.Error{
1604 Code: res.StatusCode,
1605 Header: res.Header,
1606 })
1607 }
1608 if err != nil {
1609 return nil, err
1610 }
1611 defer googleapi.CloseBody(res)
1612 if err := googleapi.CheckResponse(res); err != nil {
1613 return nil, gensupport.WrapError(err)
1614 }
1615 ret := &Operation{
1616 ServerResponse: googleapi.ServerResponse{
1617 Header: res.Header,
1618 HTTPStatusCode: res.StatusCode,
1619 },
1620 }
1621 target := &ret
1622 if err := gensupport.DecodeResponse(target, res); err != nil {
1623 return nil, err
1624 }
1625 return ret, nil
1626 }
1627
1628 type ProjectsLocationsOperationsListCall struct {
1629 s *Service
1630 name string
1631 urlParams_ gensupport.URLParams
1632 ifNoneMatch_ string
1633 ctx_ context.Context
1634 header_ http.Header
1635 }
1636
1637
1638
1639
1640
1641 func (r *ProjectsLocationsOperationsService) List(name string) *ProjectsLocationsOperationsListCall {
1642 c := &ProjectsLocationsOperationsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1643 c.name = name
1644 return c
1645 }
1646
1647
1648 func (c *ProjectsLocationsOperationsListCall) Filter(filter string) *ProjectsLocationsOperationsListCall {
1649 c.urlParams_.Set("filter", filter)
1650 return c
1651 }
1652
1653
1654
1655 func (c *ProjectsLocationsOperationsListCall) PageSize(pageSize int64) *ProjectsLocationsOperationsListCall {
1656 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1657 return c
1658 }
1659
1660
1661
1662 func (c *ProjectsLocationsOperationsListCall) PageToken(pageToken string) *ProjectsLocationsOperationsListCall {
1663 c.urlParams_.Set("pageToken", pageToken)
1664 return c
1665 }
1666
1667
1668
1669
1670 func (c *ProjectsLocationsOperationsListCall) Fields(s ...googleapi.Field) *ProjectsLocationsOperationsListCall {
1671 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1672 return c
1673 }
1674
1675
1676
1677
1678 func (c *ProjectsLocationsOperationsListCall) IfNoneMatch(entityTag string) *ProjectsLocationsOperationsListCall {
1679 c.ifNoneMatch_ = entityTag
1680 return c
1681 }
1682
1683
1684 func (c *ProjectsLocationsOperationsListCall) Context(ctx context.Context) *ProjectsLocationsOperationsListCall {
1685 c.ctx_ = ctx
1686 return c
1687 }
1688
1689
1690
1691 func (c *ProjectsLocationsOperationsListCall) Header() http.Header {
1692 if c.header_ == nil {
1693 c.header_ = make(http.Header)
1694 }
1695 return c.header_
1696 }
1697
1698 func (c *ProjectsLocationsOperationsListCall) doRequest(alt string) (*http.Response, error) {
1699 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1700 if c.ifNoneMatch_ != "" {
1701 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1702 }
1703 var body io.Reader = nil
1704 c.urlParams_.Set("alt", alt)
1705 c.urlParams_.Set("prettyPrint", "false")
1706 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}/operations")
1707 urls += "?" + c.urlParams_.Encode()
1708 req, err := http.NewRequest("GET", urls, body)
1709 if err != nil {
1710 return nil, err
1711 }
1712 req.Header = reqHeaders
1713 googleapi.Expand(req.URL, map[string]string{
1714 "name": c.name,
1715 })
1716 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1717 }
1718
1719
1720
1721
1722
1723
1724
1725 func (c *ProjectsLocationsOperationsListCall) Do(opts ...googleapi.CallOption) (*ListOperationsResponse, error) {
1726 gensupport.SetOptions(c.urlParams_, opts...)
1727 res, err := c.doRequest("json")
1728 if res != nil && res.StatusCode == http.StatusNotModified {
1729 if res.Body != nil {
1730 res.Body.Close()
1731 }
1732 return nil, gensupport.WrapError(&googleapi.Error{
1733 Code: res.StatusCode,
1734 Header: res.Header,
1735 })
1736 }
1737 if err != nil {
1738 return nil, err
1739 }
1740 defer googleapi.CloseBody(res)
1741 if err := googleapi.CheckResponse(res); err != nil {
1742 return nil, gensupport.WrapError(err)
1743 }
1744 ret := &ListOperationsResponse{
1745 ServerResponse: googleapi.ServerResponse{
1746 Header: res.Header,
1747 HTTPStatusCode: res.StatusCode,
1748 },
1749 }
1750 target := &ret
1751 if err := gensupport.DecodeResponse(target, res); err != nil {
1752 return nil, err
1753 }
1754 return ret, nil
1755 }
1756
1757
1758
1759
1760 func (c *ProjectsLocationsOperationsListCall) Pages(ctx context.Context, f func(*ListOperationsResponse) error) error {
1761 c.ctx_ = ctx
1762 defer c.PageToken(c.urlParams_.Get("pageToken"))
1763 for {
1764 x, err := c.Do()
1765 if err != nil {
1766 return err
1767 }
1768 if err := f(x); err != nil {
1769 return err
1770 }
1771 if x.NextPageToken == "" {
1772 return nil
1773 }
1774 c.PageToken(x.NextPageToken)
1775 }
1776 }
1777
1778 type ProjectsLocationsTriggersCreateCall struct {
1779 s *Service
1780 parent string
1781 trigger *Trigger
1782 urlParams_ gensupport.URLParams
1783 ctx_ context.Context
1784 header_ http.Header
1785 }
1786
1787
1788
1789
1790 func (r *ProjectsLocationsTriggersService) Create(parent string, trigger *Trigger) *ProjectsLocationsTriggersCreateCall {
1791 c := &ProjectsLocationsTriggersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1792 c.parent = parent
1793 c.trigger = trigger
1794 return c
1795 }
1796
1797
1798
1799 func (c *ProjectsLocationsTriggersCreateCall) TriggerId(triggerId string) *ProjectsLocationsTriggersCreateCall {
1800 c.urlParams_.Set("triggerId", triggerId)
1801 return c
1802 }
1803
1804
1805
1806 func (c *ProjectsLocationsTriggersCreateCall) ValidateOnly(validateOnly bool) *ProjectsLocationsTriggersCreateCall {
1807 c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
1808 return c
1809 }
1810
1811
1812
1813
1814 func (c *ProjectsLocationsTriggersCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsTriggersCreateCall {
1815 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1816 return c
1817 }
1818
1819
1820 func (c *ProjectsLocationsTriggersCreateCall) Context(ctx context.Context) *ProjectsLocationsTriggersCreateCall {
1821 c.ctx_ = ctx
1822 return c
1823 }
1824
1825
1826
1827 func (c *ProjectsLocationsTriggersCreateCall) Header() http.Header {
1828 if c.header_ == nil {
1829 c.header_ = make(http.Header)
1830 }
1831 return c.header_
1832 }
1833
1834 func (c *ProjectsLocationsTriggersCreateCall) doRequest(alt string) (*http.Response, error) {
1835 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1836 var body io.Reader = nil
1837 body, err := googleapi.WithoutDataWrapper.JSONReader(c.trigger)
1838 if err != nil {
1839 return nil, err
1840 }
1841 c.urlParams_.Set("alt", alt)
1842 c.urlParams_.Set("prettyPrint", "false")
1843 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/triggers")
1844 urls += "?" + c.urlParams_.Encode()
1845 req, err := http.NewRequest("POST", urls, body)
1846 if err != nil {
1847 return nil, err
1848 }
1849 req.Header = reqHeaders
1850 googleapi.Expand(req.URL, map[string]string{
1851 "parent": c.parent,
1852 })
1853 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1854 }
1855
1856
1857
1858
1859
1860
1861 func (c *ProjectsLocationsTriggersCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1862 gensupport.SetOptions(c.urlParams_, opts...)
1863 res, err := c.doRequest("json")
1864 if res != nil && res.StatusCode == http.StatusNotModified {
1865 if res.Body != nil {
1866 res.Body.Close()
1867 }
1868 return nil, gensupport.WrapError(&googleapi.Error{
1869 Code: res.StatusCode,
1870 Header: res.Header,
1871 })
1872 }
1873 if err != nil {
1874 return nil, err
1875 }
1876 defer googleapi.CloseBody(res)
1877 if err := googleapi.CheckResponse(res); err != nil {
1878 return nil, gensupport.WrapError(err)
1879 }
1880 ret := &Operation{
1881 ServerResponse: googleapi.ServerResponse{
1882 Header: res.Header,
1883 HTTPStatusCode: res.StatusCode,
1884 },
1885 }
1886 target := &ret
1887 if err := gensupport.DecodeResponse(target, res); err != nil {
1888 return nil, err
1889 }
1890 return ret, nil
1891 }
1892
1893 type ProjectsLocationsTriggersDeleteCall struct {
1894 s *Service
1895 name string
1896 urlParams_ gensupport.URLParams
1897 ctx_ context.Context
1898 header_ http.Header
1899 }
1900
1901
1902
1903
1904 func (r *ProjectsLocationsTriggersService) Delete(name string) *ProjectsLocationsTriggersDeleteCall {
1905 c := &ProjectsLocationsTriggersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1906 c.name = name
1907 return c
1908 }
1909
1910
1911
1912
1913 func (c *ProjectsLocationsTriggersDeleteCall) AllowMissing(allowMissing bool) *ProjectsLocationsTriggersDeleteCall {
1914 c.urlParams_.Set("allowMissing", fmt.Sprint(allowMissing))
1915 return c
1916 }
1917
1918
1919
1920 func (c *ProjectsLocationsTriggersDeleteCall) Etag(etag string) *ProjectsLocationsTriggersDeleteCall {
1921 c.urlParams_.Set("etag", etag)
1922 return c
1923 }
1924
1925
1926
1927 func (c *ProjectsLocationsTriggersDeleteCall) ValidateOnly(validateOnly bool) *ProjectsLocationsTriggersDeleteCall {
1928 c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
1929 return c
1930 }
1931
1932
1933
1934
1935 func (c *ProjectsLocationsTriggersDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsTriggersDeleteCall {
1936 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1937 return c
1938 }
1939
1940
1941 func (c *ProjectsLocationsTriggersDeleteCall) Context(ctx context.Context) *ProjectsLocationsTriggersDeleteCall {
1942 c.ctx_ = ctx
1943 return c
1944 }
1945
1946
1947
1948 func (c *ProjectsLocationsTriggersDeleteCall) Header() http.Header {
1949 if c.header_ == nil {
1950 c.header_ = make(http.Header)
1951 }
1952 return c.header_
1953 }
1954
1955 func (c *ProjectsLocationsTriggersDeleteCall) doRequest(alt string) (*http.Response, error) {
1956 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1957 var body io.Reader = nil
1958 c.urlParams_.Set("alt", alt)
1959 c.urlParams_.Set("prettyPrint", "false")
1960 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
1961 urls += "?" + c.urlParams_.Encode()
1962 req, err := http.NewRequest("DELETE", urls, body)
1963 if err != nil {
1964 return nil, err
1965 }
1966 req.Header = reqHeaders
1967 googleapi.Expand(req.URL, map[string]string{
1968 "name": c.name,
1969 })
1970 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1971 }
1972
1973
1974
1975
1976
1977
1978 func (c *ProjectsLocationsTriggersDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
1979 gensupport.SetOptions(c.urlParams_, opts...)
1980 res, err := c.doRequest("json")
1981 if res != nil && res.StatusCode == http.StatusNotModified {
1982 if res.Body != nil {
1983 res.Body.Close()
1984 }
1985 return nil, gensupport.WrapError(&googleapi.Error{
1986 Code: res.StatusCode,
1987 Header: res.Header,
1988 })
1989 }
1990 if err != nil {
1991 return nil, err
1992 }
1993 defer googleapi.CloseBody(res)
1994 if err := googleapi.CheckResponse(res); err != nil {
1995 return nil, gensupport.WrapError(err)
1996 }
1997 ret := &Operation{
1998 ServerResponse: googleapi.ServerResponse{
1999 Header: res.Header,
2000 HTTPStatusCode: res.StatusCode,
2001 },
2002 }
2003 target := &ret
2004 if err := gensupport.DecodeResponse(target, res); err != nil {
2005 return nil, err
2006 }
2007 return ret, nil
2008 }
2009
2010 type ProjectsLocationsTriggersGetCall struct {
2011 s *Service
2012 name string
2013 urlParams_ gensupport.URLParams
2014 ifNoneMatch_ string
2015 ctx_ context.Context
2016 header_ http.Header
2017 }
2018
2019
2020
2021
2022 func (r *ProjectsLocationsTriggersService) Get(name string) *ProjectsLocationsTriggersGetCall {
2023 c := &ProjectsLocationsTriggersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2024 c.name = name
2025 return c
2026 }
2027
2028
2029
2030
2031 func (c *ProjectsLocationsTriggersGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsTriggersGetCall {
2032 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2033 return c
2034 }
2035
2036
2037
2038
2039 func (c *ProjectsLocationsTriggersGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsTriggersGetCall {
2040 c.ifNoneMatch_ = entityTag
2041 return c
2042 }
2043
2044
2045 func (c *ProjectsLocationsTriggersGetCall) Context(ctx context.Context) *ProjectsLocationsTriggersGetCall {
2046 c.ctx_ = ctx
2047 return c
2048 }
2049
2050
2051
2052 func (c *ProjectsLocationsTriggersGetCall) Header() http.Header {
2053 if c.header_ == nil {
2054 c.header_ = make(http.Header)
2055 }
2056 return c.header_
2057 }
2058
2059 func (c *ProjectsLocationsTriggersGetCall) doRequest(alt string) (*http.Response, error) {
2060 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2061 if c.ifNoneMatch_ != "" {
2062 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2063 }
2064 var body io.Reader = nil
2065 c.urlParams_.Set("alt", alt)
2066 c.urlParams_.Set("prettyPrint", "false")
2067 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
2068 urls += "?" + c.urlParams_.Encode()
2069 req, err := http.NewRequest("GET", urls, body)
2070 if err != nil {
2071 return nil, err
2072 }
2073 req.Header = reqHeaders
2074 googleapi.Expand(req.URL, map[string]string{
2075 "name": c.name,
2076 })
2077 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2078 }
2079
2080
2081
2082
2083
2084
2085 func (c *ProjectsLocationsTriggersGetCall) Do(opts ...googleapi.CallOption) (*Trigger, error) {
2086 gensupport.SetOptions(c.urlParams_, opts...)
2087 res, err := c.doRequest("json")
2088 if res != nil && res.StatusCode == http.StatusNotModified {
2089 if res.Body != nil {
2090 res.Body.Close()
2091 }
2092 return nil, gensupport.WrapError(&googleapi.Error{
2093 Code: res.StatusCode,
2094 Header: res.Header,
2095 })
2096 }
2097 if err != nil {
2098 return nil, err
2099 }
2100 defer googleapi.CloseBody(res)
2101 if err := googleapi.CheckResponse(res); err != nil {
2102 return nil, gensupport.WrapError(err)
2103 }
2104 ret := &Trigger{
2105 ServerResponse: googleapi.ServerResponse{
2106 Header: res.Header,
2107 HTTPStatusCode: res.StatusCode,
2108 },
2109 }
2110 target := &ret
2111 if err := gensupport.DecodeResponse(target, res); err != nil {
2112 return nil, err
2113 }
2114 return ret, nil
2115 }
2116
2117 type ProjectsLocationsTriggersGetIamPolicyCall struct {
2118 s *Service
2119 resource string
2120 urlParams_ gensupport.URLParams
2121 ifNoneMatch_ string
2122 ctx_ context.Context
2123 header_ http.Header
2124 }
2125
2126
2127
2128
2129
2130
2131
2132 func (r *ProjectsLocationsTriggersService) GetIamPolicy(resource string) *ProjectsLocationsTriggersGetIamPolicyCall {
2133 c := &ProjectsLocationsTriggersGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2134 c.resource = resource
2135 return c
2136 }
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150 func (c *ProjectsLocationsTriggersGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsLocationsTriggersGetIamPolicyCall {
2151 c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion))
2152 return c
2153 }
2154
2155
2156
2157
2158 func (c *ProjectsLocationsTriggersGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsTriggersGetIamPolicyCall {
2159 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2160 return c
2161 }
2162
2163
2164
2165
2166 func (c *ProjectsLocationsTriggersGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsLocationsTriggersGetIamPolicyCall {
2167 c.ifNoneMatch_ = entityTag
2168 return c
2169 }
2170
2171
2172 func (c *ProjectsLocationsTriggersGetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsTriggersGetIamPolicyCall {
2173 c.ctx_ = ctx
2174 return c
2175 }
2176
2177
2178
2179 func (c *ProjectsLocationsTriggersGetIamPolicyCall) Header() http.Header {
2180 if c.header_ == nil {
2181 c.header_ = make(http.Header)
2182 }
2183 return c.header_
2184 }
2185
2186 func (c *ProjectsLocationsTriggersGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
2187 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2188 if c.ifNoneMatch_ != "" {
2189 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2190 }
2191 var body io.Reader = nil
2192 c.urlParams_.Set("alt", alt)
2193 c.urlParams_.Set("prettyPrint", "false")
2194 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:getIamPolicy")
2195 urls += "?" + c.urlParams_.Encode()
2196 req, err := http.NewRequest("GET", urls, body)
2197 if err != nil {
2198 return nil, err
2199 }
2200 req.Header = reqHeaders
2201 googleapi.Expand(req.URL, map[string]string{
2202 "resource": c.resource,
2203 })
2204 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2205 }
2206
2207
2208
2209
2210
2211
2212 func (c *ProjectsLocationsTriggersGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
2213 gensupport.SetOptions(c.urlParams_, opts...)
2214 res, err := c.doRequest("json")
2215 if res != nil && res.StatusCode == http.StatusNotModified {
2216 if res.Body != nil {
2217 res.Body.Close()
2218 }
2219 return nil, gensupport.WrapError(&googleapi.Error{
2220 Code: res.StatusCode,
2221 Header: res.Header,
2222 })
2223 }
2224 if err != nil {
2225 return nil, err
2226 }
2227 defer googleapi.CloseBody(res)
2228 if err := googleapi.CheckResponse(res); err != nil {
2229 return nil, gensupport.WrapError(err)
2230 }
2231 ret := &Policy{
2232 ServerResponse: googleapi.ServerResponse{
2233 Header: res.Header,
2234 HTTPStatusCode: res.StatusCode,
2235 },
2236 }
2237 target := &ret
2238 if err := gensupport.DecodeResponse(target, res); err != nil {
2239 return nil, err
2240 }
2241 return ret, nil
2242 }
2243
2244 type ProjectsLocationsTriggersListCall struct {
2245 s *Service
2246 parent string
2247 urlParams_ gensupport.URLParams
2248 ifNoneMatch_ string
2249 ctx_ context.Context
2250 header_ http.Header
2251 }
2252
2253
2254
2255
2256 func (r *ProjectsLocationsTriggersService) List(parent string) *ProjectsLocationsTriggersListCall {
2257 c := &ProjectsLocationsTriggersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2258 c.parent = parent
2259 return c
2260 }
2261
2262
2263
2264
2265
2266 func (c *ProjectsLocationsTriggersListCall) OrderBy(orderBy string) *ProjectsLocationsTriggersListCall {
2267 c.urlParams_.Set("orderBy", orderBy)
2268 return c
2269 }
2270
2271
2272
2273 func (c *ProjectsLocationsTriggersListCall) PageSize(pageSize int64) *ProjectsLocationsTriggersListCall {
2274 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
2275 return c
2276 }
2277
2278
2279
2280
2281
2282 func (c *ProjectsLocationsTriggersListCall) PageToken(pageToken string) *ProjectsLocationsTriggersListCall {
2283 c.urlParams_.Set("pageToken", pageToken)
2284 return c
2285 }
2286
2287
2288
2289
2290 func (c *ProjectsLocationsTriggersListCall) Fields(s ...googleapi.Field) *ProjectsLocationsTriggersListCall {
2291 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2292 return c
2293 }
2294
2295
2296
2297
2298 func (c *ProjectsLocationsTriggersListCall) IfNoneMatch(entityTag string) *ProjectsLocationsTriggersListCall {
2299 c.ifNoneMatch_ = entityTag
2300 return c
2301 }
2302
2303
2304 func (c *ProjectsLocationsTriggersListCall) Context(ctx context.Context) *ProjectsLocationsTriggersListCall {
2305 c.ctx_ = ctx
2306 return c
2307 }
2308
2309
2310
2311 func (c *ProjectsLocationsTriggersListCall) Header() http.Header {
2312 if c.header_ == nil {
2313 c.header_ = make(http.Header)
2314 }
2315 return c.header_
2316 }
2317
2318 func (c *ProjectsLocationsTriggersListCall) doRequest(alt string) (*http.Response, error) {
2319 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2320 if c.ifNoneMatch_ != "" {
2321 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2322 }
2323 var body io.Reader = nil
2324 c.urlParams_.Set("alt", alt)
2325 c.urlParams_.Set("prettyPrint", "false")
2326 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+parent}/triggers")
2327 urls += "?" + c.urlParams_.Encode()
2328 req, err := http.NewRequest("GET", urls, body)
2329 if err != nil {
2330 return nil, err
2331 }
2332 req.Header = reqHeaders
2333 googleapi.Expand(req.URL, map[string]string{
2334 "parent": c.parent,
2335 })
2336 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2337 }
2338
2339
2340
2341
2342
2343
2344
2345 func (c *ProjectsLocationsTriggersListCall) Do(opts ...googleapi.CallOption) (*ListTriggersResponse, error) {
2346 gensupport.SetOptions(c.urlParams_, opts...)
2347 res, err := c.doRequest("json")
2348 if res != nil && res.StatusCode == http.StatusNotModified {
2349 if res.Body != nil {
2350 res.Body.Close()
2351 }
2352 return nil, gensupport.WrapError(&googleapi.Error{
2353 Code: res.StatusCode,
2354 Header: res.Header,
2355 })
2356 }
2357 if err != nil {
2358 return nil, err
2359 }
2360 defer googleapi.CloseBody(res)
2361 if err := googleapi.CheckResponse(res); err != nil {
2362 return nil, gensupport.WrapError(err)
2363 }
2364 ret := &ListTriggersResponse{
2365 ServerResponse: googleapi.ServerResponse{
2366 Header: res.Header,
2367 HTTPStatusCode: res.StatusCode,
2368 },
2369 }
2370 target := &ret
2371 if err := gensupport.DecodeResponse(target, res); err != nil {
2372 return nil, err
2373 }
2374 return ret, nil
2375 }
2376
2377
2378
2379
2380 func (c *ProjectsLocationsTriggersListCall) Pages(ctx context.Context, f func(*ListTriggersResponse) error) error {
2381 c.ctx_ = ctx
2382 defer c.PageToken(c.urlParams_.Get("pageToken"))
2383 for {
2384 x, err := c.Do()
2385 if err != nil {
2386 return err
2387 }
2388 if err := f(x); err != nil {
2389 return err
2390 }
2391 if x.NextPageToken == "" {
2392 return nil
2393 }
2394 c.PageToken(x.NextPageToken)
2395 }
2396 }
2397
2398 type ProjectsLocationsTriggersPatchCall struct {
2399 s *Service
2400 name string
2401 trigger *Trigger
2402 urlParams_ gensupport.URLParams
2403 ctx_ context.Context
2404 header_ http.Header
2405 }
2406
2407
2408
2409
2410
2411
2412 func (r *ProjectsLocationsTriggersService) Patch(name string, trigger *Trigger) *ProjectsLocationsTriggersPatchCall {
2413 c := &ProjectsLocationsTriggersPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2414 c.name = name
2415 c.trigger = trigger
2416 return c
2417 }
2418
2419
2420
2421
2422 func (c *ProjectsLocationsTriggersPatchCall) AllowMissing(allowMissing bool) *ProjectsLocationsTriggersPatchCall {
2423 c.urlParams_.Set("allowMissing", fmt.Sprint(allowMissing))
2424 return c
2425 }
2426
2427
2428
2429
2430
2431 func (c *ProjectsLocationsTriggersPatchCall) UpdateMask(updateMask string) *ProjectsLocationsTriggersPatchCall {
2432 c.urlParams_.Set("updateMask", updateMask)
2433 return c
2434 }
2435
2436
2437
2438 func (c *ProjectsLocationsTriggersPatchCall) ValidateOnly(validateOnly bool) *ProjectsLocationsTriggersPatchCall {
2439 c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
2440 return c
2441 }
2442
2443
2444
2445
2446 func (c *ProjectsLocationsTriggersPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsTriggersPatchCall {
2447 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2448 return c
2449 }
2450
2451
2452 func (c *ProjectsLocationsTriggersPatchCall) Context(ctx context.Context) *ProjectsLocationsTriggersPatchCall {
2453 c.ctx_ = ctx
2454 return c
2455 }
2456
2457
2458
2459 func (c *ProjectsLocationsTriggersPatchCall) Header() http.Header {
2460 if c.header_ == nil {
2461 c.header_ = make(http.Header)
2462 }
2463 return c.header_
2464 }
2465
2466 func (c *ProjectsLocationsTriggersPatchCall) doRequest(alt string) (*http.Response, error) {
2467 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2468 var body io.Reader = nil
2469 body, err := googleapi.WithoutDataWrapper.JSONReader(c.trigger)
2470 if err != nil {
2471 return nil, err
2472 }
2473 c.urlParams_.Set("alt", alt)
2474 c.urlParams_.Set("prettyPrint", "false")
2475 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+name}")
2476 urls += "?" + c.urlParams_.Encode()
2477 req, err := http.NewRequest("PATCH", urls, body)
2478 if err != nil {
2479 return nil, err
2480 }
2481 req.Header = reqHeaders
2482 googleapi.Expand(req.URL, map[string]string{
2483 "name": c.name,
2484 })
2485 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2486 }
2487
2488
2489
2490
2491
2492
2493 func (c *ProjectsLocationsTriggersPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error) {
2494 gensupport.SetOptions(c.urlParams_, opts...)
2495 res, err := c.doRequest("json")
2496 if res != nil && res.StatusCode == http.StatusNotModified {
2497 if res.Body != nil {
2498 res.Body.Close()
2499 }
2500 return nil, gensupport.WrapError(&googleapi.Error{
2501 Code: res.StatusCode,
2502 Header: res.Header,
2503 })
2504 }
2505 if err != nil {
2506 return nil, err
2507 }
2508 defer googleapi.CloseBody(res)
2509 if err := googleapi.CheckResponse(res); err != nil {
2510 return nil, gensupport.WrapError(err)
2511 }
2512 ret := &Operation{
2513 ServerResponse: googleapi.ServerResponse{
2514 Header: res.Header,
2515 HTTPStatusCode: res.StatusCode,
2516 },
2517 }
2518 target := &ret
2519 if err := gensupport.DecodeResponse(target, res); err != nil {
2520 return nil, err
2521 }
2522 return ret, nil
2523 }
2524
2525 type ProjectsLocationsTriggersSetIamPolicyCall struct {
2526 s *Service
2527 resource string
2528 setiampolicyrequest *SetIamPolicyRequest
2529 urlParams_ gensupport.URLParams
2530 ctx_ context.Context
2531 header_ http.Header
2532 }
2533
2534
2535
2536
2537
2538
2539
2540
2541 func (r *ProjectsLocationsTriggersService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsLocationsTriggersSetIamPolicyCall {
2542 c := &ProjectsLocationsTriggersSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2543 c.resource = resource
2544 c.setiampolicyrequest = setiampolicyrequest
2545 return c
2546 }
2547
2548
2549
2550
2551 func (c *ProjectsLocationsTriggersSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsLocationsTriggersSetIamPolicyCall {
2552 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2553 return c
2554 }
2555
2556
2557 func (c *ProjectsLocationsTriggersSetIamPolicyCall) Context(ctx context.Context) *ProjectsLocationsTriggersSetIamPolicyCall {
2558 c.ctx_ = ctx
2559 return c
2560 }
2561
2562
2563
2564 func (c *ProjectsLocationsTriggersSetIamPolicyCall) Header() http.Header {
2565 if c.header_ == nil {
2566 c.header_ = make(http.Header)
2567 }
2568 return c.header_
2569 }
2570
2571 func (c *ProjectsLocationsTriggersSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
2572 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2573 var body io.Reader = nil
2574 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
2575 if err != nil {
2576 return nil, err
2577 }
2578 c.urlParams_.Set("alt", alt)
2579 c.urlParams_.Set("prettyPrint", "false")
2580 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:setIamPolicy")
2581 urls += "?" + c.urlParams_.Encode()
2582 req, err := http.NewRequest("POST", urls, body)
2583 if err != nil {
2584 return nil, err
2585 }
2586 req.Header = reqHeaders
2587 googleapi.Expand(req.URL, map[string]string{
2588 "resource": c.resource,
2589 })
2590 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2591 }
2592
2593
2594
2595
2596
2597
2598 func (c *ProjectsLocationsTriggersSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
2599 gensupport.SetOptions(c.urlParams_, opts...)
2600 res, err := c.doRequest("json")
2601 if res != nil && res.StatusCode == http.StatusNotModified {
2602 if res.Body != nil {
2603 res.Body.Close()
2604 }
2605 return nil, gensupport.WrapError(&googleapi.Error{
2606 Code: res.StatusCode,
2607 Header: res.Header,
2608 })
2609 }
2610 if err != nil {
2611 return nil, err
2612 }
2613 defer googleapi.CloseBody(res)
2614 if err := googleapi.CheckResponse(res); err != nil {
2615 return nil, gensupport.WrapError(err)
2616 }
2617 ret := &Policy{
2618 ServerResponse: googleapi.ServerResponse{
2619 Header: res.Header,
2620 HTTPStatusCode: res.StatusCode,
2621 },
2622 }
2623 target := &ret
2624 if err := gensupport.DecodeResponse(target, res); err != nil {
2625 return nil, err
2626 }
2627 return ret, nil
2628 }
2629
2630 type ProjectsLocationsTriggersTestIamPermissionsCall struct {
2631 s *Service
2632 resource string
2633 testiampermissionsrequest *TestIamPermissionsRequest
2634 urlParams_ gensupport.URLParams
2635 ctx_ context.Context
2636 header_ http.Header
2637 }
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649 func (r *ProjectsLocationsTriggersService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsLocationsTriggersTestIamPermissionsCall {
2650 c := &ProjectsLocationsTriggersTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2651 c.resource = resource
2652 c.testiampermissionsrequest = testiampermissionsrequest
2653 return c
2654 }
2655
2656
2657
2658
2659 func (c *ProjectsLocationsTriggersTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsLocationsTriggersTestIamPermissionsCall {
2660 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2661 return c
2662 }
2663
2664
2665 func (c *ProjectsLocationsTriggersTestIamPermissionsCall) Context(ctx context.Context) *ProjectsLocationsTriggersTestIamPermissionsCall {
2666 c.ctx_ = ctx
2667 return c
2668 }
2669
2670
2671
2672 func (c *ProjectsLocationsTriggersTestIamPermissionsCall) Header() http.Header {
2673 if c.header_ == nil {
2674 c.header_ = make(http.Header)
2675 }
2676 return c.header_
2677 }
2678
2679 func (c *ProjectsLocationsTriggersTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
2680 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2681 var body io.Reader = nil
2682 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
2683 if err != nil {
2684 return nil, err
2685 }
2686 c.urlParams_.Set("alt", alt)
2687 c.urlParams_.Set("prettyPrint", "false")
2688 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+resource}:testIamPermissions")
2689 urls += "?" + c.urlParams_.Encode()
2690 req, err := http.NewRequest("POST", urls, body)
2691 if err != nil {
2692 return nil, err
2693 }
2694 req.Header = reqHeaders
2695 googleapi.Expand(req.URL, map[string]string{
2696 "resource": c.resource,
2697 })
2698 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2699 }
2700
2701
2702
2703
2704
2705
2706
2707 func (c *ProjectsLocationsTriggersTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
2708 gensupport.SetOptions(c.urlParams_, opts...)
2709 res, err := c.doRequest("json")
2710 if res != nil && res.StatusCode == http.StatusNotModified {
2711 if res.Body != nil {
2712 res.Body.Close()
2713 }
2714 return nil, gensupport.WrapError(&googleapi.Error{
2715 Code: res.StatusCode,
2716 Header: res.Header,
2717 })
2718 }
2719 if err != nil {
2720 return nil, err
2721 }
2722 defer googleapi.CloseBody(res)
2723 if err := googleapi.CheckResponse(res); err != nil {
2724 return nil, gensupport.WrapError(err)
2725 }
2726 ret := &TestIamPermissionsResponse{
2727 ServerResponse: googleapi.ServerResponse{
2728 Header: res.Header,
2729 HTTPStatusCode: res.StatusCode,
2730 },
2731 }
2732 target := &ret
2733 if err := gensupport.DecodeResponse(target, res); err != nil {
2734 return nil, err
2735 }
2736 return ret, nil
2737 }
2738
View as plain text