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
52
53
54
55
56
57
58 package pubsub
59
60 import (
61 "bytes"
62 "context"
63 "encoding/json"
64 "errors"
65 "fmt"
66 "io"
67 "net/http"
68 "net/url"
69 "strconv"
70 "strings"
71
72 googleapi "google.golang.org/api/googleapi"
73 internal "google.golang.org/api/internal"
74 gensupport "google.golang.org/api/internal/gensupport"
75 option "google.golang.org/api/option"
76 internaloption "google.golang.org/api/option/internaloption"
77 htransport "google.golang.org/api/transport/http"
78 )
79
80
81
82 var _ = bytes.NewBuffer
83 var _ = strconv.Itoa
84 var _ = fmt.Sprintf
85 var _ = json.NewDecoder
86 var _ = io.Copy
87 var _ = url.Parse
88 var _ = gensupport.MarshalJSON
89 var _ = googleapi.Version
90 var _ = errors.New
91 var _ = strings.Replace
92 var _ = context.Canceled
93 var _ = internaloption.WithDefaultEndpoint
94 var _ = internal.Version
95
96 const apiId = "pubsub:v1beta2"
97 const apiName = "pubsub"
98 const apiVersion = "v1beta2"
99 const basePath = "https://pubsub.googleapis.com/"
100 const basePathTemplate = "https://pubsub.UNIVERSE_DOMAIN/"
101 const mtlsBasePath = "https://pubsub.mtls.googleapis.com/"
102
103
104 const (
105
106
107 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
108
109
110 PubsubScope = "https://www.googleapis.com/auth/pubsub"
111 )
112
113
114 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
115 scopesOption := internaloption.WithDefaultScopes(
116 "https://www.googleapis.com/auth/cloud-platform",
117 "https://www.googleapis.com/auth/pubsub",
118 )
119
120 opts = append([]option.ClientOption{scopesOption}, opts...)
121 opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
122 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
123 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
124 opts = append(opts, internaloption.EnableNewAuthLibrary())
125 client, endpoint, err := htransport.NewClient(ctx, opts...)
126 if err != nil {
127 return nil, err
128 }
129 s, err := New(client)
130 if err != nil {
131 return nil, err
132 }
133 if endpoint != "" {
134 s.BasePath = endpoint
135 }
136 return s, nil
137 }
138
139
140
141
142
143
144 func New(client *http.Client) (*Service, error) {
145 if client == nil {
146 return nil, errors.New("client is nil")
147 }
148 s := &Service{client: client, BasePath: basePath}
149 s.Projects = NewProjectsService(s)
150 return s, nil
151 }
152
153 type Service struct {
154 client *http.Client
155 BasePath string
156 UserAgent string
157
158 Projects *ProjectsService
159 }
160
161 func (s *Service) userAgent() string {
162 if s.UserAgent == "" {
163 return googleapi.UserAgent
164 }
165 return googleapi.UserAgent + " " + s.UserAgent
166 }
167
168 func NewProjectsService(s *Service) *ProjectsService {
169 rs := &ProjectsService{s: s}
170 rs.Subscriptions = NewProjectsSubscriptionsService(s)
171 rs.Topics = NewProjectsTopicsService(s)
172 return rs
173 }
174
175 type ProjectsService struct {
176 s *Service
177
178 Subscriptions *ProjectsSubscriptionsService
179
180 Topics *ProjectsTopicsService
181 }
182
183 func NewProjectsSubscriptionsService(s *Service) *ProjectsSubscriptionsService {
184 rs := &ProjectsSubscriptionsService{s: s}
185 return rs
186 }
187
188 type ProjectsSubscriptionsService struct {
189 s *Service
190 }
191
192 func NewProjectsTopicsService(s *Service) *ProjectsTopicsService {
193 rs := &ProjectsTopicsService{s: s}
194 rs.Subscriptions = NewProjectsTopicsSubscriptionsService(s)
195 return rs
196 }
197
198 type ProjectsTopicsService struct {
199 s *Service
200
201 Subscriptions *ProjectsTopicsSubscriptionsService
202 }
203
204 func NewProjectsTopicsSubscriptionsService(s *Service) *ProjectsTopicsSubscriptionsService {
205 rs := &ProjectsTopicsSubscriptionsService{s: s}
206 return rs
207 }
208
209 type ProjectsTopicsSubscriptionsService struct {
210 s *Service
211 }
212
213
214 type AcknowledgeRequest struct {
215
216
217 AckIds []string `json:"ackIds,omitempty"`
218
219
220
221
222
223 ForceSendFields []string `json:"-"`
224
225
226
227
228 NullFields []string `json:"-"`
229 }
230
231 func (s *AcknowledgeRequest) MarshalJSON() ([]byte, error) {
232 type NoMethod AcknowledgeRequest
233 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
234 }
235
236
237 type Binding struct {
238
239
240
241
242
243
244
245
246 Condition *Expr `json:"condition,omitempty"`
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309 Members []string `json:"members,omitempty"`
310
311
312
313
314
315
316 Role string `json:"role,omitempty"`
317
318
319
320
321
322 ForceSendFields []string `json:"-"`
323
324
325
326
327 NullFields []string `json:"-"`
328 }
329
330 func (s *Binding) MarshalJSON() ([]byte, error) {
331 type NoMethod Binding
332 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
333 }
334
335
336
337
338
339 type Empty struct {
340
341 googleapi.ServerResponse `json:"-"`
342 }
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360 type Expr struct {
361
362
363 Description string `json:"description,omitempty"`
364
365
366 Expression string `json:"expression,omitempty"`
367
368
369 Location string `json:"location,omitempty"`
370
371
372
373 Title string `json:"title,omitempty"`
374
375
376
377
378
379 ForceSendFields []string `json:"-"`
380
381
382
383
384 NullFields []string `json:"-"`
385 }
386
387 func (s *Expr) MarshalJSON() ([]byte, error) {
388 type NoMethod Expr
389 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
390 }
391
392
393 type ListSubscriptionsResponse struct {
394
395
396
397 NextPageToken string `json:"nextPageToken,omitempty"`
398
399 Subscriptions []*Subscription `json:"subscriptions,omitempty"`
400
401
402 googleapi.ServerResponse `json:"-"`
403
404
405
406
407
408 ForceSendFields []string `json:"-"`
409
410
411
412
413 NullFields []string `json:"-"`
414 }
415
416 func (s *ListSubscriptionsResponse) MarshalJSON() ([]byte, error) {
417 type NoMethod ListSubscriptionsResponse
418 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
419 }
420
421
422
423 type ListTopicSubscriptionsResponse struct {
424
425
426
427 NextPageToken string `json:"nextPageToken,omitempty"`
428
429 Subscriptions []string `json:"subscriptions,omitempty"`
430
431
432 googleapi.ServerResponse `json:"-"`
433
434
435
436
437
438 ForceSendFields []string `json:"-"`
439
440
441
442
443 NullFields []string `json:"-"`
444 }
445
446 func (s *ListTopicSubscriptionsResponse) MarshalJSON() ([]byte, error) {
447 type NoMethod ListTopicSubscriptionsResponse
448 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
449 }
450
451
452 type ListTopicsResponse struct {
453
454
455 NextPageToken string `json:"nextPageToken,omitempty"`
456
457 Topics []*Topic `json:"topics,omitempty"`
458
459
460 googleapi.ServerResponse `json:"-"`
461
462
463
464
465
466 ForceSendFields []string `json:"-"`
467
468
469
470
471 NullFields []string `json:"-"`
472 }
473
474 func (s *ListTopicsResponse) MarshalJSON() ([]byte, error) {
475 type NoMethod ListTopicsResponse
476 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
477 }
478
479
480 type ModifyAckDeadlineRequest struct {
481
482
483
484
485
486 AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
487
488
489 AckId string `json:"ackId,omitempty"`
490
491 AckIds []string `json:"ackIds,omitempty"`
492
493
494
495
496
497 ForceSendFields []string `json:"-"`
498
499
500
501
502 NullFields []string `json:"-"`
503 }
504
505 func (s *ModifyAckDeadlineRequest) MarshalJSON() ([]byte, error) {
506 type NoMethod ModifyAckDeadlineRequest
507 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
508 }
509
510
511 type ModifyPushConfigRequest struct {
512
513
514
515
516 PushConfig *PushConfig `json:"pushConfig,omitempty"`
517
518
519
520
521
522 ForceSendFields []string `json:"-"`
523
524
525
526
527 NullFields []string `json:"-"`
528 }
529
530 func (s *ModifyPushConfigRequest) MarshalJSON() ([]byte, error) {
531 type NoMethod ModifyPushConfigRequest
532 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
533 }
534
535
536
537 type OidcToken struct {
538
539
540
541
542
543
544 Audience string `json:"audience,omitempty"`
545
546
547
548
549
550 ServiceAccountEmail string `json:"serviceAccountEmail,omitempty"`
551
552
553
554
555
556 ForceSendFields []string `json:"-"`
557
558
559
560
561 NullFields []string `json:"-"`
562 }
563
564 func (s *OidcToken) MarshalJSON() ([]byte, error) {
565 type NoMethod OidcToken
566 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
567 }
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599 type Policy struct {
600
601
602
603
604
605
606
607
608
609 Bindings []*Binding `json:"bindings,omitempty"`
610
611
612
613
614
615
616
617
618
619
620
621 Etag string `json:"etag,omitempty"`
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637 Version int64 `json:"version,omitempty"`
638
639
640 googleapi.ServerResponse `json:"-"`
641
642
643
644
645
646 ForceSendFields []string `json:"-"`
647
648
649
650
651 NullFields []string `json:"-"`
652 }
653
654 func (s *Policy) MarshalJSON() ([]byte, error) {
655 type NoMethod Policy
656 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
657 }
658
659
660 type PublishRequest struct {
661
662 Messages []*PubsubMessage `json:"messages,omitempty"`
663
664
665
666
667
668 ForceSendFields []string `json:"-"`
669
670
671
672
673 NullFields []string `json:"-"`
674 }
675
676 func (s *PublishRequest) MarshalJSON() ([]byte, error) {
677 type NoMethod PublishRequest
678 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
679 }
680
681
682 type PublishResponse struct {
683
684
685
686 MessageIds []string `json:"messageIds,omitempty"`
687
688
689 googleapi.ServerResponse `json:"-"`
690
691
692
693
694
695 ForceSendFields []string `json:"-"`
696
697
698
699
700 NullFields []string `json:"-"`
701 }
702
703 func (s *PublishResponse) MarshalJSON() ([]byte, error) {
704 type NoMethod PublishResponse
705 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
706 }
707
708
709
710
711 type PubsubMessage struct {
712
713 Attributes map[string]string `json:"attributes,omitempty"`
714
715
716 Data string `json:"data,omitempty"`
717
718
719
720
721 MessageId string `json:"messageId,omitempty"`
722
723
724
725 PublishTime string `json:"publishTime,omitempty"`
726
727
728
729
730
731 ForceSendFields []string `json:"-"`
732
733
734
735
736 NullFields []string `json:"-"`
737 }
738
739 func (s *PubsubMessage) MarshalJSON() ([]byte, error) {
740 type NoMethod PubsubMessage
741 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
742 }
743
744
745 type PullRequest struct {
746
747
748 MaxMessages int64 `json:"maxMessages,omitempty"`
749
750
751
752
753
754
755
756
757 ReturnImmediately bool `json:"returnImmediately,omitempty"`
758
759
760
761
762
763 ForceSendFields []string `json:"-"`
764
765
766
767
768 NullFields []string `json:"-"`
769 }
770
771 func (s *PullRequest) MarshalJSON() ([]byte, error) {
772 type NoMethod PullRequest
773 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
774 }
775
776
777 type PullResponse struct {
778
779
780
781
782 ReceivedMessages []*ReceivedMessage `json:"receivedMessages,omitempty"`
783
784
785 googleapi.ServerResponse `json:"-"`
786
787
788
789
790
791 ForceSendFields []string `json:"-"`
792
793
794
795
796 NullFields []string `json:"-"`
797 }
798
799 func (s *PullResponse) MarshalJSON() ([]byte, error) {
800 type NoMethod PullResponse
801 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
802 }
803
804
805 type PushConfig struct {
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820 Attributes map[string]string `json:"attributes,omitempty"`
821
822
823 OidcToken *OidcToken `json:"oidcToken,omitempty"`
824
825
826
827 PushEndpoint string `json:"pushEndpoint,omitempty"`
828
829
830
831
832
833 ForceSendFields []string `json:"-"`
834
835
836
837
838 NullFields []string `json:"-"`
839 }
840
841 func (s *PushConfig) MarshalJSON() ([]byte, error) {
842 type NoMethod PushConfig
843 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
844 }
845
846
847 type ReceivedMessage struct {
848
849 AckId string `json:"ackId,omitempty"`
850
851 Message *PubsubMessage `json:"message,omitempty"`
852
853
854
855
856
857 ForceSendFields []string `json:"-"`
858
859
860
861
862 NullFields []string `json:"-"`
863 }
864
865 func (s *ReceivedMessage) MarshalJSON() ([]byte, error) {
866 type NoMethod ReceivedMessage
867 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
868 }
869
870
871 type SetIamPolicyRequest struct {
872
873
874
875
876 Policy *Policy `json:"policy,omitempty"`
877
878
879
880
881
882 ForceSendFields []string `json:"-"`
883
884
885
886
887 NullFields []string `json:"-"`
888 }
889
890 func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
891 type NoMethod SetIamPolicyRequest
892 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
893 }
894
895
896 type Subscription struct {
897
898
899
900
901
902
903
904
905
906
907
908
909
910 AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
911
912
913
914
915
916
917 Name string `json:"name,omitempty"`
918
919
920
921 PushConfig *PushConfig `json:"pushConfig,omitempty"`
922
923
924
925 Topic string `json:"topic,omitempty"`
926
927
928 googleapi.ServerResponse `json:"-"`
929
930
931
932
933
934 ForceSendFields []string `json:"-"`
935
936
937
938
939 NullFields []string `json:"-"`
940 }
941
942 func (s *Subscription) MarshalJSON() ([]byte, error) {
943 type NoMethod Subscription
944 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
945 }
946
947
948 type TestIamPermissionsRequest struct {
949
950
951
952
953 Permissions []string `json:"permissions,omitempty"`
954
955
956
957
958
959 ForceSendFields []string `json:"-"`
960
961
962
963
964 NullFields []string `json:"-"`
965 }
966
967 func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
968 type NoMethod TestIamPermissionsRequest
969 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
970 }
971
972
973
974 type TestIamPermissionsResponse struct {
975
976
977 Permissions []string `json:"permissions,omitempty"`
978
979
980 googleapi.ServerResponse `json:"-"`
981
982
983
984
985
986 ForceSendFields []string `json:"-"`
987
988
989
990
991 NullFields []string `json:"-"`
992 }
993
994 func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
995 type NoMethod TestIamPermissionsResponse
996 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
997 }
998
999
1000 type Topic struct {
1001
1002
1003
1004
1005
1006
1007 Name string `json:"name,omitempty"`
1008
1009
1010 googleapi.ServerResponse `json:"-"`
1011
1012
1013
1014
1015
1016 ForceSendFields []string `json:"-"`
1017
1018
1019
1020
1021 NullFields []string `json:"-"`
1022 }
1023
1024 func (s *Topic) MarshalJSON() ([]byte, error) {
1025 type NoMethod Topic
1026 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
1027 }
1028
1029 type ProjectsSubscriptionsAcknowledgeCall struct {
1030 s *Service
1031 subscription string
1032 acknowledgerequest *AcknowledgeRequest
1033 urlParams_ gensupport.URLParams
1034 ctx_ context.Context
1035 header_ http.Header
1036 }
1037
1038
1039
1040
1041
1042
1043
1044
1045 func (r *ProjectsSubscriptionsService) Acknowledge(subscription string, acknowledgerequest *AcknowledgeRequest) *ProjectsSubscriptionsAcknowledgeCall {
1046 c := &ProjectsSubscriptionsAcknowledgeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1047 c.subscription = subscription
1048 c.acknowledgerequest = acknowledgerequest
1049 return c
1050 }
1051
1052
1053
1054
1055 func (c *ProjectsSubscriptionsAcknowledgeCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsAcknowledgeCall {
1056 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1057 return c
1058 }
1059
1060
1061 func (c *ProjectsSubscriptionsAcknowledgeCall) Context(ctx context.Context) *ProjectsSubscriptionsAcknowledgeCall {
1062 c.ctx_ = ctx
1063 return c
1064 }
1065
1066
1067
1068 func (c *ProjectsSubscriptionsAcknowledgeCall) Header() http.Header {
1069 if c.header_ == nil {
1070 c.header_ = make(http.Header)
1071 }
1072 return c.header_
1073 }
1074
1075 func (c *ProjectsSubscriptionsAcknowledgeCall) doRequest(alt string) (*http.Response, error) {
1076 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1077 var body io.Reader = nil
1078 body, err := googleapi.WithoutDataWrapper.JSONReader(c.acknowledgerequest)
1079 if err != nil {
1080 return nil, err
1081 }
1082 c.urlParams_.Set("alt", alt)
1083 c.urlParams_.Set("prettyPrint", "false")
1084 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:acknowledge")
1085 urls += "?" + c.urlParams_.Encode()
1086 req, err := http.NewRequest("POST", urls, body)
1087 if err != nil {
1088 return nil, err
1089 }
1090 req.Header = reqHeaders
1091 googleapi.Expand(req.URL, map[string]string{
1092 "subscription": c.subscription,
1093 })
1094 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1095 }
1096
1097
1098
1099
1100
1101
1102 func (c *ProjectsSubscriptionsAcknowledgeCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1103 gensupport.SetOptions(c.urlParams_, opts...)
1104 res, err := c.doRequest("json")
1105 if res != nil && res.StatusCode == http.StatusNotModified {
1106 if res.Body != nil {
1107 res.Body.Close()
1108 }
1109 return nil, gensupport.WrapError(&googleapi.Error{
1110 Code: res.StatusCode,
1111 Header: res.Header,
1112 })
1113 }
1114 if err != nil {
1115 return nil, err
1116 }
1117 defer googleapi.CloseBody(res)
1118 if err := googleapi.CheckResponse(res); err != nil {
1119 return nil, gensupport.WrapError(err)
1120 }
1121 ret := &Empty{
1122 ServerResponse: googleapi.ServerResponse{
1123 Header: res.Header,
1124 HTTPStatusCode: res.StatusCode,
1125 },
1126 }
1127 target := &ret
1128 if err := gensupport.DecodeResponse(target, res); err != nil {
1129 return nil, err
1130 }
1131 return ret, nil
1132 }
1133
1134 type ProjectsSubscriptionsCreateCall struct {
1135 s *Service
1136 name string
1137 subscription *Subscription
1138 urlParams_ gensupport.URLParams
1139 ctx_ context.Context
1140 header_ http.Header
1141 }
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155 func (r *ProjectsSubscriptionsService) Create(name string, subscription *Subscription) *ProjectsSubscriptionsCreateCall {
1156 c := &ProjectsSubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1157 c.name = name
1158 c.subscription = subscription
1159 return c
1160 }
1161
1162
1163
1164
1165 func (c *ProjectsSubscriptionsCreateCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsCreateCall {
1166 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1167 return c
1168 }
1169
1170
1171 func (c *ProjectsSubscriptionsCreateCall) Context(ctx context.Context) *ProjectsSubscriptionsCreateCall {
1172 c.ctx_ = ctx
1173 return c
1174 }
1175
1176
1177
1178 func (c *ProjectsSubscriptionsCreateCall) Header() http.Header {
1179 if c.header_ == nil {
1180 c.header_ = make(http.Header)
1181 }
1182 return c.header_
1183 }
1184
1185 func (c *ProjectsSubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) {
1186 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1187 var body io.Reader = nil
1188 body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
1189 if err != nil {
1190 return nil, err
1191 }
1192 c.urlParams_.Set("alt", alt)
1193 c.urlParams_.Set("prettyPrint", "false")
1194 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}")
1195 urls += "?" + c.urlParams_.Encode()
1196 req, err := http.NewRequest("PUT", urls, body)
1197 if err != nil {
1198 return nil, err
1199 }
1200 req.Header = reqHeaders
1201 googleapi.Expand(req.URL, map[string]string{
1202 "name": c.name,
1203 })
1204 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1205 }
1206
1207
1208
1209
1210
1211
1212 func (c *ProjectsSubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
1213 gensupport.SetOptions(c.urlParams_, opts...)
1214 res, err := c.doRequest("json")
1215 if res != nil && res.StatusCode == http.StatusNotModified {
1216 if res.Body != nil {
1217 res.Body.Close()
1218 }
1219 return nil, gensupport.WrapError(&googleapi.Error{
1220 Code: res.StatusCode,
1221 Header: res.Header,
1222 })
1223 }
1224 if err != nil {
1225 return nil, err
1226 }
1227 defer googleapi.CloseBody(res)
1228 if err := googleapi.CheckResponse(res); err != nil {
1229 return nil, gensupport.WrapError(err)
1230 }
1231 ret := &Subscription{
1232 ServerResponse: googleapi.ServerResponse{
1233 Header: res.Header,
1234 HTTPStatusCode: res.StatusCode,
1235 },
1236 }
1237 target := &ret
1238 if err := gensupport.DecodeResponse(target, res); err != nil {
1239 return nil, err
1240 }
1241 return ret, nil
1242 }
1243
1244 type ProjectsSubscriptionsDeleteCall struct {
1245 s *Service
1246 subscription string
1247 urlParams_ gensupport.URLParams
1248 ctx_ context.Context
1249 header_ http.Header
1250 }
1251
1252
1253
1254
1255
1256
1257
1258
1259 func (r *ProjectsSubscriptionsService) Delete(subscription string) *ProjectsSubscriptionsDeleteCall {
1260 c := &ProjectsSubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1261 c.subscription = subscription
1262 return c
1263 }
1264
1265
1266
1267
1268 func (c *ProjectsSubscriptionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsDeleteCall {
1269 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1270 return c
1271 }
1272
1273
1274 func (c *ProjectsSubscriptionsDeleteCall) Context(ctx context.Context) *ProjectsSubscriptionsDeleteCall {
1275 c.ctx_ = ctx
1276 return c
1277 }
1278
1279
1280
1281 func (c *ProjectsSubscriptionsDeleteCall) Header() http.Header {
1282 if c.header_ == nil {
1283 c.header_ = make(http.Header)
1284 }
1285 return c.header_
1286 }
1287
1288 func (c *ProjectsSubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
1289 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1290 var body io.Reader = nil
1291 c.urlParams_.Set("alt", alt)
1292 c.urlParams_.Set("prettyPrint", "false")
1293 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}")
1294 urls += "?" + c.urlParams_.Encode()
1295 req, err := http.NewRequest("DELETE", urls, body)
1296 if err != nil {
1297 return nil, err
1298 }
1299 req.Header = reqHeaders
1300 googleapi.Expand(req.URL, map[string]string{
1301 "subscription": c.subscription,
1302 })
1303 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1304 }
1305
1306
1307
1308
1309
1310
1311 func (c *ProjectsSubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1312 gensupport.SetOptions(c.urlParams_, opts...)
1313 res, err := c.doRequest("json")
1314 if res != nil && res.StatusCode == http.StatusNotModified {
1315 if res.Body != nil {
1316 res.Body.Close()
1317 }
1318 return nil, gensupport.WrapError(&googleapi.Error{
1319 Code: res.StatusCode,
1320 Header: res.Header,
1321 })
1322 }
1323 if err != nil {
1324 return nil, err
1325 }
1326 defer googleapi.CloseBody(res)
1327 if err := googleapi.CheckResponse(res); err != nil {
1328 return nil, gensupport.WrapError(err)
1329 }
1330 ret := &Empty{
1331 ServerResponse: googleapi.ServerResponse{
1332 Header: res.Header,
1333 HTTPStatusCode: res.StatusCode,
1334 },
1335 }
1336 target := &ret
1337 if err := gensupport.DecodeResponse(target, res); err != nil {
1338 return nil, err
1339 }
1340 return ret, nil
1341 }
1342
1343 type ProjectsSubscriptionsGetCall struct {
1344 s *Service
1345 subscription string
1346 urlParams_ gensupport.URLParams
1347 ifNoneMatch_ string
1348 ctx_ context.Context
1349 header_ http.Header
1350 }
1351
1352
1353
1354
1355 func (r *ProjectsSubscriptionsService) Get(subscription string) *ProjectsSubscriptionsGetCall {
1356 c := &ProjectsSubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1357 c.subscription = subscription
1358 return c
1359 }
1360
1361
1362
1363
1364 func (c *ProjectsSubscriptionsGetCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsGetCall {
1365 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1366 return c
1367 }
1368
1369
1370
1371
1372 func (c *ProjectsSubscriptionsGetCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsGetCall {
1373 c.ifNoneMatch_ = entityTag
1374 return c
1375 }
1376
1377
1378 func (c *ProjectsSubscriptionsGetCall) Context(ctx context.Context) *ProjectsSubscriptionsGetCall {
1379 c.ctx_ = ctx
1380 return c
1381 }
1382
1383
1384
1385 func (c *ProjectsSubscriptionsGetCall) Header() http.Header {
1386 if c.header_ == nil {
1387 c.header_ = make(http.Header)
1388 }
1389 return c.header_
1390 }
1391
1392 func (c *ProjectsSubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
1393 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1394 if c.ifNoneMatch_ != "" {
1395 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1396 }
1397 var body io.Reader = nil
1398 c.urlParams_.Set("alt", alt)
1399 c.urlParams_.Set("prettyPrint", "false")
1400 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}")
1401 urls += "?" + c.urlParams_.Encode()
1402 req, err := http.NewRequest("GET", urls, body)
1403 if err != nil {
1404 return nil, err
1405 }
1406 req.Header = reqHeaders
1407 googleapi.Expand(req.URL, map[string]string{
1408 "subscription": c.subscription,
1409 })
1410 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1411 }
1412
1413
1414
1415
1416
1417
1418 func (c *ProjectsSubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
1419 gensupport.SetOptions(c.urlParams_, opts...)
1420 res, err := c.doRequest("json")
1421 if res != nil && res.StatusCode == http.StatusNotModified {
1422 if res.Body != nil {
1423 res.Body.Close()
1424 }
1425 return nil, gensupport.WrapError(&googleapi.Error{
1426 Code: res.StatusCode,
1427 Header: res.Header,
1428 })
1429 }
1430 if err != nil {
1431 return nil, err
1432 }
1433 defer googleapi.CloseBody(res)
1434 if err := googleapi.CheckResponse(res); err != nil {
1435 return nil, gensupport.WrapError(err)
1436 }
1437 ret := &Subscription{
1438 ServerResponse: googleapi.ServerResponse{
1439 Header: res.Header,
1440 HTTPStatusCode: res.StatusCode,
1441 },
1442 }
1443 target := &ret
1444 if err := gensupport.DecodeResponse(target, res); err != nil {
1445 return nil, err
1446 }
1447 return ret, nil
1448 }
1449
1450 type ProjectsSubscriptionsGetIamPolicyCall struct {
1451 s *Service
1452 resource string
1453 urlParams_ gensupport.URLParams
1454 ifNoneMatch_ string
1455 ctx_ context.Context
1456 header_ http.Header
1457 }
1458
1459
1460
1461
1462
1463
1464
1465 func (r *ProjectsSubscriptionsService) GetIamPolicy(resource string) *ProjectsSubscriptionsGetIamPolicyCall {
1466 c := &ProjectsSubscriptionsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1467 c.resource = resource
1468 return c
1469 }
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483 func (c *ProjectsSubscriptionsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsSubscriptionsGetIamPolicyCall {
1484 c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion))
1485 return c
1486 }
1487
1488
1489
1490
1491 func (c *ProjectsSubscriptionsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsGetIamPolicyCall {
1492 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1493 return c
1494 }
1495
1496
1497
1498
1499 func (c *ProjectsSubscriptionsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsGetIamPolicyCall {
1500 c.ifNoneMatch_ = entityTag
1501 return c
1502 }
1503
1504
1505 func (c *ProjectsSubscriptionsGetIamPolicyCall) Context(ctx context.Context) *ProjectsSubscriptionsGetIamPolicyCall {
1506 c.ctx_ = ctx
1507 return c
1508 }
1509
1510
1511
1512 func (c *ProjectsSubscriptionsGetIamPolicyCall) Header() http.Header {
1513 if c.header_ == nil {
1514 c.header_ = make(http.Header)
1515 }
1516 return c.header_
1517 }
1518
1519 func (c *ProjectsSubscriptionsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
1520 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1521 if c.ifNoneMatch_ != "" {
1522 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1523 }
1524 var body io.Reader = nil
1525 c.urlParams_.Set("alt", alt)
1526 c.urlParams_.Set("prettyPrint", "false")
1527 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:getIamPolicy")
1528 urls += "?" + c.urlParams_.Encode()
1529 req, err := http.NewRequest("GET", urls, body)
1530 if err != nil {
1531 return nil, err
1532 }
1533 req.Header = reqHeaders
1534 googleapi.Expand(req.URL, map[string]string{
1535 "resource": c.resource,
1536 })
1537 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1538 }
1539
1540
1541
1542
1543
1544
1545 func (c *ProjectsSubscriptionsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
1546 gensupport.SetOptions(c.urlParams_, opts...)
1547 res, err := c.doRequest("json")
1548 if res != nil && res.StatusCode == http.StatusNotModified {
1549 if res.Body != nil {
1550 res.Body.Close()
1551 }
1552 return nil, gensupport.WrapError(&googleapi.Error{
1553 Code: res.StatusCode,
1554 Header: res.Header,
1555 })
1556 }
1557 if err != nil {
1558 return nil, err
1559 }
1560 defer googleapi.CloseBody(res)
1561 if err := googleapi.CheckResponse(res); err != nil {
1562 return nil, gensupport.WrapError(err)
1563 }
1564 ret := &Policy{
1565 ServerResponse: googleapi.ServerResponse{
1566 Header: res.Header,
1567 HTTPStatusCode: res.StatusCode,
1568 },
1569 }
1570 target := &ret
1571 if err := gensupport.DecodeResponse(target, res); err != nil {
1572 return nil, err
1573 }
1574 return ret, nil
1575 }
1576
1577 type ProjectsSubscriptionsListCall struct {
1578 s *Service
1579 project string
1580 urlParams_ gensupport.URLParams
1581 ifNoneMatch_ string
1582 ctx_ context.Context
1583 header_ http.Header
1584 }
1585
1586
1587
1588
1589 func (r *ProjectsSubscriptionsService) List(project string) *ProjectsSubscriptionsListCall {
1590 c := &ProjectsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1591 c.project = project
1592 return c
1593 }
1594
1595
1596
1597 func (c *ProjectsSubscriptionsListCall) PageSize(pageSize int64) *ProjectsSubscriptionsListCall {
1598 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1599 return c
1600 }
1601
1602
1603
1604
1605
1606 func (c *ProjectsSubscriptionsListCall) PageToken(pageToken string) *ProjectsSubscriptionsListCall {
1607 c.urlParams_.Set("pageToken", pageToken)
1608 return c
1609 }
1610
1611
1612
1613
1614 func (c *ProjectsSubscriptionsListCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsListCall {
1615 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1616 return c
1617 }
1618
1619
1620
1621
1622 func (c *ProjectsSubscriptionsListCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsListCall {
1623 c.ifNoneMatch_ = entityTag
1624 return c
1625 }
1626
1627
1628 func (c *ProjectsSubscriptionsListCall) Context(ctx context.Context) *ProjectsSubscriptionsListCall {
1629 c.ctx_ = ctx
1630 return c
1631 }
1632
1633
1634
1635 func (c *ProjectsSubscriptionsListCall) Header() http.Header {
1636 if c.header_ == nil {
1637 c.header_ = make(http.Header)
1638 }
1639 return c.header_
1640 }
1641
1642 func (c *ProjectsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
1643 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
1644 if c.ifNoneMatch_ != "" {
1645 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1646 }
1647 var body io.Reader = nil
1648 c.urlParams_.Set("alt", alt)
1649 c.urlParams_.Set("prettyPrint", "false")
1650 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+project}/subscriptions")
1651 urls += "?" + c.urlParams_.Encode()
1652 req, err := http.NewRequest("GET", urls, body)
1653 if err != nil {
1654 return nil, err
1655 }
1656 req.Header = reqHeaders
1657 googleapi.Expand(req.URL, map[string]string{
1658 "project": c.project,
1659 })
1660 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1661 }
1662
1663
1664
1665
1666
1667
1668
1669 func (c *ProjectsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListSubscriptionsResponse, error) {
1670 gensupport.SetOptions(c.urlParams_, opts...)
1671 res, err := c.doRequest("json")
1672 if res != nil && res.StatusCode == http.StatusNotModified {
1673 if res.Body != nil {
1674 res.Body.Close()
1675 }
1676 return nil, gensupport.WrapError(&googleapi.Error{
1677 Code: res.StatusCode,
1678 Header: res.Header,
1679 })
1680 }
1681 if err != nil {
1682 return nil, err
1683 }
1684 defer googleapi.CloseBody(res)
1685 if err := googleapi.CheckResponse(res); err != nil {
1686 return nil, gensupport.WrapError(err)
1687 }
1688 ret := &ListSubscriptionsResponse{
1689 ServerResponse: googleapi.ServerResponse{
1690 Header: res.Header,
1691 HTTPStatusCode: res.StatusCode,
1692 },
1693 }
1694 target := &ret
1695 if err := gensupport.DecodeResponse(target, res); err != nil {
1696 return nil, err
1697 }
1698 return ret, nil
1699 }
1700
1701
1702
1703
1704 func (c *ProjectsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListSubscriptionsResponse) error) error {
1705 c.ctx_ = ctx
1706 defer c.PageToken(c.urlParams_.Get("pageToken"))
1707 for {
1708 x, err := c.Do()
1709 if err != nil {
1710 return err
1711 }
1712 if err := f(x); err != nil {
1713 return err
1714 }
1715 if x.NextPageToken == "" {
1716 return nil
1717 }
1718 c.PageToken(x.NextPageToken)
1719 }
1720 }
1721
1722 type ProjectsSubscriptionsModifyAckDeadlineCall struct {
1723 s *Service
1724 subscription string
1725 modifyackdeadlinerequest *ModifyAckDeadlineRequest
1726 urlParams_ gensupport.URLParams
1727 ctx_ context.Context
1728 header_ http.Header
1729 }
1730
1731
1732
1733
1734
1735
1736
1737
1738 func (r *ProjectsSubscriptionsService) ModifyAckDeadline(subscription string, modifyackdeadlinerequest *ModifyAckDeadlineRequest) *ProjectsSubscriptionsModifyAckDeadlineCall {
1739 c := &ProjectsSubscriptionsModifyAckDeadlineCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1740 c.subscription = subscription
1741 c.modifyackdeadlinerequest = modifyackdeadlinerequest
1742 return c
1743 }
1744
1745
1746
1747
1748 func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsModifyAckDeadlineCall {
1749 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1750 return c
1751 }
1752
1753
1754 func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Context(ctx context.Context) *ProjectsSubscriptionsModifyAckDeadlineCall {
1755 c.ctx_ = ctx
1756 return c
1757 }
1758
1759
1760
1761 func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Header() http.Header {
1762 if c.header_ == nil {
1763 c.header_ = make(http.Header)
1764 }
1765 return c.header_
1766 }
1767
1768 func (c *ProjectsSubscriptionsModifyAckDeadlineCall) doRequest(alt string) (*http.Response, error) {
1769 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1770 var body io.Reader = nil
1771 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyackdeadlinerequest)
1772 if err != nil {
1773 return nil, err
1774 }
1775 c.urlParams_.Set("alt", alt)
1776 c.urlParams_.Set("prettyPrint", "false")
1777 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:modifyAckDeadline")
1778 urls += "?" + c.urlParams_.Encode()
1779 req, err := http.NewRequest("POST", urls, body)
1780 if err != nil {
1781 return nil, err
1782 }
1783 req.Header = reqHeaders
1784 googleapi.Expand(req.URL, map[string]string{
1785 "subscription": c.subscription,
1786 })
1787 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1788 }
1789
1790
1791
1792
1793
1794
1795 func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1796 gensupport.SetOptions(c.urlParams_, opts...)
1797 res, err := c.doRequest("json")
1798 if res != nil && res.StatusCode == http.StatusNotModified {
1799 if res.Body != nil {
1800 res.Body.Close()
1801 }
1802 return nil, gensupport.WrapError(&googleapi.Error{
1803 Code: res.StatusCode,
1804 Header: res.Header,
1805 })
1806 }
1807 if err != nil {
1808 return nil, err
1809 }
1810 defer googleapi.CloseBody(res)
1811 if err := googleapi.CheckResponse(res); err != nil {
1812 return nil, gensupport.WrapError(err)
1813 }
1814 ret := &Empty{
1815 ServerResponse: googleapi.ServerResponse{
1816 Header: res.Header,
1817 HTTPStatusCode: res.StatusCode,
1818 },
1819 }
1820 target := &ret
1821 if err := gensupport.DecodeResponse(target, res); err != nil {
1822 return nil, err
1823 }
1824 return ret, nil
1825 }
1826
1827 type ProjectsSubscriptionsModifyPushConfigCall struct {
1828 s *Service
1829 subscription string
1830 modifypushconfigrequest *ModifyPushConfigRequest
1831 urlParams_ gensupport.URLParams
1832 ctx_ context.Context
1833 header_ http.Header
1834 }
1835
1836
1837
1838
1839
1840
1841
1842
1843 func (r *ProjectsSubscriptionsService) ModifyPushConfig(subscription string, modifypushconfigrequest *ModifyPushConfigRequest) *ProjectsSubscriptionsModifyPushConfigCall {
1844 c := &ProjectsSubscriptionsModifyPushConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1845 c.subscription = subscription
1846 c.modifypushconfigrequest = modifypushconfigrequest
1847 return c
1848 }
1849
1850
1851
1852
1853 func (c *ProjectsSubscriptionsModifyPushConfigCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsModifyPushConfigCall {
1854 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1855 return c
1856 }
1857
1858
1859 func (c *ProjectsSubscriptionsModifyPushConfigCall) Context(ctx context.Context) *ProjectsSubscriptionsModifyPushConfigCall {
1860 c.ctx_ = ctx
1861 return c
1862 }
1863
1864
1865
1866 func (c *ProjectsSubscriptionsModifyPushConfigCall) Header() http.Header {
1867 if c.header_ == nil {
1868 c.header_ = make(http.Header)
1869 }
1870 return c.header_
1871 }
1872
1873 func (c *ProjectsSubscriptionsModifyPushConfigCall) doRequest(alt string) (*http.Response, error) {
1874 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1875 var body io.Reader = nil
1876 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifypushconfigrequest)
1877 if err != nil {
1878 return nil, err
1879 }
1880 c.urlParams_.Set("alt", alt)
1881 c.urlParams_.Set("prettyPrint", "false")
1882 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:modifyPushConfig")
1883 urls += "?" + c.urlParams_.Encode()
1884 req, err := http.NewRequest("POST", urls, body)
1885 if err != nil {
1886 return nil, err
1887 }
1888 req.Header = reqHeaders
1889 googleapi.Expand(req.URL, map[string]string{
1890 "subscription": c.subscription,
1891 })
1892 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1893 }
1894
1895
1896
1897
1898
1899
1900 func (c *ProjectsSubscriptionsModifyPushConfigCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1901 gensupport.SetOptions(c.urlParams_, opts...)
1902 res, err := c.doRequest("json")
1903 if res != nil && res.StatusCode == http.StatusNotModified {
1904 if res.Body != nil {
1905 res.Body.Close()
1906 }
1907 return nil, gensupport.WrapError(&googleapi.Error{
1908 Code: res.StatusCode,
1909 Header: res.Header,
1910 })
1911 }
1912 if err != nil {
1913 return nil, err
1914 }
1915 defer googleapi.CloseBody(res)
1916 if err := googleapi.CheckResponse(res); err != nil {
1917 return nil, gensupport.WrapError(err)
1918 }
1919 ret := &Empty{
1920 ServerResponse: googleapi.ServerResponse{
1921 Header: res.Header,
1922 HTTPStatusCode: res.StatusCode,
1923 },
1924 }
1925 target := &ret
1926 if err := gensupport.DecodeResponse(target, res); err != nil {
1927 return nil, err
1928 }
1929 return ret, nil
1930 }
1931
1932 type ProjectsSubscriptionsPullCall struct {
1933 s *Service
1934 subscription string
1935 pullrequest *PullRequest
1936 urlParams_ gensupport.URLParams
1937 ctx_ context.Context
1938 header_ http.Header
1939 }
1940
1941
1942
1943
1944
1945
1946
1947 func (r *ProjectsSubscriptionsService) Pull(subscription string, pullrequest *PullRequest) *ProjectsSubscriptionsPullCall {
1948 c := &ProjectsSubscriptionsPullCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1949 c.subscription = subscription
1950 c.pullrequest = pullrequest
1951 return c
1952 }
1953
1954
1955
1956
1957 func (c *ProjectsSubscriptionsPullCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsPullCall {
1958 c.urlParams_.Set("fields", googleapi.CombineFields(s))
1959 return c
1960 }
1961
1962
1963 func (c *ProjectsSubscriptionsPullCall) Context(ctx context.Context) *ProjectsSubscriptionsPullCall {
1964 c.ctx_ = ctx
1965 return c
1966 }
1967
1968
1969
1970 func (c *ProjectsSubscriptionsPullCall) Header() http.Header {
1971 if c.header_ == nil {
1972 c.header_ = make(http.Header)
1973 }
1974 return c.header_
1975 }
1976
1977 func (c *ProjectsSubscriptionsPullCall) doRequest(alt string) (*http.Response, error) {
1978 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
1979 var body io.Reader = nil
1980 body, err := googleapi.WithoutDataWrapper.JSONReader(c.pullrequest)
1981 if err != nil {
1982 return nil, err
1983 }
1984 c.urlParams_.Set("alt", alt)
1985 c.urlParams_.Set("prettyPrint", "false")
1986 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:pull")
1987 urls += "?" + c.urlParams_.Encode()
1988 req, err := http.NewRequest("POST", urls, body)
1989 if err != nil {
1990 return nil, err
1991 }
1992 req.Header = reqHeaders
1993 googleapi.Expand(req.URL, map[string]string{
1994 "subscription": c.subscription,
1995 })
1996 return gensupport.SendRequest(c.ctx_, c.s.client, req)
1997 }
1998
1999
2000
2001
2002
2003
2004 func (c *ProjectsSubscriptionsPullCall) Do(opts ...googleapi.CallOption) (*PullResponse, error) {
2005 gensupport.SetOptions(c.urlParams_, opts...)
2006 res, err := c.doRequest("json")
2007 if res != nil && res.StatusCode == http.StatusNotModified {
2008 if res.Body != nil {
2009 res.Body.Close()
2010 }
2011 return nil, gensupport.WrapError(&googleapi.Error{
2012 Code: res.StatusCode,
2013 Header: res.Header,
2014 })
2015 }
2016 if err != nil {
2017 return nil, err
2018 }
2019 defer googleapi.CloseBody(res)
2020 if err := googleapi.CheckResponse(res); err != nil {
2021 return nil, gensupport.WrapError(err)
2022 }
2023 ret := &PullResponse{
2024 ServerResponse: googleapi.ServerResponse{
2025 Header: res.Header,
2026 HTTPStatusCode: res.StatusCode,
2027 },
2028 }
2029 target := &ret
2030 if err := gensupport.DecodeResponse(target, res); err != nil {
2031 return nil, err
2032 }
2033 return ret, nil
2034 }
2035
2036 type ProjectsSubscriptionsSetIamPolicyCall struct {
2037 s *Service
2038 resource string
2039 setiampolicyrequest *SetIamPolicyRequest
2040 urlParams_ gensupport.URLParams
2041 ctx_ context.Context
2042 header_ http.Header
2043 }
2044
2045
2046
2047
2048
2049
2050
2051
2052 func (r *ProjectsSubscriptionsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSubscriptionsSetIamPolicyCall {
2053 c := &ProjectsSubscriptionsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2054 c.resource = resource
2055 c.setiampolicyrequest = setiampolicyrequest
2056 return c
2057 }
2058
2059
2060
2061
2062 func (c *ProjectsSubscriptionsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsSetIamPolicyCall {
2063 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2064 return c
2065 }
2066
2067
2068 func (c *ProjectsSubscriptionsSetIamPolicyCall) Context(ctx context.Context) *ProjectsSubscriptionsSetIamPolicyCall {
2069 c.ctx_ = ctx
2070 return c
2071 }
2072
2073
2074
2075 func (c *ProjectsSubscriptionsSetIamPolicyCall) Header() http.Header {
2076 if c.header_ == nil {
2077 c.header_ = make(http.Header)
2078 }
2079 return c.header_
2080 }
2081
2082 func (c *ProjectsSubscriptionsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
2083 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2084 var body io.Reader = nil
2085 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
2086 if err != nil {
2087 return nil, err
2088 }
2089 c.urlParams_.Set("alt", alt)
2090 c.urlParams_.Set("prettyPrint", "false")
2091 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:setIamPolicy")
2092 urls += "?" + c.urlParams_.Encode()
2093 req, err := http.NewRequest("POST", urls, body)
2094 if err != nil {
2095 return nil, err
2096 }
2097 req.Header = reqHeaders
2098 googleapi.Expand(req.URL, map[string]string{
2099 "resource": c.resource,
2100 })
2101 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2102 }
2103
2104
2105
2106
2107
2108
2109 func (c *ProjectsSubscriptionsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
2110 gensupport.SetOptions(c.urlParams_, opts...)
2111 res, err := c.doRequest("json")
2112 if res != nil && res.StatusCode == http.StatusNotModified {
2113 if res.Body != nil {
2114 res.Body.Close()
2115 }
2116 return nil, gensupport.WrapError(&googleapi.Error{
2117 Code: res.StatusCode,
2118 Header: res.Header,
2119 })
2120 }
2121 if err != nil {
2122 return nil, err
2123 }
2124 defer googleapi.CloseBody(res)
2125 if err := googleapi.CheckResponse(res); err != nil {
2126 return nil, gensupport.WrapError(err)
2127 }
2128 ret := &Policy{
2129 ServerResponse: googleapi.ServerResponse{
2130 Header: res.Header,
2131 HTTPStatusCode: res.StatusCode,
2132 },
2133 }
2134 target := &ret
2135 if err := gensupport.DecodeResponse(target, res); err != nil {
2136 return nil, err
2137 }
2138 return ret, nil
2139 }
2140
2141 type ProjectsSubscriptionsTestIamPermissionsCall struct {
2142 s *Service
2143 resource string
2144 testiampermissionsrequest *TestIamPermissionsRequest
2145 urlParams_ gensupport.URLParams
2146 ctx_ context.Context
2147 header_ http.Header
2148 }
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160 func (r *ProjectsSubscriptionsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsSubscriptionsTestIamPermissionsCall {
2161 c := &ProjectsSubscriptionsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2162 c.resource = resource
2163 c.testiampermissionsrequest = testiampermissionsrequest
2164 return c
2165 }
2166
2167
2168
2169
2170 func (c *ProjectsSubscriptionsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsTestIamPermissionsCall {
2171 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2172 return c
2173 }
2174
2175
2176 func (c *ProjectsSubscriptionsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsSubscriptionsTestIamPermissionsCall {
2177 c.ctx_ = ctx
2178 return c
2179 }
2180
2181
2182
2183 func (c *ProjectsSubscriptionsTestIamPermissionsCall) Header() http.Header {
2184 if c.header_ == nil {
2185 c.header_ = make(http.Header)
2186 }
2187 return c.header_
2188 }
2189
2190 func (c *ProjectsSubscriptionsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
2191 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2192 var body io.Reader = nil
2193 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
2194 if err != nil {
2195 return nil, err
2196 }
2197 c.urlParams_.Set("alt", alt)
2198 c.urlParams_.Set("prettyPrint", "false")
2199 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:testIamPermissions")
2200 urls += "?" + c.urlParams_.Encode()
2201 req, err := http.NewRequest("POST", urls, body)
2202 if err != nil {
2203 return nil, err
2204 }
2205 req.Header = reqHeaders
2206 googleapi.Expand(req.URL, map[string]string{
2207 "resource": c.resource,
2208 })
2209 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2210 }
2211
2212
2213
2214
2215
2216
2217
2218 func (c *ProjectsSubscriptionsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
2219 gensupport.SetOptions(c.urlParams_, opts...)
2220 res, err := c.doRequest("json")
2221 if res != nil && res.StatusCode == http.StatusNotModified {
2222 if res.Body != nil {
2223 res.Body.Close()
2224 }
2225 return nil, gensupport.WrapError(&googleapi.Error{
2226 Code: res.StatusCode,
2227 Header: res.Header,
2228 })
2229 }
2230 if err != nil {
2231 return nil, err
2232 }
2233 defer googleapi.CloseBody(res)
2234 if err := googleapi.CheckResponse(res); err != nil {
2235 return nil, gensupport.WrapError(err)
2236 }
2237 ret := &TestIamPermissionsResponse{
2238 ServerResponse: googleapi.ServerResponse{
2239 Header: res.Header,
2240 HTTPStatusCode: res.StatusCode,
2241 },
2242 }
2243 target := &ret
2244 if err := gensupport.DecodeResponse(target, res); err != nil {
2245 return nil, err
2246 }
2247 return ret, nil
2248 }
2249
2250 type ProjectsTopicsCreateCall struct {
2251 s *Service
2252 name string
2253 topic *Topic
2254 urlParams_ gensupport.URLParams
2255 ctx_ context.Context
2256 header_ http.Header
2257 }
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267 func (r *ProjectsTopicsService) Create(name string, topic *Topic) *ProjectsTopicsCreateCall {
2268 c := &ProjectsTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2269 c.name = name
2270 c.topic = topic
2271 return c
2272 }
2273
2274
2275
2276
2277 func (c *ProjectsTopicsCreateCall) Fields(s ...googleapi.Field) *ProjectsTopicsCreateCall {
2278 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2279 return c
2280 }
2281
2282
2283 func (c *ProjectsTopicsCreateCall) Context(ctx context.Context) *ProjectsTopicsCreateCall {
2284 c.ctx_ = ctx
2285 return c
2286 }
2287
2288
2289
2290 func (c *ProjectsTopicsCreateCall) Header() http.Header {
2291 if c.header_ == nil {
2292 c.header_ = make(http.Header)
2293 }
2294 return c.header_
2295 }
2296
2297 func (c *ProjectsTopicsCreateCall) doRequest(alt string) (*http.Response, error) {
2298 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2299 var body io.Reader = nil
2300 body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic)
2301 if err != nil {
2302 return nil, err
2303 }
2304 c.urlParams_.Set("alt", alt)
2305 c.urlParams_.Set("prettyPrint", "false")
2306 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}")
2307 urls += "?" + c.urlParams_.Encode()
2308 req, err := http.NewRequest("PUT", urls, body)
2309 if err != nil {
2310 return nil, err
2311 }
2312 req.Header = reqHeaders
2313 googleapi.Expand(req.URL, map[string]string{
2314 "name": c.name,
2315 })
2316 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2317 }
2318
2319
2320
2321
2322
2323
2324 func (c *ProjectsTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
2325 gensupport.SetOptions(c.urlParams_, opts...)
2326 res, err := c.doRequest("json")
2327 if res != nil && res.StatusCode == http.StatusNotModified {
2328 if res.Body != nil {
2329 res.Body.Close()
2330 }
2331 return nil, gensupport.WrapError(&googleapi.Error{
2332 Code: res.StatusCode,
2333 Header: res.Header,
2334 })
2335 }
2336 if err != nil {
2337 return nil, err
2338 }
2339 defer googleapi.CloseBody(res)
2340 if err := googleapi.CheckResponse(res); err != nil {
2341 return nil, gensupport.WrapError(err)
2342 }
2343 ret := &Topic{
2344 ServerResponse: googleapi.ServerResponse{
2345 Header: res.Header,
2346 HTTPStatusCode: res.StatusCode,
2347 },
2348 }
2349 target := &ret
2350 if err := gensupport.DecodeResponse(target, res); err != nil {
2351 return nil, err
2352 }
2353 return ret, nil
2354 }
2355
2356 type ProjectsTopicsDeleteCall struct {
2357 s *Service
2358 topic string
2359 urlParams_ gensupport.URLParams
2360 ctx_ context.Context
2361 header_ http.Header
2362 }
2363
2364
2365
2366
2367
2368
2369
2370
2371 func (r *ProjectsTopicsService) Delete(topic string) *ProjectsTopicsDeleteCall {
2372 c := &ProjectsTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2373 c.topic = topic
2374 return c
2375 }
2376
2377
2378
2379
2380 func (c *ProjectsTopicsDeleteCall) Fields(s ...googleapi.Field) *ProjectsTopicsDeleteCall {
2381 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2382 return c
2383 }
2384
2385
2386 func (c *ProjectsTopicsDeleteCall) Context(ctx context.Context) *ProjectsTopicsDeleteCall {
2387 c.ctx_ = ctx
2388 return c
2389 }
2390
2391
2392
2393 func (c *ProjectsTopicsDeleteCall) Header() http.Header {
2394 if c.header_ == nil {
2395 c.header_ = make(http.Header)
2396 }
2397 return c.header_
2398 }
2399
2400 func (c *ProjectsTopicsDeleteCall) doRequest(alt string) (*http.Response, error) {
2401 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2402 var body io.Reader = nil
2403 c.urlParams_.Set("alt", alt)
2404 c.urlParams_.Set("prettyPrint", "false")
2405 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}")
2406 urls += "?" + c.urlParams_.Encode()
2407 req, err := http.NewRequest("DELETE", urls, body)
2408 if err != nil {
2409 return nil, err
2410 }
2411 req.Header = reqHeaders
2412 googleapi.Expand(req.URL, map[string]string{
2413 "topic": c.topic,
2414 })
2415 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2416 }
2417
2418
2419
2420
2421
2422
2423 func (c *ProjectsTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2424 gensupport.SetOptions(c.urlParams_, opts...)
2425 res, err := c.doRequest("json")
2426 if res != nil && res.StatusCode == http.StatusNotModified {
2427 if res.Body != nil {
2428 res.Body.Close()
2429 }
2430 return nil, gensupport.WrapError(&googleapi.Error{
2431 Code: res.StatusCode,
2432 Header: res.Header,
2433 })
2434 }
2435 if err != nil {
2436 return nil, err
2437 }
2438 defer googleapi.CloseBody(res)
2439 if err := googleapi.CheckResponse(res); err != nil {
2440 return nil, gensupport.WrapError(err)
2441 }
2442 ret := &Empty{
2443 ServerResponse: googleapi.ServerResponse{
2444 Header: res.Header,
2445 HTTPStatusCode: res.StatusCode,
2446 },
2447 }
2448 target := &ret
2449 if err := gensupport.DecodeResponse(target, res); err != nil {
2450 return nil, err
2451 }
2452 return ret, nil
2453 }
2454
2455 type ProjectsTopicsGetCall struct {
2456 s *Service
2457 topic string
2458 urlParams_ gensupport.URLParams
2459 ifNoneMatch_ string
2460 ctx_ context.Context
2461 header_ http.Header
2462 }
2463
2464
2465
2466
2467 func (r *ProjectsTopicsService) Get(topic string) *ProjectsTopicsGetCall {
2468 c := &ProjectsTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2469 c.topic = topic
2470 return c
2471 }
2472
2473
2474
2475
2476 func (c *ProjectsTopicsGetCall) Fields(s ...googleapi.Field) *ProjectsTopicsGetCall {
2477 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2478 return c
2479 }
2480
2481
2482
2483
2484 func (c *ProjectsTopicsGetCall) IfNoneMatch(entityTag string) *ProjectsTopicsGetCall {
2485 c.ifNoneMatch_ = entityTag
2486 return c
2487 }
2488
2489
2490 func (c *ProjectsTopicsGetCall) Context(ctx context.Context) *ProjectsTopicsGetCall {
2491 c.ctx_ = ctx
2492 return c
2493 }
2494
2495
2496
2497 func (c *ProjectsTopicsGetCall) Header() http.Header {
2498 if c.header_ == nil {
2499 c.header_ = make(http.Header)
2500 }
2501 return c.header_
2502 }
2503
2504 func (c *ProjectsTopicsGetCall) doRequest(alt string) (*http.Response, error) {
2505 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2506 if c.ifNoneMatch_ != "" {
2507 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2508 }
2509 var body io.Reader = nil
2510 c.urlParams_.Set("alt", alt)
2511 c.urlParams_.Set("prettyPrint", "false")
2512 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}")
2513 urls += "?" + c.urlParams_.Encode()
2514 req, err := http.NewRequest("GET", urls, body)
2515 if err != nil {
2516 return nil, err
2517 }
2518 req.Header = reqHeaders
2519 googleapi.Expand(req.URL, map[string]string{
2520 "topic": c.topic,
2521 })
2522 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2523 }
2524
2525
2526
2527
2528
2529
2530 func (c *ProjectsTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
2531 gensupport.SetOptions(c.urlParams_, opts...)
2532 res, err := c.doRequest("json")
2533 if res != nil && res.StatusCode == http.StatusNotModified {
2534 if res.Body != nil {
2535 res.Body.Close()
2536 }
2537 return nil, gensupport.WrapError(&googleapi.Error{
2538 Code: res.StatusCode,
2539 Header: res.Header,
2540 })
2541 }
2542 if err != nil {
2543 return nil, err
2544 }
2545 defer googleapi.CloseBody(res)
2546 if err := googleapi.CheckResponse(res); err != nil {
2547 return nil, gensupport.WrapError(err)
2548 }
2549 ret := &Topic{
2550 ServerResponse: googleapi.ServerResponse{
2551 Header: res.Header,
2552 HTTPStatusCode: res.StatusCode,
2553 },
2554 }
2555 target := &ret
2556 if err := gensupport.DecodeResponse(target, res); err != nil {
2557 return nil, err
2558 }
2559 return ret, nil
2560 }
2561
2562 type ProjectsTopicsGetIamPolicyCall struct {
2563 s *Service
2564 resource string
2565 urlParams_ gensupport.URLParams
2566 ifNoneMatch_ string
2567 ctx_ context.Context
2568 header_ http.Header
2569 }
2570
2571
2572
2573
2574
2575
2576
2577 func (r *ProjectsTopicsService) GetIamPolicy(resource string) *ProjectsTopicsGetIamPolicyCall {
2578 c := &ProjectsTopicsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2579 c.resource = resource
2580 return c
2581 }
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595 func (c *ProjectsTopicsGetIamPolicyCall) OptionsRequestedPolicyVersion(optionsRequestedPolicyVersion int64) *ProjectsTopicsGetIamPolicyCall {
2596 c.urlParams_.Set("options.requestedPolicyVersion", fmt.Sprint(optionsRequestedPolicyVersion))
2597 return c
2598 }
2599
2600
2601
2602
2603 func (c *ProjectsTopicsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsTopicsGetIamPolicyCall {
2604 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2605 return c
2606 }
2607
2608
2609
2610
2611 func (c *ProjectsTopicsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsTopicsGetIamPolicyCall {
2612 c.ifNoneMatch_ = entityTag
2613 return c
2614 }
2615
2616
2617 func (c *ProjectsTopicsGetIamPolicyCall) Context(ctx context.Context) *ProjectsTopicsGetIamPolicyCall {
2618 c.ctx_ = ctx
2619 return c
2620 }
2621
2622
2623
2624 func (c *ProjectsTopicsGetIamPolicyCall) Header() http.Header {
2625 if c.header_ == nil {
2626 c.header_ = make(http.Header)
2627 }
2628 return c.header_
2629 }
2630
2631 func (c *ProjectsTopicsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
2632 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2633 if c.ifNoneMatch_ != "" {
2634 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2635 }
2636 var body io.Reader = nil
2637 c.urlParams_.Set("alt", alt)
2638 c.urlParams_.Set("prettyPrint", "false")
2639 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:getIamPolicy")
2640 urls += "?" + c.urlParams_.Encode()
2641 req, err := http.NewRequest("GET", urls, body)
2642 if err != nil {
2643 return nil, err
2644 }
2645 req.Header = reqHeaders
2646 googleapi.Expand(req.URL, map[string]string{
2647 "resource": c.resource,
2648 })
2649 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2650 }
2651
2652
2653
2654
2655
2656
2657 func (c *ProjectsTopicsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
2658 gensupport.SetOptions(c.urlParams_, opts...)
2659 res, err := c.doRequest("json")
2660 if res != nil && res.StatusCode == http.StatusNotModified {
2661 if res.Body != nil {
2662 res.Body.Close()
2663 }
2664 return nil, gensupport.WrapError(&googleapi.Error{
2665 Code: res.StatusCode,
2666 Header: res.Header,
2667 })
2668 }
2669 if err != nil {
2670 return nil, err
2671 }
2672 defer googleapi.CloseBody(res)
2673 if err := googleapi.CheckResponse(res); err != nil {
2674 return nil, gensupport.WrapError(err)
2675 }
2676 ret := &Policy{
2677 ServerResponse: googleapi.ServerResponse{
2678 Header: res.Header,
2679 HTTPStatusCode: res.StatusCode,
2680 },
2681 }
2682 target := &ret
2683 if err := gensupport.DecodeResponse(target, res); err != nil {
2684 return nil, err
2685 }
2686 return ret, nil
2687 }
2688
2689 type ProjectsTopicsListCall struct {
2690 s *Service
2691 project string
2692 urlParams_ gensupport.URLParams
2693 ifNoneMatch_ string
2694 ctx_ context.Context
2695 header_ http.Header
2696 }
2697
2698
2699
2700
2701 func (r *ProjectsTopicsService) List(project string) *ProjectsTopicsListCall {
2702 c := &ProjectsTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2703 c.project = project
2704 return c
2705 }
2706
2707
2708
2709 func (c *ProjectsTopicsListCall) PageSize(pageSize int64) *ProjectsTopicsListCall {
2710 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
2711 return c
2712 }
2713
2714
2715
2716
2717 func (c *ProjectsTopicsListCall) PageToken(pageToken string) *ProjectsTopicsListCall {
2718 c.urlParams_.Set("pageToken", pageToken)
2719 return c
2720 }
2721
2722
2723
2724
2725 func (c *ProjectsTopicsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsListCall {
2726 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2727 return c
2728 }
2729
2730
2731
2732
2733 func (c *ProjectsTopicsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsListCall {
2734 c.ifNoneMatch_ = entityTag
2735 return c
2736 }
2737
2738
2739 func (c *ProjectsTopicsListCall) Context(ctx context.Context) *ProjectsTopicsListCall {
2740 c.ctx_ = ctx
2741 return c
2742 }
2743
2744
2745
2746 func (c *ProjectsTopicsListCall) Header() http.Header {
2747 if c.header_ == nil {
2748 c.header_ = make(http.Header)
2749 }
2750 return c.header_
2751 }
2752
2753 func (c *ProjectsTopicsListCall) doRequest(alt string) (*http.Response, error) {
2754 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
2755 if c.ifNoneMatch_ != "" {
2756 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2757 }
2758 var body io.Reader = nil
2759 c.urlParams_.Set("alt", alt)
2760 c.urlParams_.Set("prettyPrint", "false")
2761 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+project}/topics")
2762 urls += "?" + c.urlParams_.Encode()
2763 req, err := http.NewRequest("GET", urls, body)
2764 if err != nil {
2765 return nil, err
2766 }
2767 req.Header = reqHeaders
2768 googleapi.Expand(req.URL, map[string]string{
2769 "project": c.project,
2770 })
2771 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2772 }
2773
2774
2775
2776
2777
2778
2779
2780 func (c *ProjectsTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicsResponse, error) {
2781 gensupport.SetOptions(c.urlParams_, opts...)
2782 res, err := c.doRequest("json")
2783 if res != nil && res.StatusCode == http.StatusNotModified {
2784 if res.Body != nil {
2785 res.Body.Close()
2786 }
2787 return nil, gensupport.WrapError(&googleapi.Error{
2788 Code: res.StatusCode,
2789 Header: res.Header,
2790 })
2791 }
2792 if err != nil {
2793 return nil, err
2794 }
2795 defer googleapi.CloseBody(res)
2796 if err := googleapi.CheckResponse(res); err != nil {
2797 return nil, gensupport.WrapError(err)
2798 }
2799 ret := &ListTopicsResponse{
2800 ServerResponse: googleapi.ServerResponse{
2801 Header: res.Header,
2802 HTTPStatusCode: res.StatusCode,
2803 },
2804 }
2805 target := &ret
2806 if err := gensupport.DecodeResponse(target, res); err != nil {
2807 return nil, err
2808 }
2809 return ret, nil
2810 }
2811
2812
2813
2814
2815 func (c *ProjectsTopicsListCall) Pages(ctx context.Context, f func(*ListTopicsResponse) error) error {
2816 c.ctx_ = ctx
2817 defer c.PageToken(c.urlParams_.Get("pageToken"))
2818 for {
2819 x, err := c.Do()
2820 if err != nil {
2821 return err
2822 }
2823 if err := f(x); err != nil {
2824 return err
2825 }
2826 if x.NextPageToken == "" {
2827 return nil
2828 }
2829 c.PageToken(x.NextPageToken)
2830 }
2831 }
2832
2833 type ProjectsTopicsPublishCall struct {
2834 s *Service
2835 topic string
2836 publishrequest *PublishRequest
2837 urlParams_ gensupport.URLParams
2838 ctx_ context.Context
2839 header_ http.Header
2840 }
2841
2842
2843
2844
2845
2846
2847 func (r *ProjectsTopicsService) Publish(topic string, publishrequest *PublishRequest) *ProjectsTopicsPublishCall {
2848 c := &ProjectsTopicsPublishCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2849 c.topic = topic
2850 c.publishrequest = publishrequest
2851 return c
2852 }
2853
2854
2855
2856
2857 func (c *ProjectsTopicsPublishCall) Fields(s ...googleapi.Field) *ProjectsTopicsPublishCall {
2858 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2859 return c
2860 }
2861
2862
2863 func (c *ProjectsTopicsPublishCall) Context(ctx context.Context) *ProjectsTopicsPublishCall {
2864 c.ctx_ = ctx
2865 return c
2866 }
2867
2868
2869
2870 func (c *ProjectsTopicsPublishCall) Header() http.Header {
2871 if c.header_ == nil {
2872 c.header_ = make(http.Header)
2873 }
2874 return c.header_
2875 }
2876
2877 func (c *ProjectsTopicsPublishCall) doRequest(alt string) (*http.Response, error) {
2878 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2879 var body io.Reader = nil
2880 body, err := googleapi.WithoutDataWrapper.JSONReader(c.publishrequest)
2881 if err != nil {
2882 return nil, err
2883 }
2884 c.urlParams_.Set("alt", alt)
2885 c.urlParams_.Set("prettyPrint", "false")
2886 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}:publish")
2887 urls += "?" + c.urlParams_.Encode()
2888 req, err := http.NewRequest("POST", urls, body)
2889 if err != nil {
2890 return nil, err
2891 }
2892 req.Header = reqHeaders
2893 googleapi.Expand(req.URL, map[string]string{
2894 "topic": c.topic,
2895 })
2896 return gensupport.SendRequest(c.ctx_, c.s.client, req)
2897 }
2898
2899
2900
2901
2902
2903
2904
2905 func (c *ProjectsTopicsPublishCall) Do(opts ...googleapi.CallOption) (*PublishResponse, error) {
2906 gensupport.SetOptions(c.urlParams_, opts...)
2907 res, err := c.doRequest("json")
2908 if res != nil && res.StatusCode == http.StatusNotModified {
2909 if res.Body != nil {
2910 res.Body.Close()
2911 }
2912 return nil, gensupport.WrapError(&googleapi.Error{
2913 Code: res.StatusCode,
2914 Header: res.Header,
2915 })
2916 }
2917 if err != nil {
2918 return nil, err
2919 }
2920 defer googleapi.CloseBody(res)
2921 if err := googleapi.CheckResponse(res); err != nil {
2922 return nil, gensupport.WrapError(err)
2923 }
2924 ret := &PublishResponse{
2925 ServerResponse: googleapi.ServerResponse{
2926 Header: res.Header,
2927 HTTPStatusCode: res.StatusCode,
2928 },
2929 }
2930 target := &ret
2931 if err := gensupport.DecodeResponse(target, res); err != nil {
2932 return nil, err
2933 }
2934 return ret, nil
2935 }
2936
2937 type ProjectsTopicsSetIamPolicyCall struct {
2938 s *Service
2939 resource string
2940 setiampolicyrequest *SetIamPolicyRequest
2941 urlParams_ gensupport.URLParams
2942 ctx_ context.Context
2943 header_ http.Header
2944 }
2945
2946
2947
2948
2949
2950
2951
2952
2953 func (r *ProjectsTopicsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsTopicsSetIamPolicyCall {
2954 c := &ProjectsTopicsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2955 c.resource = resource
2956 c.setiampolicyrequest = setiampolicyrequest
2957 return c
2958 }
2959
2960
2961
2962
2963 func (c *ProjectsTopicsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsTopicsSetIamPolicyCall {
2964 c.urlParams_.Set("fields", googleapi.CombineFields(s))
2965 return c
2966 }
2967
2968
2969 func (c *ProjectsTopicsSetIamPolicyCall) Context(ctx context.Context) *ProjectsTopicsSetIamPolicyCall {
2970 c.ctx_ = ctx
2971 return c
2972 }
2973
2974
2975
2976 func (c *ProjectsTopicsSetIamPolicyCall) Header() http.Header {
2977 if c.header_ == nil {
2978 c.header_ = make(http.Header)
2979 }
2980 return c.header_
2981 }
2982
2983 func (c *ProjectsTopicsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
2984 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
2985 var body io.Reader = nil
2986 body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
2987 if err != nil {
2988 return nil, err
2989 }
2990 c.urlParams_.Set("alt", alt)
2991 c.urlParams_.Set("prettyPrint", "false")
2992 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:setIamPolicy")
2993 urls += "?" + c.urlParams_.Encode()
2994 req, err := http.NewRequest("POST", urls, body)
2995 if err != nil {
2996 return nil, err
2997 }
2998 req.Header = reqHeaders
2999 googleapi.Expand(req.URL, map[string]string{
3000 "resource": c.resource,
3001 })
3002 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3003 }
3004
3005
3006
3007
3008
3009
3010 func (c *ProjectsTopicsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
3011 gensupport.SetOptions(c.urlParams_, opts...)
3012 res, err := c.doRequest("json")
3013 if res != nil && res.StatusCode == http.StatusNotModified {
3014 if res.Body != nil {
3015 res.Body.Close()
3016 }
3017 return nil, gensupport.WrapError(&googleapi.Error{
3018 Code: res.StatusCode,
3019 Header: res.Header,
3020 })
3021 }
3022 if err != nil {
3023 return nil, err
3024 }
3025 defer googleapi.CloseBody(res)
3026 if err := googleapi.CheckResponse(res); err != nil {
3027 return nil, gensupport.WrapError(err)
3028 }
3029 ret := &Policy{
3030 ServerResponse: googleapi.ServerResponse{
3031 Header: res.Header,
3032 HTTPStatusCode: res.StatusCode,
3033 },
3034 }
3035 target := &ret
3036 if err := gensupport.DecodeResponse(target, res); err != nil {
3037 return nil, err
3038 }
3039 return ret, nil
3040 }
3041
3042 type ProjectsTopicsTestIamPermissionsCall struct {
3043 s *Service
3044 resource string
3045 testiampermissionsrequest *TestIamPermissionsRequest
3046 urlParams_ gensupport.URLParams
3047 ctx_ context.Context
3048 header_ http.Header
3049 }
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061 func (r *ProjectsTopicsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsTopicsTestIamPermissionsCall {
3062 c := &ProjectsTopicsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3063 c.resource = resource
3064 c.testiampermissionsrequest = testiampermissionsrequest
3065 return c
3066 }
3067
3068
3069
3070
3071 func (c *ProjectsTopicsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsTopicsTestIamPermissionsCall {
3072 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3073 return c
3074 }
3075
3076
3077 func (c *ProjectsTopicsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsTopicsTestIamPermissionsCall {
3078 c.ctx_ = ctx
3079 return c
3080 }
3081
3082
3083
3084 func (c *ProjectsTopicsTestIamPermissionsCall) Header() http.Header {
3085 if c.header_ == nil {
3086 c.header_ = make(http.Header)
3087 }
3088 return c.header_
3089 }
3090
3091 func (c *ProjectsTopicsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
3092 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
3093 var body io.Reader = nil
3094 body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
3095 if err != nil {
3096 return nil, err
3097 }
3098 c.urlParams_.Set("alt", alt)
3099 c.urlParams_.Set("prettyPrint", "false")
3100 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:testIamPermissions")
3101 urls += "?" + c.urlParams_.Encode()
3102 req, err := http.NewRequest("POST", urls, body)
3103 if err != nil {
3104 return nil, err
3105 }
3106 req.Header = reqHeaders
3107 googleapi.Expand(req.URL, map[string]string{
3108 "resource": c.resource,
3109 })
3110 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3111 }
3112
3113
3114
3115
3116
3117
3118
3119 func (c *ProjectsTopicsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
3120 gensupport.SetOptions(c.urlParams_, opts...)
3121 res, err := c.doRequest("json")
3122 if res != nil && res.StatusCode == http.StatusNotModified {
3123 if res.Body != nil {
3124 res.Body.Close()
3125 }
3126 return nil, gensupport.WrapError(&googleapi.Error{
3127 Code: res.StatusCode,
3128 Header: res.Header,
3129 })
3130 }
3131 if err != nil {
3132 return nil, err
3133 }
3134 defer googleapi.CloseBody(res)
3135 if err := googleapi.CheckResponse(res); err != nil {
3136 return nil, gensupport.WrapError(err)
3137 }
3138 ret := &TestIamPermissionsResponse{
3139 ServerResponse: googleapi.ServerResponse{
3140 Header: res.Header,
3141 HTTPStatusCode: res.StatusCode,
3142 },
3143 }
3144 target := &ret
3145 if err := gensupport.DecodeResponse(target, res); err != nil {
3146 return nil, err
3147 }
3148 return ret, nil
3149 }
3150
3151 type ProjectsTopicsSubscriptionsListCall struct {
3152 s *Service
3153 topic string
3154 urlParams_ gensupport.URLParams
3155 ifNoneMatch_ string
3156 ctx_ context.Context
3157 header_ http.Header
3158 }
3159
3160
3161
3162
3163 func (r *ProjectsTopicsSubscriptionsService) List(topic string) *ProjectsTopicsSubscriptionsListCall {
3164 c := &ProjectsTopicsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3165 c.topic = topic
3166 return c
3167 }
3168
3169
3170
3171 func (c *ProjectsTopicsSubscriptionsListCall) PageSize(pageSize int64) *ProjectsTopicsSubscriptionsListCall {
3172 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
3173 return c
3174 }
3175
3176
3177
3178
3179
3180 func (c *ProjectsTopicsSubscriptionsListCall) PageToken(pageToken string) *ProjectsTopicsSubscriptionsListCall {
3181 c.urlParams_.Set("pageToken", pageToken)
3182 return c
3183 }
3184
3185
3186
3187
3188 func (c *ProjectsTopicsSubscriptionsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsSubscriptionsListCall {
3189 c.urlParams_.Set("fields", googleapi.CombineFields(s))
3190 return c
3191 }
3192
3193
3194
3195
3196 func (c *ProjectsTopicsSubscriptionsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsSubscriptionsListCall {
3197 c.ifNoneMatch_ = entityTag
3198 return c
3199 }
3200
3201
3202 func (c *ProjectsTopicsSubscriptionsListCall) Context(ctx context.Context) *ProjectsTopicsSubscriptionsListCall {
3203 c.ctx_ = ctx
3204 return c
3205 }
3206
3207
3208
3209 func (c *ProjectsTopicsSubscriptionsListCall) Header() http.Header {
3210 if c.header_ == nil {
3211 c.header_ = make(http.Header)
3212 }
3213 return c.header_
3214 }
3215
3216 func (c *ProjectsTopicsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
3217 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
3218 if c.ifNoneMatch_ != "" {
3219 reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3220 }
3221 var body io.Reader = nil
3222 c.urlParams_.Set("alt", alt)
3223 c.urlParams_.Set("prettyPrint", "false")
3224 urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}/subscriptions")
3225 urls += "?" + c.urlParams_.Encode()
3226 req, err := http.NewRequest("GET", urls, body)
3227 if err != nil {
3228 return nil, err
3229 }
3230 req.Header = reqHeaders
3231 googleapi.Expand(req.URL, map[string]string{
3232 "topic": c.topic,
3233 })
3234 return gensupport.SendRequest(c.ctx_, c.s.client, req)
3235 }
3236
3237
3238
3239
3240
3241
3242
3243 func (c *ProjectsTopicsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListTopicSubscriptionsResponse, error) {
3244 gensupport.SetOptions(c.urlParams_, opts...)
3245 res, err := c.doRequest("json")
3246 if res != nil && res.StatusCode == http.StatusNotModified {
3247 if res.Body != nil {
3248 res.Body.Close()
3249 }
3250 return nil, gensupport.WrapError(&googleapi.Error{
3251 Code: res.StatusCode,
3252 Header: res.Header,
3253 })
3254 }
3255 if err != nil {
3256 return nil, err
3257 }
3258 defer googleapi.CloseBody(res)
3259 if err := googleapi.CheckResponse(res); err != nil {
3260 return nil, gensupport.WrapError(err)
3261 }
3262 ret := &ListTopicSubscriptionsResponse{
3263 ServerResponse: googleapi.ServerResponse{
3264 Header: res.Header,
3265 HTTPStatusCode: res.StatusCode,
3266 },
3267 }
3268 target := &ret
3269 if err := gensupport.DecodeResponse(target, res); err != nil {
3270 return nil, err
3271 }
3272 return ret, nil
3273 }
3274
3275
3276
3277
3278 func (c *ProjectsTopicsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListTopicSubscriptionsResponse) error) error {
3279 c.ctx_ = ctx
3280 defer c.PageToken(c.urlParams_.Get("pageToken"))
3281 for {
3282 x, err := c.Do()
3283 if err != nil {
3284 return err
3285 }
3286 if err := f(x); err != nil {
3287 return err
3288 }
3289 if x.NextPageToken == "" {
3290 return nil
3291 }
3292 c.PageToken(x.NextPageToken)
3293 }
3294 }
3295
View as plain text