-
Notifications
You must be signed in to change notification settings - Fork 0
/
pubsub-gen.go
1143 lines (1027 loc) · 34.8 KB
/
pubsub-gen.go
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
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
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
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
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
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
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
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Package pubsub provides access to the Cloud Pub/Sub API.
//
// See https://developers.google.com/pubsub/v1beta1
//
// Usage example:
//
// import "code.google.com/p/google-api-go-client/pubsub/v1beta1"
// ...
// pubsubService, err := pubsub.New(oauthHttpClient)
package pubsub
import (
"bytes"
"code.google.com/p/google-api-go-client/googleapi"
"encoding/json"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
"strings"
)
// Always reference these packages, just in case the auto-generated code
// below doesn't.
var _ = bytes.NewBuffer
var _ = strconv.Itoa
var _ = fmt.Sprintf
var _ = json.NewDecoder
var _ = io.Copy
var _ = url.Parse
var _ = googleapi.Version
var _ = errors.New
var _ = strings.Replace
const apiId = "pubsub:v1beta1"
const apiName = "pubsub"
const apiVersion = "v1beta1"
const basePath = "https://www.googleapis.com/pubsub/v1beta1/"
// OAuth2 scopes used by this API.
const (
// View and manage your data across Google Cloud Platform services
CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
// View and manage Pub/Sub topics and subscriptions
PubsubScope = "https://www.googleapis.com/auth/pubsub"
)
func New(client *http.Client) (*Service, error) {
if client == nil {
return nil, errors.New("client is nil")
}
s := &Service{client: client, BasePath: basePath}
s.Subscriptions = NewSubscriptionsService(s)
s.Topics = NewTopicsService(s)
return s, nil
}
type Service struct {
client *http.Client
BasePath string // API endpoint base URL
Subscriptions *SubscriptionsService
Topics *TopicsService
}
func NewSubscriptionsService(s *Service) *SubscriptionsService {
rs := &SubscriptionsService{s: s}
return rs
}
type SubscriptionsService struct {
s *Service
}
func NewTopicsService(s *Service) *TopicsService {
rs := &TopicsService{s: s}
return rs
}
type TopicsService struct {
s *Service
}
type AcknowledgeRequest struct {
// AckId: The Ack ID for the message being acknowledged. This was
// returned by the Pub/Sub system in the Pull response.
AckId []string `json:"ackId,omitempty"`
// Subscription: The subscription whose message is being acknowledged.
Subscription string `json:"subscription,omitempty"`
}
type Label struct {
// Key: The key of a label is a syntactically valid URL (as per RFC
// 1738) with the "scheme" and initial slashes omitted and with the
// additional restrictions noted below. Each key should be globally
// unique. The "host" portion is called the "namespace" and is not
// necessarily resolvable to a network endpoint. Instead, the namespace
// indicates what system or entity defines the semantics of the label.
// Namespaces do not restrict the set of objects to which a label may be
// associated.
//
// Keys are defined by the following grammar:
//
// key =
// hostname "/" kpath kpath = ksegment *[ "/" ksegment ] ksegment =
// alphadigit | *[ alphadigit | "-" | "_" | "." ]
//
// where "hostname" and
// "alphadigit" are defined as in RFC 1738.
//
// Example key:
// spanner.google.com/universe
Key string `json:"key,omitempty"`
NumValue int64 `json:"numValue,omitempty,string"`
StrValue string `json:"strValue,omitempty"`
}
type ListSubscriptionsResponse struct {
// NextPageToken: If not empty, indicates that there are more
// subscriptions that match the request and this value should be passed
// to the next ListSubscriptionsRequest to continue.
NextPageToken string `json:"nextPageToken,omitempty"`
// Subscription: The subscriptions that match the request.
Subscription []*Subscription `json:"subscription,omitempty"`
}
type ListTopicsResponse struct {
// NextPageToken: If not empty, indicates that there are more topics
// that match the request, and this value should be passed to the next
// ListTopicsRequest to continue.
NextPageToken string `json:"nextPageToken,omitempty"`
// Topic: The resulting topics.
Topic []*Topic `json:"topic,omitempty"`
}
type ModifyAckDeadlineRequest struct {
// AckDeadlineSeconds: The new Ack deadline. Must be >= 1.
AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
// AckId: The Ack ID.
AckId string `json:"ackId,omitempty"`
// Subscription: The name of the subscription from which messages are
// being pulled.
Subscription string `json:"subscription,omitempty"`
}
type ModifyPushConfigRequest struct {
// PushConfig: An empty push_config indicates that the Pub/Sub system
// should pause pushing messages from the given subscription.
PushConfig *PushConfig `json:"pushConfig,omitempty"`
// Subscription: The name of the subscription.
Subscription string `json:"subscription,omitempty"`
}
type PublishRequest struct {
// Message: The message to publish.
Message *PubsubMessage `json:"message,omitempty"`
// Topic: The name of the topic for which the message is being added.
Topic string `json:"topic,omitempty"`
}
type PubsubEvent struct {
// Deleted: Indicates that this subscription has been deleted. (Note
// that pull subscribers will always receive NOT_FOUND in response in
// their pull request on the subscription, rather than seeing this
// boolean.)
Deleted bool `json:"deleted,omitempty"`
// Message: A received message.
Message *PubsubMessage `json:"message,omitempty"`
// Subscription: The subscription that received the event.
Subscription string `json:"subscription,omitempty"`
// Truncated: Indicates that this subscription has been truncated.
Truncated bool `json:"truncated,omitempty"`
}
type PubsubMessage struct {
// Data: The message payload.
Data string `json:"data,omitempty"`
// Label: Optional list of labels for this message. Keys in this
// collection must be unique.
Label []*Label `json:"label,omitempty"`
}
type PullRequest struct {
// ReturnImmediately: If this is specified as true the system will
// respond immediately even if it is not able to return a message in the
// Pull response. Otherwise the system is allowed to wait until at least
// one message is available rather than returning FAILED_PRECONDITION.
// The client may cancel the request if it does not wish to wait any
// longer for the response.
ReturnImmediately bool `json:"returnImmediately,omitempty"`
// Subscription: The subscription from which a message should be pulled.
Subscription string `json:"subscription,omitempty"`
}
type PullResponse struct {
// AckId: This ID must be used to acknowledge the received event or
// message.
AckId string `json:"ackId,omitempty"`
// PubsubEvent: A pubsub message or truncation event.
PubsubEvent *PubsubEvent `json:"pubsubEvent,omitempty"`
}
type PushConfig struct {
// PushEndpoint: A URL locating the endpoint to which messages should be
// pushed. For example, a Webhook endpoint might use
// "https://example.com/push".
PushEndpoint string `json:"pushEndpoint,omitempty"`
}
type Subscription struct {
// AckDeadlineSeconds: For either push or pull delivery, the value is
// the maximum time after a subscriber receives a message before the
// subscriber should acknowledge or Nack the message. If the Ack
// deadline for a message passes without an Ack or a Nack, the Pub/Sub
// system will eventually redeliver the message. If a subscriber
// acknowledges after the deadline, the Pub/Sub system may accept the
// Ack, but it is possible that the message has been already delivered
// again. Multiple Acks to the message are allowed and will
// succeed.
//
// For push delivery, this value is used to set the request
// timeout for the call to the push endpoint.
//
// For pull delivery, this
// value is used as the initial value for the Ack deadline. It may be
// overridden for a specific pull request (message) with
// ModifyAckDeadline. While a message is outstanding (i.e. it has been
// delivered to a pull subscriber and the subscriber has not yet Acked
// or Nacked), the Pub/Sub system will not deliver that message to
// another pull subscriber (on a best-effort basis).
AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
// Name: Name of the subscription.
Name string `json:"name,omitempty"`
// PushConfig: If push delivery is used with this subscription, this
// field is used to configure it.
PushConfig *PushConfig `json:"pushConfig,omitempty"`
// Topic: The name of the topic from which this subscription is
// receiving messages.
Topic string `json:"topic,omitempty"`
}
type Topic struct {
// Name: Name of the topic.
Name string `json:"name,omitempty"`
}
// method id "pubsub.subscriptions.acknowledge":
type SubscriptionsAcknowledgeCall struct {
s *Service
acknowledgerequest *AcknowledgeRequest
opt_ map[string]interface{}
}
// Acknowledge: Acknowledges a particular received message: the Pub/Sub
// system can remove the given message from the subscription.
// Acknowledging a message whose Ack deadline has expired may succeed,
// but the message could have been already redelivered. Acknowledging a
// message more than once will not result in an error. This is only used
// for messages received via pull.
func (r *SubscriptionsService) Acknowledge(acknowledgerequest *AcknowledgeRequest) *SubscriptionsAcknowledgeCall {
c := &SubscriptionsAcknowledgeCall{s: r.s, opt_: make(map[string]interface{})}
c.acknowledgerequest = acknowledgerequest
return c
}
func (c *SubscriptionsAcknowledgeCall) Do() error {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.acknowledgerequest)
if err != nil {
return err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", "json")
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions/acknowledge")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return err
}
return nil
// {
// "description": "Acknowledges a particular received message: the Pub/Sub system can remove the given message from the subscription. Acknowledging a message whose Ack deadline has expired may succeed, but the message could have been already redelivered. Acknowledging a message more than once will not result in an error. This is only used for messages received via pull.",
// "httpMethod": "POST",
// "id": "pubsub.subscriptions.acknowledge",
// "path": "subscriptions/acknowledge",
// "request": {
// "$ref": "AcknowledgeRequest"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/pubsub"
// ]
// }
}
// method id "pubsub.subscriptions.create":
type SubscriptionsCreateCall struct {
s *Service
subscription *Subscription
opt_ map[string]interface{}
}
// Create: Creates a subscription on a given topic for a given
// subscriber. If the subscription already exists, returns
// ALREADY_EXISTS. If the corresponding topic doesn't exist, returns
// NOT_FOUND.
func (r *SubscriptionsService) Create(subscription *Subscription) *SubscriptionsCreateCall {
c := &SubscriptionsCreateCall{s: r.s, opt_: make(map[string]interface{})}
c.subscription = subscription
return c
}
func (c *SubscriptionsCreateCall) Do() (*Subscription, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", "json")
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *Subscription
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Creates a subscription on a given topic for a given subscriber. If the subscription already exists, returns ALREADY_EXISTS. If the corresponding topic doesn't exist, returns NOT_FOUND.",
// "httpMethod": "POST",
// "id": "pubsub.subscriptions.create",
// "path": "subscriptions",
// "request": {
// "$ref": "Subscription"
// },
// "response": {
// "$ref": "Subscription"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/pubsub"
// ]
// }
}
// method id "pubsub.subscriptions.delete":
type SubscriptionsDeleteCall struct {
s *Service
subscription string
opt_ map[string]interface{}
}
// Delete: Deletes an existing subscription. All pending messages in the
// subscription are immediately dropped. Calls to Pull after deletion
// will return NOT_FOUND.
func (r *SubscriptionsService) Delete(subscription string) *SubscriptionsDeleteCall {
c := &SubscriptionsDeleteCall{s: r.s, opt_: make(map[string]interface{})}
c.subscription = subscription
return c
}
func (c *SubscriptionsDeleteCall) Do() error {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions/{+subscription}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("DELETE", urls, body)
req.URL.Path = strings.Replace(req.URL.Path, "{subscription}", url.QueryEscape(c.subscription), 1)
googleapi.SetOpaque(req.URL)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return err
}
return nil
// {
// "description": "Deletes an existing subscription. All pending messages in the subscription are immediately dropped. Calls to Pull after deletion will return NOT_FOUND.",
// "httpMethod": "DELETE",
// "id": "pubsub.subscriptions.delete",
// "parameterOrder": [
// "subscription"
// ],
// "parameters": {
// "subscription": {
// "description": "The subscription to delete.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "subscriptions/{+subscription}",
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/pubsub"
// ]
// }
}
// method id "pubsub.subscriptions.get":
type SubscriptionsGetCall struct {
s *Service
subscription string
opt_ map[string]interface{}
}
// Get: Gets the configuration details of a subscription.
func (r *SubscriptionsService) Get(subscription string) *SubscriptionsGetCall {
c := &SubscriptionsGetCall{s: r.s, opt_: make(map[string]interface{})}
c.subscription = subscription
return c
}
func (c *SubscriptionsGetCall) Do() (*Subscription, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions/{+subscription}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.URL.Path = strings.Replace(req.URL.Path, "{subscription}", url.QueryEscape(c.subscription), 1)
googleapi.SetOpaque(req.URL)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *Subscription
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Gets the configuration details of a subscription.",
// "httpMethod": "GET",
// "id": "pubsub.subscriptions.get",
// "parameterOrder": [
// "subscription"
// ],
// "parameters": {
// "subscription": {
// "description": "The name of the subscription to get.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "subscriptions/{+subscription}",
// "response": {
// "$ref": "Subscription"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/pubsub"
// ]
// }
}
// method id "pubsub.subscriptions.list":
type SubscriptionsListCall struct {
s *Service
opt_ map[string]interface{}
}
// List: Lists matching subscriptions.
func (r *SubscriptionsService) List() *SubscriptionsListCall {
c := &SubscriptionsListCall{s: r.s, opt_: make(map[string]interface{})}
return c
}
// MaxResults sets the optional parameter "maxResults": Maximum number
// of subscriptions to return.
func (c *SubscriptionsListCall) MaxResults(maxResults int64) *SubscriptionsListCall {
c.opt_["maxResults"] = maxResults
return c
}
// PageToken sets the optional parameter "pageToken": The value obtained
// in the last ListSubscriptionsResponse for continuation.
func (c *SubscriptionsListCall) PageToken(pageToken string) *SubscriptionsListCall {
c.opt_["pageToken"] = pageToken
return c
}
// Query sets the optional parameter "query": A valid label query
// expression.
func (c *SubscriptionsListCall) Query(query string) *SubscriptionsListCall {
c.opt_["query"] = query
return c
}
func (c *SubscriptionsListCall) Do() (*ListSubscriptionsResponse, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
if v, ok := c.opt_["maxResults"]; ok {
params.Set("maxResults", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["pageToken"]; ok {
params.Set("pageToken", fmt.Sprintf("%v", v))
}
if v, ok := c.opt_["query"]; ok {
params.Set("query", fmt.Sprintf("%v", v))
}
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *ListSubscriptionsResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Lists matching subscriptions.",
// "httpMethod": "GET",
// "id": "pubsub.subscriptions.list",
// "parameters": {
// "maxResults": {
// "description": "Maximum number of subscriptions to return.",
// "format": "int32",
// "location": "query",
// "type": "integer"
// },
// "pageToken": {
// "description": "The value obtained in the last ListSubscriptionsResponse for continuation.",
// "location": "query",
// "type": "string"
// },
// "query": {
// "description": "A valid label query expression.",
// "location": "query",
// "type": "string"
// }
// },
// "path": "subscriptions",
// "response": {
// "$ref": "ListSubscriptionsResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/pubsub"
// ]
// }
}
// method id "pubsub.subscriptions.modifyAckDeadline":
type SubscriptionsModifyAckDeadlineCall struct {
s *Service
modifyackdeadlinerequest *ModifyAckDeadlineRequest
opt_ map[string]interface{}
}
// ModifyAckDeadline: Modifies the Ack deadline for a message received
// from a pull request.
func (r *SubscriptionsService) ModifyAckDeadline(modifyackdeadlinerequest *ModifyAckDeadlineRequest) *SubscriptionsModifyAckDeadlineCall {
c := &SubscriptionsModifyAckDeadlineCall{s: r.s, opt_: make(map[string]interface{})}
c.modifyackdeadlinerequest = modifyackdeadlinerequest
return c
}
func (c *SubscriptionsModifyAckDeadlineCall) Do() error {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyackdeadlinerequest)
if err != nil {
return err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", "json")
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions/modifyAckDeadline")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return err
}
return nil
// {
// "description": "Modifies the Ack deadline for a message received from a pull request.",
// "httpMethod": "POST",
// "id": "pubsub.subscriptions.modifyAckDeadline",
// "path": "subscriptions/modifyAckDeadline",
// "request": {
// "$ref": "ModifyAckDeadlineRequest"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/pubsub"
// ]
// }
}
// method id "pubsub.subscriptions.modifyPushConfig":
type SubscriptionsModifyPushConfigCall struct {
s *Service
modifypushconfigrequest *ModifyPushConfigRequest
opt_ map[string]interface{}
}
// ModifyPushConfig: Modifies the PushConfig for a specified
// subscription. This method can be used to suspend the flow of messages
// to an end point by clearing the PushConfig field in the request.
// Messages will be accumulated for delivery even if no push
// configuration is defined or while the configuration is modified.
func (r *SubscriptionsService) ModifyPushConfig(modifypushconfigrequest *ModifyPushConfigRequest) *SubscriptionsModifyPushConfigCall {
c := &SubscriptionsModifyPushConfigCall{s: r.s, opt_: make(map[string]interface{})}
c.modifypushconfigrequest = modifypushconfigrequest
return c
}
func (c *SubscriptionsModifyPushConfigCall) Do() error {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifypushconfigrequest)
if err != nil {
return err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", "json")
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions/modifyPushConfig")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return err
}
return nil
// {
// "description": "Modifies the PushConfig for a specified subscription. This method can be used to suspend the flow of messages to an end point by clearing the PushConfig field in the request. Messages will be accumulated for delivery even if no push configuration is defined or while the configuration is modified.",
// "httpMethod": "POST",
// "id": "pubsub.subscriptions.modifyPushConfig",
// "path": "subscriptions/modifyPushConfig",
// "request": {
// "$ref": "ModifyPushConfigRequest"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/pubsub"
// ]
// }
}
// method id "pubsub.subscriptions.pull":
type SubscriptionsPullCall struct {
s *Service
pullrequest *PullRequest
opt_ map[string]interface{}
}
// Pull: Pulls a single message from the server. If return_immediately
// is true, and no messages are available in the subscription, this
// method returns FAILED_PRECONDITION. The system is free to return an
// UNAVAILABLE error if no messages are available in a reasonable amount
// of time (to reduce system load).
func (r *SubscriptionsService) Pull(pullrequest *PullRequest) *SubscriptionsPullCall {
c := &SubscriptionsPullCall{s: r.s, opt_: make(map[string]interface{})}
c.pullrequest = pullrequest
return c
}
func (c *SubscriptionsPullCall) Do() (*PullResponse, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.pullrequest)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", "json")
urls := googleapi.ResolveRelative(c.s.BasePath, "subscriptions/pull")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *PullResponse
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Pulls a single message from the server. If return_immediately is true, and no messages are available in the subscription, this method returns FAILED_PRECONDITION. The system is free to return an UNAVAILABLE error if no messages are available in a reasonable amount of time (to reduce system load).",
// "httpMethod": "POST",
// "id": "pubsub.subscriptions.pull",
// "path": "subscriptions/pull",
// "request": {
// "$ref": "PullRequest"
// },
// "response": {
// "$ref": "PullResponse"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/pubsub"
// ]
// }
}
// method id "pubsub.topics.create":
type TopicsCreateCall struct {
s *Service
topic *Topic
opt_ map[string]interface{}
}
// Create: Creates the given topic with the given name.
func (r *TopicsService) Create(topic *Topic) *TopicsCreateCall {
c := &TopicsCreateCall{s: r.s, opt_: make(map[string]interface{})}
c.topic = topic
return c
}
func (c *TopicsCreateCall) Do() (*Topic, error) {
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic)
if err != nil {
return nil, err
}
ctype := "application/json"
params := make(url.Values)
params.Set("alt", "json")
urls := googleapi.ResolveRelative(c.s.BasePath, "topics")
urls += "?" + params.Encode()
req, _ := http.NewRequest("POST", urls, body)
googleapi.SetOpaque(req.URL)
req.Header.Set("Content-Type", ctype)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *Topic
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Creates the given topic with the given name.",
// "httpMethod": "POST",
// "id": "pubsub.topics.create",
// "path": "topics",
// "request": {
// "$ref": "Topic"
// },
// "response": {
// "$ref": "Topic"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/pubsub"
// ]
// }
}
// method id "pubsub.topics.delete":
type TopicsDeleteCall struct {
s *Service
topic string
opt_ map[string]interface{}
}
// Delete: Deletes the topic with the given name. All subscriptions to
// this topic are also deleted. Returns NOT_FOUND if the topic does not
// exist. After a topic is deleted, a new topic may be created with the
// same name.
func (r *TopicsService) Delete(topic string) *TopicsDeleteCall {
c := &TopicsDeleteCall{s: r.s, opt_: make(map[string]interface{})}
c.topic = topic
return c
}
func (c *TopicsDeleteCall) Do() error {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
urls := googleapi.ResolveRelative(c.s.BasePath, "topics/{+topic}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("DELETE", urls, body)
req.URL.Path = strings.Replace(req.URL.Path, "{topic}", url.QueryEscape(c.topic), 1)
googleapi.SetOpaque(req.URL)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return err
}
return nil
// {
// "description": "Deletes the topic with the given name. All subscriptions to this topic are also deleted. Returns NOT_FOUND if the topic does not exist. After a topic is deleted, a new topic may be created with the same name.",
// "httpMethod": "DELETE",
// "id": "pubsub.topics.delete",
// "parameterOrder": [
// "topic"
// ],
// "parameters": {
// "topic": {
// "description": "Name of the topic to delete.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "topics/{+topic}",
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/pubsub"
// ]
// }
}
// method id "pubsub.topics.get":
type TopicsGetCall struct {
s *Service
topic string
opt_ map[string]interface{}
}
// Get: Gets the configuration of a topic. Since the topic only has the
// name attribute, this method is only useful to check the existence of
// a topic. If other attributes are added in the future, they will be
// returned here.
func (r *TopicsService) Get(topic string) *TopicsGetCall {
c := &TopicsGetCall{s: r.s, opt_: make(map[string]interface{})}
c.topic = topic
return c
}
func (c *TopicsGetCall) Do() (*Topic, error) {
var body io.Reader = nil
params := make(url.Values)
params.Set("alt", "json")
urls := googleapi.ResolveRelative(c.s.BasePath, "topics/{+topic}")
urls += "?" + params.Encode()
req, _ := http.NewRequest("GET", urls, body)
req.URL.Path = strings.Replace(req.URL.Path, "{topic}", url.QueryEscape(c.topic), 1)
googleapi.SetOpaque(req.URL)
req.Header.Set("User-Agent", "google-api-go-client/0.5")
res, err := c.s.client.Do(req)
if err != nil {
return nil, err
}
defer googleapi.CloseBody(res)
if err := googleapi.CheckResponse(res); err != nil {
return nil, err
}
var ret *Topic
if err := json.NewDecoder(res.Body).Decode(&ret); err != nil {
return nil, err
}
return ret, nil
// {
// "description": "Gets the configuration of a topic. Since the topic only has the name attribute, this method is only useful to check the existence of a topic. If other attributes are added in the future, they will be returned here.",
// "httpMethod": "GET",
// "id": "pubsub.topics.get",
// "parameterOrder": [
// "topic"
// ],
// "parameters": {
// "topic": {
// "description": "The name of the topic to get.",
// "location": "path",
// "required": true,
// "type": "string"
// }
// },
// "path": "topics/{+topic}",
// "response": {
// "$ref": "Topic"
// },
// "scopes": [
// "https://www.googleapis.com/auth/cloud-platform",
// "https://www.googleapis.com/auth/pubsub"
// ]
// }
}
// method id "pubsub.topics.list":
type TopicsListCall struct {
s *Service
opt_ map[string]interface{}
}
// List: Lists matching topics.
func (r *TopicsService) List() *TopicsListCall {
c := &TopicsListCall{s: r.s, opt_: make(map[string]interface{})}
return c