1// Package pubsub provides access to the Cloud Pub/Sub API.
2//
3// See https://cloud.google.com/pubsub/docs
4//
5// Usage example:
6//
7//   import "google.golang.org/api/pubsub/v1beta2"
8//   ...
9//   pubsubService, err := pubsub.New(oauthHttpClient)
10package pubsub // import "google.golang.org/api/pubsub/v1beta2"
11
12import (
13	"bytes"
14	"encoding/json"
15	"errors"
16	"fmt"
17	context "golang.org/x/net/context"
18	ctxhttp "golang.org/x/net/context/ctxhttp"
19	gensupport "google.golang.org/api/gensupport"
20	googleapi "google.golang.org/api/googleapi"
21	"io"
22	"net/http"
23	"net/url"
24	"strconv"
25	"strings"
26)
27
28// Always reference these packages, just in case the auto-generated code
29// below doesn't.
30var _ = bytes.NewBuffer
31var _ = strconv.Itoa
32var _ = fmt.Sprintf
33var _ = json.NewDecoder
34var _ = io.Copy
35var _ = url.Parse
36var _ = gensupport.MarshalJSON
37var _ = googleapi.Version
38var _ = errors.New
39var _ = strings.Replace
40var _ = context.Canceled
41var _ = ctxhttp.Do
42
43const apiId = "pubsub:v1beta2"
44const apiName = "pubsub"
45const apiVersion = "v1beta2"
46const basePath = "https://pubsub.googleapis.com/"
47
48// OAuth2 scopes used by this API.
49const (
50	// View and manage your data across Google Cloud Platform services
51	CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
52
53	// View and manage Pub/Sub topics and subscriptions
54	PubsubScope = "https://www.googleapis.com/auth/pubsub"
55)
56
57func New(client *http.Client) (*Service, error) {
58	if client == nil {
59		return nil, errors.New("client is nil")
60	}
61	s := &Service{client: client, BasePath: basePath}
62	s.Projects = NewProjectsService(s)
63	return s, nil
64}
65
66type Service struct {
67	client    *http.Client
68	BasePath  string // API endpoint base URL
69	UserAgent string // optional additional User-Agent fragment
70
71	Projects *ProjectsService
72}
73
74func (s *Service) userAgent() string {
75	if s.UserAgent == "" {
76		return googleapi.UserAgent
77	}
78	return googleapi.UserAgent + " " + s.UserAgent
79}
80
81func NewProjectsService(s *Service) *ProjectsService {
82	rs := &ProjectsService{s: s}
83	rs.Subscriptions = NewProjectsSubscriptionsService(s)
84	rs.Topics = NewProjectsTopicsService(s)
85	return rs
86}
87
88type ProjectsService struct {
89	s *Service
90
91	Subscriptions *ProjectsSubscriptionsService
92
93	Topics *ProjectsTopicsService
94}
95
96func NewProjectsSubscriptionsService(s *Service) *ProjectsSubscriptionsService {
97	rs := &ProjectsSubscriptionsService{s: s}
98	return rs
99}
100
101type ProjectsSubscriptionsService struct {
102	s *Service
103}
104
105func NewProjectsTopicsService(s *Service) *ProjectsTopicsService {
106	rs := &ProjectsTopicsService{s: s}
107	rs.Subscriptions = NewProjectsTopicsSubscriptionsService(s)
108	return rs
109}
110
111type ProjectsTopicsService struct {
112	s *Service
113
114	Subscriptions *ProjectsTopicsSubscriptionsService
115}
116
117func NewProjectsTopicsSubscriptionsService(s *Service) *ProjectsTopicsSubscriptionsService {
118	rs := &ProjectsTopicsSubscriptionsService{s: s}
119	return rs
120}
121
122type ProjectsTopicsSubscriptionsService struct {
123	s *Service
124}
125
126// AcknowledgeRequest: Request for the Acknowledge method.
127type AcknowledgeRequest struct {
128	// AckIds: The acknowledgment ID for the messages being acknowledged
129	// that was returned
130	// by the Pub/Sub system in the `Pull` response. Must not be empty.
131	AckIds []string `json:"ackIds,omitempty"`
132
133	// ForceSendFields is a list of field names (e.g. "AckIds") to
134	// unconditionally include in API requests. By default, fields with
135	// empty values are omitted from API requests. However, any non-pointer,
136	// non-interface field appearing in ForceSendFields will be sent to the
137	// server regardless of whether the field is empty or not. This may be
138	// used to include empty fields in Patch requests.
139	ForceSendFields []string `json:"-"`
140
141	// NullFields is a list of field names (e.g. "AckIds") to include in API
142	// requests with the JSON null value. By default, fields with empty
143	// values are omitted from API requests. However, any field with an
144	// empty value appearing in NullFields will be sent to the server as
145	// null. It is an error if a field in this list has a non-empty value.
146	// This may be used to include null fields in Patch requests.
147	NullFields []string `json:"-"`
148}
149
150func (s *AcknowledgeRequest) MarshalJSON() ([]byte, error) {
151	type NoMethod AcknowledgeRequest
152	raw := NoMethod(*s)
153	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
154}
155
156// Binding: Associates `members` with a `role`.
157type Binding struct {
158	// Members: Specifies the identities requesting access for a Cloud
159	// Platform resource.
160	// `members` can have the following values:
161	//
162	// * `allUsers`: A special identifier that represents anyone who is
163	//    on the internet; with or without a Google account.
164	//
165	// * `allAuthenticatedUsers`: A special identifier that represents
166	// anyone
167	//    who is authenticated with a Google account or a service
168	// account.
169	//
170	// * `user:{emailid}`: An email address that represents a specific
171	// Google
172	//    account. For example, `alice@gmail.com` .
173	//
174	//
175	// * `serviceAccount:{emailid}`: An email address that represents a
176	// service
177	//    account. For example,
178	// `my-other-app@appspot.gserviceaccount.com`.
179	//
180	// * `group:{emailid}`: An email address that represents a Google
181	// group.
182	//    For example, `admins@example.com`.
183	//
184	//
185	// * `domain:{domain}`: A Google Apps domain name that represents all
186	// the
187	//    users of that domain. For example, `google.com` or
188	// `example.com`.
189	//
190	//
191	Members []string `json:"members,omitempty"`
192
193	// Role: Role that is assigned to `members`.
194	// For example, `roles/viewer`, `roles/editor`, or
195	// `roles/owner`.
196	// Required
197	Role string `json:"role,omitempty"`
198
199	// ForceSendFields is a list of field names (e.g. "Members") to
200	// unconditionally include in API requests. By default, fields with
201	// empty values are omitted from API requests. However, any non-pointer,
202	// non-interface field appearing in ForceSendFields will be sent to the
203	// server regardless of whether the field is empty or not. This may be
204	// used to include empty fields in Patch requests.
205	ForceSendFields []string `json:"-"`
206
207	// NullFields is a list of field names (e.g. "Members") to include in
208	// API requests with the JSON null value. By default, fields with empty
209	// values are omitted from API requests. However, any field with an
210	// empty value appearing in NullFields will be sent to the server as
211	// null. It is an error if a field in this list has a non-empty value.
212	// This may be used to include null fields in Patch requests.
213	NullFields []string `json:"-"`
214}
215
216func (s *Binding) MarshalJSON() ([]byte, error) {
217	type NoMethod Binding
218	raw := NoMethod(*s)
219	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
220}
221
222// Empty: A generic empty message that you can re-use to avoid defining
223// duplicated
224// empty messages in your APIs. A typical example is to use it as the
225// request
226// or the response type of an API method. For instance:
227//
228//     service Foo {
229//       rpc Bar(google.protobuf.Empty) returns
230// (google.protobuf.Empty);
231//     }
232//
233// The JSON representation for `Empty` is empty JSON object `{}`.
234type Empty struct {
235	// ServerResponse contains the HTTP response code and headers from the
236	// server.
237	googleapi.ServerResponse `json:"-"`
238}
239
240// ListSubscriptionsResponse: Response for the `ListSubscriptions`
241// method.
242type ListSubscriptionsResponse struct {
243	// NextPageToken: If not empty, indicates that there may be more
244	// subscriptions that match
245	// the request; this value should be passed in a
246	// new
247	// `ListSubscriptionsRequest` to get more subscriptions.
248	NextPageToken string `json:"nextPageToken,omitempty"`
249
250	// Subscriptions: The subscriptions that match the request.
251	Subscriptions []*Subscription `json:"subscriptions,omitempty"`
252
253	// ServerResponse contains the HTTP response code and headers from the
254	// server.
255	googleapi.ServerResponse `json:"-"`
256
257	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
258	// unconditionally include in API requests. By default, fields with
259	// empty values are omitted from API requests. However, any non-pointer,
260	// non-interface field appearing in ForceSendFields will be sent to the
261	// server regardless of whether the field is empty or not. This may be
262	// used to include empty fields in Patch requests.
263	ForceSendFields []string `json:"-"`
264
265	// NullFields is a list of field names (e.g. "NextPageToken") to include
266	// in API requests with the JSON null value. By default, fields with
267	// empty values are omitted from API requests. However, any field with
268	// an empty value appearing in NullFields will be sent to the server as
269	// null. It is an error if a field in this list has a non-empty value.
270	// This may be used to include null fields in Patch requests.
271	NullFields []string `json:"-"`
272}
273
274func (s *ListSubscriptionsResponse) MarshalJSON() ([]byte, error) {
275	type NoMethod ListSubscriptionsResponse
276	raw := NoMethod(*s)
277	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
278}
279
280// ListTopicSubscriptionsResponse: Response for the
281// `ListTopicSubscriptions` method.
282type ListTopicSubscriptionsResponse struct {
283	// NextPageToken: If not empty, indicates that there may be more
284	// subscriptions that match
285	// the request; this value should be passed in a
286	// new
287	// `ListTopicSubscriptionsRequest` to get more subscriptions.
288	NextPageToken string `json:"nextPageToken,omitempty"`
289
290	// Subscriptions: The names of the subscriptions that match the request.
291	Subscriptions []string `json:"subscriptions,omitempty"`
292
293	// ServerResponse contains the HTTP response code and headers from the
294	// server.
295	googleapi.ServerResponse `json:"-"`
296
297	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
298	// unconditionally include in API requests. By default, fields with
299	// empty values are omitted from API requests. However, any non-pointer,
300	// non-interface field appearing in ForceSendFields will be sent to the
301	// server regardless of whether the field is empty or not. This may be
302	// used to include empty fields in Patch requests.
303	ForceSendFields []string `json:"-"`
304
305	// NullFields is a list of field names (e.g. "NextPageToken") to include
306	// in API requests with the JSON null value. By default, fields with
307	// empty values are omitted from API requests. However, any field with
308	// an empty value appearing in NullFields will be sent to the server as
309	// null. It is an error if a field in this list has a non-empty value.
310	// This may be used to include null fields in Patch requests.
311	NullFields []string `json:"-"`
312}
313
314func (s *ListTopicSubscriptionsResponse) MarshalJSON() ([]byte, error) {
315	type NoMethod ListTopicSubscriptionsResponse
316	raw := NoMethod(*s)
317	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
318}
319
320// ListTopicsResponse: Response for the `ListTopics` method.
321type ListTopicsResponse struct {
322	// NextPageToken: If not empty, indicates that there may be more topics
323	// that match the
324	// request; this value should be passed in a new `ListTopicsRequest`.
325	NextPageToken string `json:"nextPageToken,omitempty"`
326
327	// Topics: The resulting topics.
328	Topics []*Topic `json:"topics,omitempty"`
329
330	// ServerResponse contains the HTTP response code and headers from the
331	// server.
332	googleapi.ServerResponse `json:"-"`
333
334	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
335	// unconditionally include in API requests. By default, fields with
336	// empty values are omitted from API requests. However, any non-pointer,
337	// non-interface field appearing in ForceSendFields will be sent to the
338	// server regardless of whether the field is empty or not. This may be
339	// used to include empty fields in Patch requests.
340	ForceSendFields []string `json:"-"`
341
342	// NullFields is a list of field names (e.g. "NextPageToken") to include
343	// in API requests with the JSON null value. By default, fields with
344	// empty values are omitted from API requests. However, any field with
345	// an empty value appearing in NullFields will be sent to the server as
346	// null. It is an error if a field in this list has a non-empty value.
347	// This may be used to include null fields in Patch requests.
348	NullFields []string `json:"-"`
349}
350
351func (s *ListTopicsResponse) MarshalJSON() ([]byte, error) {
352	type NoMethod ListTopicsResponse
353	raw := NoMethod(*s)
354	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
355}
356
357// ModifyAckDeadlineRequest: Request for the ModifyAckDeadline method.
358type ModifyAckDeadlineRequest struct {
359	// AckDeadlineSeconds: The new ack deadline with respect to the time
360	// this request was sent to
361	// the Pub/Sub system. Must be >= 0. For example, if the value is 10,
362	// the new
363	// ack deadline will expire 10 seconds after the `ModifyAckDeadline`
364	// call
365	// was made. Specifying zero may immediately make the message available
366	// for
367	// another pull request.
368	AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
369
370	// AckId: The acknowledgment ID. Either this or ack_ids must be
371	// populated, but not
372	// both.
373	AckId string `json:"ackId,omitempty"`
374
375	// AckIds: List of acknowledgment IDs.
376	AckIds []string `json:"ackIds,omitempty"`
377
378	// ForceSendFields is a list of field names (e.g. "AckDeadlineSeconds")
379	// to unconditionally include in API requests. By default, fields with
380	// empty values are omitted from API requests. However, any non-pointer,
381	// non-interface field appearing in ForceSendFields will be sent to the
382	// server regardless of whether the field is empty or not. This may be
383	// used to include empty fields in Patch requests.
384	ForceSendFields []string `json:"-"`
385
386	// NullFields is a list of field names (e.g. "AckDeadlineSeconds") to
387	// include in API requests with the JSON null value. By default, fields
388	// with empty values are omitted from API requests. However, any field
389	// with an empty value appearing in NullFields will be sent to the
390	// server as null. It is an error if a field in this list has a
391	// non-empty value. This may be used to include null fields in Patch
392	// requests.
393	NullFields []string `json:"-"`
394}
395
396func (s *ModifyAckDeadlineRequest) MarshalJSON() ([]byte, error) {
397	type NoMethod ModifyAckDeadlineRequest
398	raw := NoMethod(*s)
399	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
400}
401
402// ModifyPushConfigRequest: Request for the ModifyPushConfig method.
403type ModifyPushConfigRequest struct {
404	// PushConfig: The push configuration for future deliveries.
405	//
406	// An empty `pushConfig` indicates that the Pub/Sub system should
407	// stop pushing messages from the given subscription and allow
408	// messages to be pulled and acknowledged - effectively pausing
409	// the subscription if `Pull` is not called.
410	PushConfig *PushConfig `json:"pushConfig,omitempty"`
411
412	// ForceSendFields is a list of field names (e.g. "PushConfig") to
413	// unconditionally include in API requests. By default, fields with
414	// empty values are omitted from API requests. However, any non-pointer,
415	// non-interface field appearing in ForceSendFields will be sent to the
416	// server regardless of whether the field is empty or not. This may be
417	// used to include empty fields in Patch requests.
418	ForceSendFields []string `json:"-"`
419
420	// NullFields is a list of field names (e.g. "PushConfig") to include in
421	// API requests with the JSON null value. By default, fields with empty
422	// values are omitted from API requests. However, any field with an
423	// empty value appearing in NullFields will be sent to the server as
424	// null. It is an error if a field in this list has a non-empty value.
425	// This may be used to include null fields in Patch requests.
426	NullFields []string `json:"-"`
427}
428
429func (s *ModifyPushConfigRequest) MarshalJSON() ([]byte, error) {
430	type NoMethod ModifyPushConfigRequest
431	raw := NoMethod(*s)
432	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
433}
434
435// Policy: Defines an Identity and Access Management (IAM) policy. It is
436// used to
437// specify access control policies for Cloud Platform resources.
438//
439//
440// A `Policy` consists of a list of `bindings`. A `binding` binds a list
441// of
442// `members` to a `role`, where the members can be user accounts, Google
443// groups,
444// Google domains, and service accounts. A `role` is a named list of
445// permissions
446// defined by IAM.
447//
448// **JSON Example**
449//
450//     {
451//       "bindings": [
452//         {
453//           "role": "roles/owner",
454//           "members": [
455//             "user:mike@example.com",
456//             "group:admins@example.com",
457//             "domain:google.com",
458//
459// "serviceAccount:my-other-app@appspot.gserviceaccount.com"
460//           ]
461//         },
462//         {
463//           "role": "roles/viewer",
464//           "members": ["user:sean@example.com"]
465//         }
466//       ]
467//     }
468//
469// **YAML Example**
470//
471//     bindings:
472//     - members:
473//       - user:mike@example.com
474//       - group:admins@example.com
475//       - domain:google.com
476//       - serviceAccount:my-other-app@appspot.gserviceaccount.com
477//       role: roles/owner
478//     - members:
479//       - user:sean@example.com
480//       role: roles/viewer
481//
482//
483// For a description of IAM and its features, see the
484// [IAM developer's guide](https://cloud.google.com/iam/docs).
485type Policy struct {
486	// Bindings: Associates a list of `members` to a `role`.
487	// `bindings` with no members will result in an error.
488	Bindings []*Binding `json:"bindings,omitempty"`
489
490	// Etag: `etag` is used for optimistic concurrency control as a way to
491	// help
492	// prevent simultaneous updates of a policy from overwriting each
493	// other.
494	// It is strongly suggested that systems make use of the `etag` in
495	// the
496	// read-modify-write cycle to perform policy updates in order to avoid
497	// race
498	// conditions: An `etag` is returned in the response to `getIamPolicy`,
499	// and
500	// systems are expected to put that etag in the request to
501	// `setIamPolicy` to
502	// ensure that their change will be applied to the same version of the
503	// policy.
504	//
505	// If no `etag` is provided in the call to `setIamPolicy`, then the
506	// existing
507	// policy is overwritten blindly.
508	Etag string `json:"etag,omitempty"`
509
510	// Version: Deprecated.
511	Version int64 `json:"version,omitempty"`
512
513	// ServerResponse contains the HTTP response code and headers from the
514	// server.
515	googleapi.ServerResponse `json:"-"`
516
517	// ForceSendFields is a list of field names (e.g. "Bindings") to
518	// unconditionally include in API requests. By default, fields with
519	// empty values are omitted from API requests. However, any non-pointer,
520	// non-interface field appearing in ForceSendFields will be sent to the
521	// server regardless of whether the field is empty or not. This may be
522	// used to include empty fields in Patch requests.
523	ForceSendFields []string `json:"-"`
524
525	// NullFields is a list of field names (e.g. "Bindings") to include in
526	// API requests with the JSON null value. By default, fields with empty
527	// values are omitted from API requests. However, any field with an
528	// empty value appearing in NullFields will be sent to the server as
529	// null. It is an error if a field in this list has a non-empty value.
530	// This may be used to include null fields in Patch requests.
531	NullFields []string `json:"-"`
532}
533
534func (s *Policy) MarshalJSON() ([]byte, error) {
535	type NoMethod Policy
536	raw := NoMethod(*s)
537	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
538}
539
540// PublishRequest: Request for the Publish method.
541type PublishRequest struct {
542	// Messages: The messages to publish.
543	Messages []*PubsubMessage `json:"messages,omitempty"`
544
545	// ForceSendFields is a list of field names (e.g. "Messages") to
546	// unconditionally include in API requests. By default, fields with
547	// empty values are omitted from API requests. However, any non-pointer,
548	// non-interface field appearing in ForceSendFields will be sent to the
549	// server regardless of whether the field is empty or not. This may be
550	// used to include empty fields in Patch requests.
551	ForceSendFields []string `json:"-"`
552
553	// NullFields is a list of field names (e.g. "Messages") to include in
554	// API requests with the JSON null value. By default, fields with empty
555	// values are omitted from API requests. However, any field with an
556	// empty value appearing in NullFields will be sent to the server as
557	// null. It is an error if a field in this list has a non-empty value.
558	// This may be used to include null fields in Patch requests.
559	NullFields []string `json:"-"`
560}
561
562func (s *PublishRequest) MarshalJSON() ([]byte, error) {
563	type NoMethod PublishRequest
564	raw := NoMethod(*s)
565	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
566}
567
568// PublishResponse: Response for the `Publish` method.
569type PublishResponse struct {
570	// MessageIds: The server-assigned ID of each published message, in the
571	// same order as
572	// the messages in the request. IDs are guaranteed to be unique
573	// within
574	// the topic.
575	MessageIds []string `json:"messageIds,omitempty"`
576
577	// ServerResponse contains the HTTP response code and headers from the
578	// server.
579	googleapi.ServerResponse `json:"-"`
580
581	// ForceSendFields is a list of field names (e.g. "MessageIds") to
582	// unconditionally include in API requests. By default, fields with
583	// empty values are omitted from API requests. However, any non-pointer,
584	// non-interface field appearing in ForceSendFields will be sent to the
585	// server regardless of whether the field is empty or not. This may be
586	// used to include empty fields in Patch requests.
587	ForceSendFields []string `json:"-"`
588
589	// NullFields is a list of field names (e.g. "MessageIds") to include in
590	// API requests with the JSON null value. By default, fields with empty
591	// values are omitted from API requests. However, any field with an
592	// empty value appearing in NullFields will be sent to the server as
593	// null. It is an error if a field in this list has a non-empty value.
594	// This may be used to include null fields in Patch requests.
595	NullFields []string `json:"-"`
596}
597
598func (s *PublishResponse) MarshalJSON() ([]byte, error) {
599	type NoMethod PublishResponse
600	raw := NoMethod(*s)
601	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
602}
603
604// PubsubMessage: A message data and its attributes. The message payload
605// must not be empty;
606// it must contain either a non-empty data field, or at least one
607// attribute.
608type PubsubMessage struct {
609	// Attributes: Optional attributes for this message.
610	Attributes map[string]string `json:"attributes,omitempty"`
611
612	// Data: The message payload. For JSON requests, the value of this field
613	// must be
614	// [base64-encoded](https://tools.ietf.org/html/rfc4648).
615	Data string `json:"data,omitempty"`
616
617	// MessageId: ID of this message, assigned by the server when the
618	// message is published.
619	// Guaranteed to be unique within the topic. This value may be read by
620	// a
621	// subscriber that receives a `PubsubMessage` via a `Pull` call or a
622	// push
623	// delivery. It must not be populated by the publisher in a `Publish`
624	// call.
625	MessageId string `json:"messageId,omitempty"`
626
627	// PublishTime: The time at which the message was published, populated
628	// by the server when
629	// it receives the `Publish` call. It must not be populated by
630	// the
631	// publisher in a `Publish` call.
632	PublishTime string `json:"publishTime,omitempty"`
633
634	// ForceSendFields is a list of field names (e.g. "Attributes") to
635	// unconditionally include in API requests. By default, fields with
636	// empty values are omitted from API requests. However, any non-pointer,
637	// non-interface field appearing in ForceSendFields will be sent to the
638	// server regardless of whether the field is empty or not. This may be
639	// used to include empty fields in Patch requests.
640	ForceSendFields []string `json:"-"`
641
642	// NullFields is a list of field names (e.g. "Attributes") to include in
643	// API requests with the JSON null value. By default, fields with empty
644	// values are omitted from API requests. However, any field with an
645	// empty value appearing in NullFields will be sent to the server as
646	// null. It is an error if a field in this list has a non-empty value.
647	// This may be used to include null fields in Patch requests.
648	NullFields []string `json:"-"`
649}
650
651func (s *PubsubMessage) MarshalJSON() ([]byte, error) {
652	type NoMethod PubsubMessage
653	raw := NoMethod(*s)
654	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
655}
656
657// PullRequest: Request for the `Pull` method.
658type PullRequest struct {
659	// MaxMessages: The maximum number of messages returned for this
660	// request. The Pub/Sub
661	// system may return fewer than the number specified.
662	MaxMessages int64 `json:"maxMessages,omitempty"`
663
664	// ReturnImmediately: If this is specified as true the system will
665	// respond immediately even if
666	// it is not able to return a message in the `Pull` response. Otherwise
667	// the
668	// system is allowed to wait until at least one message is available
669	// rather
670	// than returning no messages. The client may cancel the request if it
671	// does
672	// not wish to wait any longer for the response.
673	ReturnImmediately bool `json:"returnImmediately,omitempty"`
674
675	// ForceSendFields is a list of field names (e.g. "MaxMessages") to
676	// unconditionally include in API requests. By default, fields with
677	// empty values are omitted from API requests. However, any non-pointer,
678	// non-interface field appearing in ForceSendFields will be sent to the
679	// server regardless of whether the field is empty or not. This may be
680	// used to include empty fields in Patch requests.
681	ForceSendFields []string `json:"-"`
682
683	// NullFields is a list of field names (e.g. "MaxMessages") to include
684	// in API requests with the JSON null value. By default, fields with
685	// empty values are omitted from API requests. However, any field with
686	// an empty value appearing in NullFields will be sent to the server as
687	// null. It is an error if a field in this list has a non-empty value.
688	// This may be used to include null fields in Patch requests.
689	NullFields []string `json:"-"`
690}
691
692func (s *PullRequest) MarshalJSON() ([]byte, error) {
693	type NoMethod PullRequest
694	raw := NoMethod(*s)
695	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
696}
697
698// PullResponse: Response for the `Pull` method.
699type PullResponse struct {
700	// ReceivedMessages: Received Pub/Sub messages. The Pub/Sub system will
701	// return zero messages if
702	// there are no more available in the backlog. The Pub/Sub system may
703	// return
704	// fewer than the `maxMessages` requested even if there are more
705	// messages
706	// available in the backlog.
707	ReceivedMessages []*ReceivedMessage `json:"receivedMessages,omitempty"`
708
709	// ServerResponse contains the HTTP response code and headers from the
710	// server.
711	googleapi.ServerResponse `json:"-"`
712
713	// ForceSendFields is a list of field names (e.g. "ReceivedMessages") to
714	// unconditionally include in API requests. By default, fields with
715	// empty values are omitted from API requests. However, any non-pointer,
716	// non-interface field appearing in ForceSendFields will be sent to the
717	// server regardless of whether the field is empty or not. This may be
718	// used to include empty fields in Patch requests.
719	ForceSendFields []string `json:"-"`
720
721	// NullFields is a list of field names (e.g. "ReceivedMessages") to
722	// include in API requests with the JSON null value. By default, fields
723	// with empty values are omitted from API requests. However, any field
724	// with an empty value appearing in NullFields will be sent to the
725	// server as null. It is an error if a field in this list has a
726	// non-empty value. This may be used to include null fields in Patch
727	// requests.
728	NullFields []string `json:"-"`
729}
730
731func (s *PullResponse) MarshalJSON() ([]byte, error) {
732	type NoMethod PullResponse
733	raw := NoMethod(*s)
734	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
735}
736
737// PushConfig: Configuration for a push delivery endpoint.
738type PushConfig struct {
739	// Attributes: Endpoint configuration attributes.
740	//
741	// Every endpoint has a set of API supported attributes that can be used
742	// to
743	// control different aspects of the message delivery.
744	//
745	// The currently supported attribute is `x-goog-version`, which you
746	// can
747	// use to change the format of the push message. This
748	// attribute
749	// indicates the version of the data expected by the endpoint.
750	// This
751	// controls the shape of the envelope (i.e. its fields and
752	// metadata).
753	// The endpoint version is based on the version of the Pub/Sub
754	// API.
755	//
756	// If not present during the `CreateSubscription` call, it will default
757	// to
758	// the version of the API used to make such call. If not present during
759	// a
760	// `ModifyPushConfig` call, its value will not be changed.
761	// `GetSubscription`
762	// calls will always return a valid version, even if the subscription
763	// was
764	// created without this attribute.
765	//
766	// The possible values for this attribute are:
767	//
768	// * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub
769	// API.
770	// * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub
771	// API.
772	Attributes map[string]string `json:"attributes,omitempty"`
773
774	// PushEndpoint: A URL locating the endpoint to which messages should be
775	// pushed.
776	// For example, a Webhook endpoint might use "https://example.com/push".
777	PushEndpoint string `json:"pushEndpoint,omitempty"`
778
779	// ForceSendFields is a list of field names (e.g. "Attributes") to
780	// unconditionally include in API requests. By default, fields with
781	// empty values are omitted from API requests. However, any non-pointer,
782	// non-interface field appearing in ForceSendFields will be sent to the
783	// server regardless of whether the field is empty or not. This may be
784	// used to include empty fields in Patch requests.
785	ForceSendFields []string `json:"-"`
786
787	// NullFields is a list of field names (e.g. "Attributes") to include in
788	// API requests with the JSON null value. By default, fields with empty
789	// values are omitted from API requests. However, any field with an
790	// empty value appearing in NullFields will be sent to the server as
791	// null. It is an error if a field in this list has a non-empty value.
792	// This may be used to include null fields in Patch requests.
793	NullFields []string `json:"-"`
794}
795
796func (s *PushConfig) MarshalJSON() ([]byte, error) {
797	type NoMethod PushConfig
798	raw := NoMethod(*s)
799	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
800}
801
802// ReceivedMessage: A message and its corresponding acknowledgment ID.
803type ReceivedMessage struct {
804	// AckId: This ID can be used to acknowledge the received message.
805	AckId string `json:"ackId,omitempty"`
806
807	// Message: The message.
808	Message *PubsubMessage `json:"message,omitempty"`
809
810	// ForceSendFields is a list of field names (e.g. "AckId") to
811	// unconditionally include in API requests. By default, fields with
812	// empty values are omitted from API requests. However, any non-pointer,
813	// non-interface field appearing in ForceSendFields will be sent to the
814	// server regardless of whether the field is empty or not. This may be
815	// used to include empty fields in Patch requests.
816	ForceSendFields []string `json:"-"`
817
818	// NullFields is a list of field names (e.g. "AckId") to include in API
819	// requests with the JSON null value. By default, fields with empty
820	// values are omitted from API requests. However, any field with an
821	// empty value appearing in NullFields will be sent to the server as
822	// null. It is an error if a field in this list has a non-empty value.
823	// This may be used to include null fields in Patch requests.
824	NullFields []string `json:"-"`
825}
826
827func (s *ReceivedMessage) MarshalJSON() ([]byte, error) {
828	type NoMethod ReceivedMessage
829	raw := NoMethod(*s)
830	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
831}
832
833// SetIamPolicyRequest: Request message for `SetIamPolicy` method.
834type SetIamPolicyRequest struct {
835	// Policy: REQUIRED: The complete policy to be applied to the
836	// `resource`. The size of
837	// the policy is limited to a few 10s of KB. An empty policy is a
838	// valid policy but certain Cloud Platform services (such as
839	// Projects)
840	// might reject them.
841	Policy *Policy `json:"policy,omitempty"`
842
843	// ForceSendFields is a list of field names (e.g. "Policy") to
844	// unconditionally include in API requests. By default, fields with
845	// empty values are omitted from API requests. However, any non-pointer,
846	// non-interface field appearing in ForceSendFields will be sent to the
847	// server regardless of whether the field is empty or not. This may be
848	// used to include empty fields in Patch requests.
849	ForceSendFields []string `json:"-"`
850
851	// NullFields is a list of field names (e.g. "Policy") to include in API
852	// requests with the JSON null value. By default, fields with empty
853	// values are omitted from API requests. However, any field with an
854	// empty value appearing in NullFields will be sent to the server as
855	// null. It is an error if a field in this list has a non-empty value.
856	// This may be used to include null fields in Patch requests.
857	NullFields []string `json:"-"`
858}
859
860func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
861	type NoMethod SetIamPolicyRequest
862	raw := NoMethod(*s)
863	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
864}
865
866// Subscription: A subscription resource.
867type Subscription struct {
868	// AckDeadlineSeconds: This value is the maximum time after a subscriber
869	// receives a message
870	// before the subscriber should acknowledge the message. After
871	// message
872	// delivery but before the ack deadline expires and before the message
873	// is
874	// acknowledged, it is an outstanding message and will not be
875	// delivered
876	// again during that time (on a best-effort basis).
877	//
878	// For pull subscriptions, this value is used as the initial value for
879	// the ack
880	// deadline. To override this value for a given message,
881	// call
882	// `ModifyAckDeadline` with the corresponding `ack_id` if using
883	// pull.
884	// The maximum custom deadline you can specify is 600 seconds (10
885	// minutes).
886	//
887	// For push delivery, this value is also used to set the request timeout
888	// for
889	// the call to the push endpoint.
890	//
891	// If the subscriber never acknowledges the message, the Pub/Sub
892	// system will eventually redeliver the message.
893	//
894	// If this parameter is 0, a default value of 10 seconds is used.
895	AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
896
897	// Name: The name of the subscription. It must have the
898	// format
899	// "projects/{project}/subscriptions/{subscription}". `{subscription}`
900	// must
901	// start with a letter, and contain only letters (`[A-Za-z]`),
902	// numbers
903	// (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes
904	// (`~`),
905	// plus (`+`) or percent signs (`%`). It must be between 3 and 255
906	// characters
907	// in length, and it must not start with "goog".
908	Name string `json:"name,omitempty"`
909
910	// PushConfig: If push delivery is used with this subscription, this
911	// field is
912	// used to configure it. An empty `pushConfig` signifies that the
913	// subscriber
914	// will pull and ack messages using API methods.
915	PushConfig *PushConfig `json:"pushConfig,omitempty"`
916
917	// Topic: The name of the topic from which this subscription is
918	// receiving messages.
919	// The value of this field will be `_deleted-topic_` if the topic has
920	// been
921	// deleted.
922	Topic string `json:"topic,omitempty"`
923
924	// ServerResponse contains the HTTP response code and headers from the
925	// server.
926	googleapi.ServerResponse `json:"-"`
927
928	// ForceSendFields is a list of field names (e.g. "AckDeadlineSeconds")
929	// to unconditionally include in API requests. By default, fields with
930	// empty values are omitted from API requests. However, any non-pointer,
931	// non-interface field appearing in ForceSendFields will be sent to the
932	// server regardless of whether the field is empty or not. This may be
933	// used to include empty fields in Patch requests.
934	ForceSendFields []string `json:"-"`
935
936	// NullFields is a list of field names (e.g. "AckDeadlineSeconds") to
937	// include in API requests with the JSON null value. By default, fields
938	// with empty values are omitted from API requests. However, any field
939	// with an empty value appearing in NullFields will be sent to the
940	// server as null. It is an error if a field in this list has a
941	// non-empty value. This may be used to include null fields in Patch
942	// requests.
943	NullFields []string `json:"-"`
944}
945
946func (s *Subscription) MarshalJSON() ([]byte, error) {
947	type NoMethod Subscription
948	raw := NoMethod(*s)
949	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
950}
951
952// TestIamPermissionsRequest: Request message for `TestIamPermissions`
953// method.
954type TestIamPermissionsRequest struct {
955	// Permissions: The set of permissions to check for the `resource`.
956	// Permissions with
957	// wildcards (such as '*' or 'storage.*') are not allowed. For
958	// more
959	// information see
960	// [IAM
961	// Overview](https://cloud.google.com/iam/docs/overview#permissions).
962	Permissions []string `json:"permissions,omitempty"`
963
964	// ForceSendFields is a list of field names (e.g. "Permissions") to
965	// unconditionally include in API requests. By default, fields with
966	// empty values are omitted from API requests. However, any non-pointer,
967	// non-interface field appearing in ForceSendFields will be sent to the
968	// server regardless of whether the field is empty or not. This may be
969	// used to include empty fields in Patch requests.
970	ForceSendFields []string `json:"-"`
971
972	// NullFields is a list of field names (e.g. "Permissions") to include
973	// in API requests with the JSON null value. By default, fields with
974	// empty values are omitted from API requests. However, any field with
975	// an empty value appearing in NullFields will be sent to the server as
976	// null. It is an error if a field in this list has a non-empty value.
977	// This may be used to include null fields in Patch requests.
978	NullFields []string `json:"-"`
979}
980
981func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
982	type NoMethod TestIamPermissionsRequest
983	raw := NoMethod(*s)
984	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
985}
986
987// TestIamPermissionsResponse: Response message for `TestIamPermissions`
988// method.
989type TestIamPermissionsResponse struct {
990	// Permissions: A subset of `TestPermissionsRequest.permissions` that
991	// the caller is
992	// allowed.
993	Permissions []string `json:"permissions,omitempty"`
994
995	// ServerResponse contains the HTTP response code and headers from the
996	// server.
997	googleapi.ServerResponse `json:"-"`
998
999	// ForceSendFields is a list of field names (e.g. "Permissions") to
1000	// unconditionally include in API requests. By default, fields with
1001	// empty values are omitted from API requests. However, any non-pointer,
1002	// non-interface field appearing in ForceSendFields will be sent to the
1003	// server regardless of whether the field is empty or not. This may be
1004	// used to include empty fields in Patch requests.
1005	ForceSendFields []string `json:"-"`
1006
1007	// NullFields is a list of field names (e.g. "Permissions") to include
1008	// in API requests with the JSON null value. By default, fields with
1009	// empty values are omitted from API requests. However, any field with
1010	// an empty value appearing in NullFields will be sent to the server as
1011	// null. It is an error if a field in this list has a non-empty value.
1012	// This may be used to include null fields in Patch requests.
1013	NullFields []string `json:"-"`
1014}
1015
1016func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
1017	type NoMethod TestIamPermissionsResponse
1018	raw := NoMethod(*s)
1019	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1020}
1021
1022// Topic: A topic resource.
1023type Topic struct {
1024	// Name: The name of the topic. It must have the
1025	// format
1026	// "projects/{project}/topics/{topic}". `{topic}` must start with a
1027	// letter,
1028	// and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes
1029	// (`-`),
1030	// underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or
1031	// percent
1032	// signs (`%`). It must be between 3 and 255 characters in length, and
1033	// it
1034	// must not start with "goog".
1035	Name string `json:"name,omitempty"`
1036
1037	// ServerResponse contains the HTTP response code and headers from the
1038	// server.
1039	googleapi.ServerResponse `json:"-"`
1040
1041	// ForceSendFields is a list of field names (e.g. "Name") to
1042	// unconditionally include in API requests. By default, fields with
1043	// empty values are omitted from API requests. However, any non-pointer,
1044	// non-interface field appearing in ForceSendFields will be sent to the
1045	// server regardless of whether the field is empty or not. This may be
1046	// used to include empty fields in Patch requests.
1047	ForceSendFields []string `json:"-"`
1048
1049	// NullFields is a list of field names (e.g. "Name") to include in API
1050	// requests with the JSON null value. By default, fields with empty
1051	// values are omitted from API requests. However, any field with an
1052	// empty value appearing in NullFields will be sent to the server as
1053	// null. It is an error if a field in this list has a non-empty value.
1054	// This may be used to include null fields in Patch requests.
1055	NullFields []string `json:"-"`
1056}
1057
1058func (s *Topic) MarshalJSON() ([]byte, error) {
1059	type NoMethod Topic
1060	raw := NoMethod(*s)
1061	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1062}
1063
1064// method id "pubsub.projects.subscriptions.acknowledge":
1065
1066type ProjectsSubscriptionsAcknowledgeCall struct {
1067	s                  *Service
1068	subscription       string
1069	acknowledgerequest *AcknowledgeRequest
1070	urlParams_         gensupport.URLParams
1071	ctx_               context.Context
1072	header_            http.Header
1073}
1074
1075// Acknowledge: Acknowledges the messages associated with the `ack_ids`
1076// in the
1077// `AcknowledgeRequest`. The Pub/Sub system can remove the relevant
1078// messages
1079// from the subscription.
1080//
1081// Acknowledging a message whose ack deadline has expired may
1082// succeed,
1083// but such a message may be redelivered later. Acknowledging a message
1084// more
1085// than once will not result in an error.
1086func (r *ProjectsSubscriptionsService) Acknowledge(subscription string, acknowledgerequest *AcknowledgeRequest) *ProjectsSubscriptionsAcknowledgeCall {
1087	c := &ProjectsSubscriptionsAcknowledgeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1088	c.subscription = subscription
1089	c.acknowledgerequest = acknowledgerequest
1090	return c
1091}
1092
1093// Fields allows partial responses to be retrieved. See
1094// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1095// for more information.
1096func (c *ProjectsSubscriptionsAcknowledgeCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsAcknowledgeCall {
1097	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1098	return c
1099}
1100
1101// Context sets the context to be used in this call's Do method. Any
1102// pending HTTP request will be aborted if the provided context is
1103// canceled.
1104func (c *ProjectsSubscriptionsAcknowledgeCall) Context(ctx context.Context) *ProjectsSubscriptionsAcknowledgeCall {
1105	c.ctx_ = ctx
1106	return c
1107}
1108
1109// Header returns an http.Header that can be modified by the caller to
1110// add HTTP headers to the request.
1111func (c *ProjectsSubscriptionsAcknowledgeCall) Header() http.Header {
1112	if c.header_ == nil {
1113		c.header_ = make(http.Header)
1114	}
1115	return c.header_
1116}
1117
1118func (c *ProjectsSubscriptionsAcknowledgeCall) doRequest(alt string) (*http.Response, error) {
1119	reqHeaders := make(http.Header)
1120	for k, v := range c.header_ {
1121		reqHeaders[k] = v
1122	}
1123	reqHeaders.Set("User-Agent", c.s.userAgent())
1124	var body io.Reader = nil
1125	body, err := googleapi.WithoutDataWrapper.JSONReader(c.acknowledgerequest)
1126	if err != nil {
1127		return nil, err
1128	}
1129	reqHeaders.Set("Content-Type", "application/json")
1130	c.urlParams_.Set("alt", alt)
1131	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:acknowledge")
1132	urls += "?" + c.urlParams_.Encode()
1133	req, _ := http.NewRequest("POST", urls, body)
1134	req.Header = reqHeaders
1135	googleapi.Expand(req.URL, map[string]string{
1136		"subscription": c.subscription,
1137	})
1138	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1139}
1140
1141// Do executes the "pubsub.projects.subscriptions.acknowledge" call.
1142// Exactly one of *Empty or error will be non-nil. Any non-2xx status
1143// code is an error. Response headers are in either
1144// *Empty.ServerResponse.Header or (if a response was returned at all)
1145// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
1146// check whether the returned error was because http.StatusNotModified
1147// was returned.
1148func (c *ProjectsSubscriptionsAcknowledgeCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1149	gensupport.SetOptions(c.urlParams_, opts...)
1150	res, err := c.doRequest("json")
1151	if res != nil && res.StatusCode == http.StatusNotModified {
1152		if res.Body != nil {
1153			res.Body.Close()
1154		}
1155		return nil, &googleapi.Error{
1156			Code:   res.StatusCode,
1157			Header: res.Header,
1158		}
1159	}
1160	if err != nil {
1161		return nil, err
1162	}
1163	defer googleapi.CloseBody(res)
1164	if err := googleapi.CheckResponse(res); err != nil {
1165		return nil, err
1166	}
1167	ret := &Empty{
1168		ServerResponse: googleapi.ServerResponse{
1169			Header:         res.Header,
1170			HTTPStatusCode: res.StatusCode,
1171		},
1172	}
1173	target := &ret
1174	if err := gensupport.DecodeResponse(target, res); err != nil {
1175		return nil, err
1176	}
1177	return ret, nil
1178	// {
1179	//   "description": "Acknowledges the messages associated with the `ack_ids` in the\n`AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages\nfrom the subscription.\n\nAcknowledging a message whose ack deadline has expired may succeed,\nbut such a message may be redelivered later. Acknowledging a message more\nthan once will not result in an error.",
1180	//   "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:acknowledge",
1181	//   "httpMethod": "POST",
1182	//   "id": "pubsub.projects.subscriptions.acknowledge",
1183	//   "parameterOrder": [
1184	//     "subscription"
1185	//   ],
1186	//   "parameters": {
1187	//     "subscription": {
1188	//       "description": "The subscription whose message is being acknowledged.",
1189	//       "location": "path",
1190	//       "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
1191	//       "required": true,
1192	//       "type": "string"
1193	//     }
1194	//   },
1195	//   "path": "v1beta2/{+subscription}:acknowledge",
1196	//   "request": {
1197	//     "$ref": "AcknowledgeRequest"
1198	//   },
1199	//   "response": {
1200	//     "$ref": "Empty"
1201	//   },
1202	//   "scopes": [
1203	//     "https://www.googleapis.com/auth/cloud-platform",
1204	//     "https://www.googleapis.com/auth/pubsub"
1205	//   ]
1206	// }
1207
1208}
1209
1210// method id "pubsub.projects.subscriptions.create":
1211
1212type ProjectsSubscriptionsCreateCall struct {
1213	s            *Service
1214	name         string
1215	subscription *Subscription
1216	urlParams_   gensupport.URLParams
1217	ctx_         context.Context
1218	header_      http.Header
1219}
1220
1221// Create: Creates a subscription to a given topic.
1222// If the subscription already exists, returns `ALREADY_EXISTS`.
1223// If the corresponding topic doesn't exist, returns `NOT_FOUND`.
1224//
1225// If the name is not provided in the request, the server will assign a
1226// random
1227// name for this subscription on the same project as the topic. Note
1228// that
1229// for REST API requests, you must specify a name.
1230func (r *ProjectsSubscriptionsService) Create(name string, subscription *Subscription) *ProjectsSubscriptionsCreateCall {
1231	c := &ProjectsSubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1232	c.name = name
1233	c.subscription = subscription
1234	return c
1235}
1236
1237// Fields allows partial responses to be retrieved. See
1238// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1239// for more information.
1240func (c *ProjectsSubscriptionsCreateCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsCreateCall {
1241	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1242	return c
1243}
1244
1245// Context sets the context to be used in this call's Do method. Any
1246// pending HTTP request will be aborted if the provided context is
1247// canceled.
1248func (c *ProjectsSubscriptionsCreateCall) Context(ctx context.Context) *ProjectsSubscriptionsCreateCall {
1249	c.ctx_ = ctx
1250	return c
1251}
1252
1253// Header returns an http.Header that can be modified by the caller to
1254// add HTTP headers to the request.
1255func (c *ProjectsSubscriptionsCreateCall) Header() http.Header {
1256	if c.header_ == nil {
1257		c.header_ = make(http.Header)
1258	}
1259	return c.header_
1260}
1261
1262func (c *ProjectsSubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) {
1263	reqHeaders := make(http.Header)
1264	for k, v := range c.header_ {
1265		reqHeaders[k] = v
1266	}
1267	reqHeaders.Set("User-Agent", c.s.userAgent())
1268	var body io.Reader = nil
1269	body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
1270	if err != nil {
1271		return nil, err
1272	}
1273	reqHeaders.Set("Content-Type", "application/json")
1274	c.urlParams_.Set("alt", alt)
1275	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}")
1276	urls += "?" + c.urlParams_.Encode()
1277	req, _ := http.NewRequest("PUT", urls, body)
1278	req.Header = reqHeaders
1279	googleapi.Expand(req.URL, map[string]string{
1280		"name": c.name,
1281	})
1282	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1283}
1284
1285// Do executes the "pubsub.projects.subscriptions.create" call.
1286// Exactly one of *Subscription or error will be non-nil. Any non-2xx
1287// status code is an error. Response headers are in either
1288// *Subscription.ServerResponse.Header or (if a response was returned at
1289// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1290// to check whether the returned error was because
1291// http.StatusNotModified was returned.
1292func (c *ProjectsSubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
1293	gensupport.SetOptions(c.urlParams_, opts...)
1294	res, err := c.doRequest("json")
1295	if res != nil && res.StatusCode == http.StatusNotModified {
1296		if res.Body != nil {
1297			res.Body.Close()
1298		}
1299		return nil, &googleapi.Error{
1300			Code:   res.StatusCode,
1301			Header: res.Header,
1302		}
1303	}
1304	if err != nil {
1305		return nil, err
1306	}
1307	defer googleapi.CloseBody(res)
1308	if err := googleapi.CheckResponse(res); err != nil {
1309		return nil, err
1310	}
1311	ret := &Subscription{
1312		ServerResponse: googleapi.ServerResponse{
1313			Header:         res.Header,
1314			HTTPStatusCode: res.StatusCode,
1315		},
1316	}
1317	target := &ret
1318	if err := gensupport.DecodeResponse(target, res); err != nil {
1319		return nil, err
1320	}
1321	return ret, nil
1322	// {
1323	//   "description": "Creates a subscription to a given topic.\nIf the subscription already exists, returns `ALREADY_EXISTS`.\nIf the corresponding topic doesn't exist, returns `NOT_FOUND`.\n\nIf the name is not provided in the request, the server will assign a random\nname for this subscription on the same project as the topic. Note that\nfor REST API requests, you must specify a name.",
1324	//   "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}",
1325	//   "httpMethod": "PUT",
1326	//   "id": "pubsub.projects.subscriptions.create",
1327	//   "parameterOrder": [
1328	//     "name"
1329	//   ],
1330	//   "parameters": {
1331	//     "name": {
1332	//       "description": "The name of the subscription. It must have the format\n`\"projects/{project}/subscriptions/{subscription}\"`. `{subscription}` must\nstart with a letter, and contain only letters (`[A-Za-z]`), numbers\n(`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),\nplus (`+`) or percent signs (`%`). It must be between 3 and 255 characters\nin length, and it must not start with `\"goog\"`.",
1333	//       "location": "path",
1334	//       "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
1335	//       "required": true,
1336	//       "type": "string"
1337	//     }
1338	//   },
1339	//   "path": "v1beta2/{+name}",
1340	//   "request": {
1341	//     "$ref": "Subscription"
1342	//   },
1343	//   "response": {
1344	//     "$ref": "Subscription"
1345	//   },
1346	//   "scopes": [
1347	//     "https://www.googleapis.com/auth/cloud-platform",
1348	//     "https://www.googleapis.com/auth/pubsub"
1349	//   ]
1350	// }
1351
1352}
1353
1354// method id "pubsub.projects.subscriptions.delete":
1355
1356type ProjectsSubscriptionsDeleteCall struct {
1357	s            *Service
1358	subscription string
1359	urlParams_   gensupport.URLParams
1360	ctx_         context.Context
1361	header_      http.Header
1362}
1363
1364// Delete: Deletes an existing subscription. All pending messages in the
1365// subscription
1366// are immediately dropped. Calls to `Pull` after deletion will
1367// return
1368// `NOT_FOUND`. After a subscription is deleted, a new one may be
1369// created with
1370// the same name, but the new one has no association with the
1371// old
1372// subscription, or its topic unless the same topic is specified.
1373func (r *ProjectsSubscriptionsService) Delete(subscription string) *ProjectsSubscriptionsDeleteCall {
1374	c := &ProjectsSubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1375	c.subscription = subscription
1376	return c
1377}
1378
1379// Fields allows partial responses to be retrieved. See
1380// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1381// for more information.
1382func (c *ProjectsSubscriptionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsDeleteCall {
1383	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1384	return c
1385}
1386
1387// Context sets the context to be used in this call's Do method. Any
1388// pending HTTP request will be aborted if the provided context is
1389// canceled.
1390func (c *ProjectsSubscriptionsDeleteCall) Context(ctx context.Context) *ProjectsSubscriptionsDeleteCall {
1391	c.ctx_ = ctx
1392	return c
1393}
1394
1395// Header returns an http.Header that can be modified by the caller to
1396// add HTTP headers to the request.
1397func (c *ProjectsSubscriptionsDeleteCall) Header() http.Header {
1398	if c.header_ == nil {
1399		c.header_ = make(http.Header)
1400	}
1401	return c.header_
1402}
1403
1404func (c *ProjectsSubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
1405	reqHeaders := make(http.Header)
1406	for k, v := range c.header_ {
1407		reqHeaders[k] = v
1408	}
1409	reqHeaders.Set("User-Agent", c.s.userAgent())
1410	var body io.Reader = nil
1411	c.urlParams_.Set("alt", alt)
1412	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}")
1413	urls += "?" + c.urlParams_.Encode()
1414	req, _ := http.NewRequest("DELETE", urls, body)
1415	req.Header = reqHeaders
1416	googleapi.Expand(req.URL, map[string]string{
1417		"subscription": c.subscription,
1418	})
1419	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1420}
1421
1422// Do executes the "pubsub.projects.subscriptions.delete" call.
1423// Exactly one of *Empty or error will be non-nil. Any non-2xx status
1424// code is an error. Response headers are in either
1425// *Empty.ServerResponse.Header or (if a response was returned at all)
1426// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
1427// check whether the returned error was because http.StatusNotModified
1428// was returned.
1429func (c *ProjectsSubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
1430	gensupport.SetOptions(c.urlParams_, opts...)
1431	res, err := c.doRequest("json")
1432	if res != nil && res.StatusCode == http.StatusNotModified {
1433		if res.Body != nil {
1434			res.Body.Close()
1435		}
1436		return nil, &googleapi.Error{
1437			Code:   res.StatusCode,
1438			Header: res.Header,
1439		}
1440	}
1441	if err != nil {
1442		return nil, err
1443	}
1444	defer googleapi.CloseBody(res)
1445	if err := googleapi.CheckResponse(res); err != nil {
1446		return nil, err
1447	}
1448	ret := &Empty{
1449		ServerResponse: googleapi.ServerResponse{
1450			Header:         res.Header,
1451			HTTPStatusCode: res.StatusCode,
1452		},
1453	}
1454	target := &ret
1455	if err := gensupport.DecodeResponse(target, res); err != nil {
1456		return nil, err
1457	}
1458	return ret, nil
1459	// {
1460	//   "description": "Deletes an existing subscription. All pending messages in the subscription\nare immediately dropped. Calls to `Pull` after deletion will return\n`NOT_FOUND`. After a subscription is deleted, a new one may be created with\nthe same name, but the new one has no association with the old\nsubscription, or its topic unless the same topic is specified.",
1461	//   "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}",
1462	//   "httpMethod": "DELETE",
1463	//   "id": "pubsub.projects.subscriptions.delete",
1464	//   "parameterOrder": [
1465	//     "subscription"
1466	//   ],
1467	//   "parameters": {
1468	//     "subscription": {
1469	//       "description": "The subscription to delete.",
1470	//       "location": "path",
1471	//       "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
1472	//       "required": true,
1473	//       "type": "string"
1474	//     }
1475	//   },
1476	//   "path": "v1beta2/{+subscription}",
1477	//   "response": {
1478	//     "$ref": "Empty"
1479	//   },
1480	//   "scopes": [
1481	//     "https://www.googleapis.com/auth/cloud-platform",
1482	//     "https://www.googleapis.com/auth/pubsub"
1483	//   ]
1484	// }
1485
1486}
1487
1488// method id "pubsub.projects.subscriptions.get":
1489
1490type ProjectsSubscriptionsGetCall struct {
1491	s            *Service
1492	subscription string
1493	urlParams_   gensupport.URLParams
1494	ifNoneMatch_ string
1495	ctx_         context.Context
1496	header_      http.Header
1497}
1498
1499// Get: Gets the configuration details of a subscription.
1500func (r *ProjectsSubscriptionsService) Get(subscription string) *ProjectsSubscriptionsGetCall {
1501	c := &ProjectsSubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1502	c.subscription = subscription
1503	return c
1504}
1505
1506// Fields allows partial responses to be retrieved. See
1507// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1508// for more information.
1509func (c *ProjectsSubscriptionsGetCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsGetCall {
1510	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1511	return c
1512}
1513
1514// IfNoneMatch sets the optional parameter which makes the operation
1515// fail if the object's ETag matches the given value. This is useful for
1516// getting updates only after the object has changed since the last
1517// request. Use googleapi.IsNotModified to check whether the response
1518// error from Do is the result of In-None-Match.
1519func (c *ProjectsSubscriptionsGetCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsGetCall {
1520	c.ifNoneMatch_ = entityTag
1521	return c
1522}
1523
1524// Context sets the context to be used in this call's Do method. Any
1525// pending HTTP request will be aborted if the provided context is
1526// canceled.
1527func (c *ProjectsSubscriptionsGetCall) Context(ctx context.Context) *ProjectsSubscriptionsGetCall {
1528	c.ctx_ = ctx
1529	return c
1530}
1531
1532// Header returns an http.Header that can be modified by the caller to
1533// add HTTP headers to the request.
1534func (c *ProjectsSubscriptionsGetCall) Header() http.Header {
1535	if c.header_ == nil {
1536		c.header_ = make(http.Header)
1537	}
1538	return c.header_
1539}
1540
1541func (c *ProjectsSubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
1542	reqHeaders := make(http.Header)
1543	for k, v := range c.header_ {
1544		reqHeaders[k] = v
1545	}
1546	reqHeaders.Set("User-Agent", c.s.userAgent())
1547	if c.ifNoneMatch_ != "" {
1548		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1549	}
1550	var body io.Reader = nil
1551	c.urlParams_.Set("alt", alt)
1552	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}")
1553	urls += "?" + c.urlParams_.Encode()
1554	req, _ := http.NewRequest("GET", urls, body)
1555	req.Header = reqHeaders
1556	googleapi.Expand(req.URL, map[string]string{
1557		"subscription": c.subscription,
1558	})
1559	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1560}
1561
1562// Do executes the "pubsub.projects.subscriptions.get" call.
1563// Exactly one of *Subscription or error will be non-nil. Any non-2xx
1564// status code is an error. Response headers are in either
1565// *Subscription.ServerResponse.Header or (if a response was returned at
1566// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
1567// to check whether the returned error was because
1568// http.StatusNotModified was returned.
1569func (c *ProjectsSubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
1570	gensupport.SetOptions(c.urlParams_, opts...)
1571	res, err := c.doRequest("json")
1572	if res != nil && res.StatusCode == http.StatusNotModified {
1573		if res.Body != nil {
1574			res.Body.Close()
1575		}
1576		return nil, &googleapi.Error{
1577			Code:   res.StatusCode,
1578			Header: res.Header,
1579		}
1580	}
1581	if err != nil {
1582		return nil, err
1583	}
1584	defer googleapi.CloseBody(res)
1585	if err := googleapi.CheckResponse(res); err != nil {
1586		return nil, err
1587	}
1588	ret := &Subscription{
1589		ServerResponse: googleapi.ServerResponse{
1590			Header:         res.Header,
1591			HTTPStatusCode: res.StatusCode,
1592		},
1593	}
1594	target := &ret
1595	if err := gensupport.DecodeResponse(target, res); err != nil {
1596		return nil, err
1597	}
1598	return ret, nil
1599	// {
1600	//   "description": "Gets the configuration details of a subscription.",
1601	//   "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}",
1602	//   "httpMethod": "GET",
1603	//   "id": "pubsub.projects.subscriptions.get",
1604	//   "parameterOrder": [
1605	//     "subscription"
1606	//   ],
1607	//   "parameters": {
1608	//     "subscription": {
1609	//       "description": "The name of the subscription to get.",
1610	//       "location": "path",
1611	//       "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
1612	//       "required": true,
1613	//       "type": "string"
1614	//     }
1615	//   },
1616	//   "path": "v1beta2/{+subscription}",
1617	//   "response": {
1618	//     "$ref": "Subscription"
1619	//   },
1620	//   "scopes": [
1621	//     "https://www.googleapis.com/auth/cloud-platform",
1622	//     "https://www.googleapis.com/auth/pubsub"
1623	//   ]
1624	// }
1625
1626}
1627
1628// method id "pubsub.projects.subscriptions.getIamPolicy":
1629
1630type ProjectsSubscriptionsGetIamPolicyCall struct {
1631	s            *Service
1632	resource     string
1633	urlParams_   gensupport.URLParams
1634	ifNoneMatch_ string
1635	ctx_         context.Context
1636	header_      http.Header
1637}
1638
1639// GetIamPolicy: Gets the access control policy for a resource.
1640// Returns an empty policy if the resource exists and does not have a
1641// policy
1642// set.
1643func (r *ProjectsSubscriptionsService) GetIamPolicy(resource string) *ProjectsSubscriptionsGetIamPolicyCall {
1644	c := &ProjectsSubscriptionsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1645	c.resource = resource
1646	return c
1647}
1648
1649// Fields allows partial responses to be retrieved. See
1650// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1651// for more information.
1652func (c *ProjectsSubscriptionsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsGetIamPolicyCall {
1653	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1654	return c
1655}
1656
1657// IfNoneMatch sets the optional parameter which makes the operation
1658// fail if the object's ETag matches the given value. This is useful for
1659// getting updates only after the object has changed since the last
1660// request. Use googleapi.IsNotModified to check whether the response
1661// error from Do is the result of In-None-Match.
1662func (c *ProjectsSubscriptionsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsGetIamPolicyCall {
1663	c.ifNoneMatch_ = entityTag
1664	return c
1665}
1666
1667// Context sets the context to be used in this call's Do method. Any
1668// pending HTTP request will be aborted if the provided context is
1669// canceled.
1670func (c *ProjectsSubscriptionsGetIamPolicyCall) Context(ctx context.Context) *ProjectsSubscriptionsGetIamPolicyCall {
1671	c.ctx_ = ctx
1672	return c
1673}
1674
1675// Header returns an http.Header that can be modified by the caller to
1676// add HTTP headers to the request.
1677func (c *ProjectsSubscriptionsGetIamPolicyCall) Header() http.Header {
1678	if c.header_ == nil {
1679		c.header_ = make(http.Header)
1680	}
1681	return c.header_
1682}
1683
1684func (c *ProjectsSubscriptionsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
1685	reqHeaders := make(http.Header)
1686	for k, v := range c.header_ {
1687		reqHeaders[k] = v
1688	}
1689	reqHeaders.Set("User-Agent", c.s.userAgent())
1690	if c.ifNoneMatch_ != "" {
1691		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1692	}
1693	var body io.Reader = nil
1694	c.urlParams_.Set("alt", alt)
1695	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:getIamPolicy")
1696	urls += "?" + c.urlParams_.Encode()
1697	req, _ := http.NewRequest("GET", urls, body)
1698	req.Header = reqHeaders
1699	googleapi.Expand(req.URL, map[string]string{
1700		"resource": c.resource,
1701	})
1702	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1703}
1704
1705// Do executes the "pubsub.projects.subscriptions.getIamPolicy" call.
1706// Exactly one of *Policy or error will be non-nil. Any non-2xx status
1707// code is an error. Response headers are in either
1708// *Policy.ServerResponse.Header or (if a response was returned at all)
1709// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
1710// check whether the returned error was because http.StatusNotModified
1711// was returned.
1712func (c *ProjectsSubscriptionsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
1713	gensupport.SetOptions(c.urlParams_, opts...)
1714	res, err := c.doRequest("json")
1715	if res != nil && res.StatusCode == http.StatusNotModified {
1716		if res.Body != nil {
1717			res.Body.Close()
1718		}
1719		return nil, &googleapi.Error{
1720			Code:   res.StatusCode,
1721			Header: res.Header,
1722		}
1723	}
1724	if err != nil {
1725		return nil, err
1726	}
1727	defer googleapi.CloseBody(res)
1728	if err := googleapi.CheckResponse(res); err != nil {
1729		return nil, err
1730	}
1731	ret := &Policy{
1732		ServerResponse: googleapi.ServerResponse{
1733			Header:         res.Header,
1734			HTTPStatusCode: res.StatusCode,
1735		},
1736	}
1737	target := &ret
1738	if err := gensupport.DecodeResponse(target, res); err != nil {
1739		return nil, err
1740	}
1741	return ret, nil
1742	// {
1743	//   "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
1744	//   "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:getIamPolicy",
1745	//   "httpMethod": "GET",
1746	//   "id": "pubsub.projects.subscriptions.getIamPolicy",
1747	//   "parameterOrder": [
1748	//     "resource"
1749	//   ],
1750	//   "parameters": {
1751	//     "resource": {
1752	//       "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
1753	//       "location": "path",
1754	//       "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
1755	//       "required": true,
1756	//       "type": "string"
1757	//     }
1758	//   },
1759	//   "path": "v1beta2/{+resource}:getIamPolicy",
1760	//   "response": {
1761	//     "$ref": "Policy"
1762	//   },
1763	//   "scopes": [
1764	//     "https://www.googleapis.com/auth/cloud-platform",
1765	//     "https://www.googleapis.com/auth/pubsub"
1766	//   ]
1767	// }
1768
1769}
1770
1771// method id "pubsub.projects.subscriptions.list":
1772
1773type ProjectsSubscriptionsListCall struct {
1774	s            *Service
1775	project      string
1776	urlParams_   gensupport.URLParams
1777	ifNoneMatch_ string
1778	ctx_         context.Context
1779	header_      http.Header
1780}
1781
1782// List: Lists matching subscriptions.
1783func (r *ProjectsSubscriptionsService) List(project string) *ProjectsSubscriptionsListCall {
1784	c := &ProjectsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1785	c.project = project
1786	return c
1787}
1788
1789// PageSize sets the optional parameter "pageSize": Maximum number of
1790// subscriptions to return.
1791func (c *ProjectsSubscriptionsListCall) PageSize(pageSize int64) *ProjectsSubscriptionsListCall {
1792	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
1793	return c
1794}
1795
1796// PageToken sets the optional parameter "pageToken": The value returned
1797// by the last `ListSubscriptionsResponse`; indicates that
1798// this is a continuation of a prior `ListSubscriptions` call, and that
1799// the
1800// system should return the next page of data.
1801func (c *ProjectsSubscriptionsListCall) PageToken(pageToken string) *ProjectsSubscriptionsListCall {
1802	c.urlParams_.Set("pageToken", pageToken)
1803	return c
1804}
1805
1806// Fields allows partial responses to be retrieved. See
1807// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1808// for more information.
1809func (c *ProjectsSubscriptionsListCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsListCall {
1810	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1811	return c
1812}
1813
1814// IfNoneMatch sets the optional parameter which makes the operation
1815// fail if the object's ETag matches the given value. This is useful for
1816// getting updates only after the object has changed since the last
1817// request. Use googleapi.IsNotModified to check whether the response
1818// error from Do is the result of In-None-Match.
1819func (c *ProjectsSubscriptionsListCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsListCall {
1820	c.ifNoneMatch_ = entityTag
1821	return c
1822}
1823
1824// Context sets the context to be used in this call's Do method. Any
1825// pending HTTP request will be aborted if the provided context is
1826// canceled.
1827func (c *ProjectsSubscriptionsListCall) Context(ctx context.Context) *ProjectsSubscriptionsListCall {
1828	c.ctx_ = ctx
1829	return c
1830}
1831
1832// Header returns an http.Header that can be modified by the caller to
1833// add HTTP headers to the request.
1834func (c *ProjectsSubscriptionsListCall) Header() http.Header {
1835	if c.header_ == nil {
1836		c.header_ = make(http.Header)
1837	}
1838	return c.header_
1839}
1840
1841func (c *ProjectsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
1842	reqHeaders := make(http.Header)
1843	for k, v := range c.header_ {
1844		reqHeaders[k] = v
1845	}
1846	reqHeaders.Set("User-Agent", c.s.userAgent())
1847	if c.ifNoneMatch_ != "" {
1848		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
1849	}
1850	var body io.Reader = nil
1851	c.urlParams_.Set("alt", alt)
1852	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+project}/subscriptions")
1853	urls += "?" + c.urlParams_.Encode()
1854	req, _ := http.NewRequest("GET", urls, body)
1855	req.Header = reqHeaders
1856	googleapi.Expand(req.URL, map[string]string{
1857		"project": c.project,
1858	})
1859	return gensupport.SendRequest(c.ctx_, c.s.client, req)
1860}
1861
1862// Do executes the "pubsub.projects.subscriptions.list" call.
1863// Exactly one of *ListSubscriptionsResponse or error will be non-nil.
1864// Any non-2xx status code is an error. Response headers are in either
1865// *ListSubscriptionsResponse.ServerResponse.Header or (if a response
1866// was returned at all) in error.(*googleapi.Error).Header. Use
1867// googleapi.IsNotModified to check whether the returned error was
1868// because http.StatusNotModified was returned.
1869func (c *ProjectsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListSubscriptionsResponse, error) {
1870	gensupport.SetOptions(c.urlParams_, opts...)
1871	res, err := c.doRequest("json")
1872	if res != nil && res.StatusCode == http.StatusNotModified {
1873		if res.Body != nil {
1874			res.Body.Close()
1875		}
1876		return nil, &googleapi.Error{
1877			Code:   res.StatusCode,
1878			Header: res.Header,
1879		}
1880	}
1881	if err != nil {
1882		return nil, err
1883	}
1884	defer googleapi.CloseBody(res)
1885	if err := googleapi.CheckResponse(res); err != nil {
1886		return nil, err
1887	}
1888	ret := &ListSubscriptionsResponse{
1889		ServerResponse: googleapi.ServerResponse{
1890			Header:         res.Header,
1891			HTTPStatusCode: res.StatusCode,
1892		},
1893	}
1894	target := &ret
1895	if err := gensupport.DecodeResponse(target, res); err != nil {
1896		return nil, err
1897	}
1898	return ret, nil
1899	// {
1900	//   "description": "Lists matching subscriptions.",
1901	//   "flatPath": "v1beta2/projects/{projectsId}/subscriptions",
1902	//   "httpMethod": "GET",
1903	//   "id": "pubsub.projects.subscriptions.list",
1904	//   "parameterOrder": [
1905	//     "project"
1906	//   ],
1907	//   "parameters": {
1908	//     "pageSize": {
1909	//       "description": "Maximum number of subscriptions to return.",
1910	//       "format": "int32",
1911	//       "location": "query",
1912	//       "type": "integer"
1913	//     },
1914	//     "pageToken": {
1915	//       "description": "The value returned by the last `ListSubscriptionsResponse`; indicates that\nthis is a continuation of a prior `ListSubscriptions` call, and that the\nsystem should return the next page of data.",
1916	//       "location": "query",
1917	//       "type": "string"
1918	//     },
1919	//     "project": {
1920	//       "description": "The name of the cloud project that subscriptions belong to.",
1921	//       "location": "path",
1922	//       "pattern": "^projects/[^/]+$",
1923	//       "required": true,
1924	//       "type": "string"
1925	//     }
1926	//   },
1927	//   "path": "v1beta2/{+project}/subscriptions",
1928	//   "response": {
1929	//     "$ref": "ListSubscriptionsResponse"
1930	//   },
1931	//   "scopes": [
1932	//     "https://www.googleapis.com/auth/cloud-platform",
1933	//     "https://www.googleapis.com/auth/pubsub"
1934	//   ]
1935	// }
1936
1937}
1938
1939// Pages invokes f for each page of results.
1940// A non-nil error returned from f will halt the iteration.
1941// The provided context supersedes any context provided to the Context method.
1942func (c *ProjectsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListSubscriptionsResponse) error) error {
1943	c.ctx_ = ctx
1944	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
1945	for {
1946		x, err := c.Do()
1947		if err != nil {
1948			return err
1949		}
1950		if err := f(x); err != nil {
1951			return err
1952		}
1953		if x.NextPageToken == "" {
1954			return nil
1955		}
1956		c.PageToken(x.NextPageToken)
1957	}
1958}
1959
1960// method id "pubsub.projects.subscriptions.modifyAckDeadline":
1961
1962type ProjectsSubscriptionsModifyAckDeadlineCall struct {
1963	s                        *Service
1964	subscription             string
1965	modifyackdeadlinerequest *ModifyAckDeadlineRequest
1966	urlParams_               gensupport.URLParams
1967	ctx_                     context.Context
1968	header_                  http.Header
1969}
1970
1971// ModifyAckDeadline: Modifies the ack deadline for a specific message.
1972// This method is useful
1973// to indicate that more time is needed to process a message by
1974// the
1975// subscriber, or to make the message available for redelivery if
1976// the
1977// processing was interrupted. Note that this does not modify
1978// the
1979// subscription-level `ackDeadlineSeconds` used for subsequent messages.
1980func (r *ProjectsSubscriptionsService) ModifyAckDeadline(subscription string, modifyackdeadlinerequest *ModifyAckDeadlineRequest) *ProjectsSubscriptionsModifyAckDeadlineCall {
1981	c := &ProjectsSubscriptionsModifyAckDeadlineCall{s: r.s, urlParams_: make(gensupport.URLParams)}
1982	c.subscription = subscription
1983	c.modifyackdeadlinerequest = modifyackdeadlinerequest
1984	return c
1985}
1986
1987// Fields allows partial responses to be retrieved. See
1988// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
1989// for more information.
1990func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsModifyAckDeadlineCall {
1991	c.urlParams_.Set("fields", googleapi.CombineFields(s))
1992	return c
1993}
1994
1995// Context sets the context to be used in this call's Do method. Any
1996// pending HTTP request will be aborted if the provided context is
1997// canceled.
1998func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Context(ctx context.Context) *ProjectsSubscriptionsModifyAckDeadlineCall {
1999	c.ctx_ = ctx
2000	return c
2001}
2002
2003// Header returns an http.Header that can be modified by the caller to
2004// add HTTP headers to the request.
2005func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Header() http.Header {
2006	if c.header_ == nil {
2007		c.header_ = make(http.Header)
2008	}
2009	return c.header_
2010}
2011
2012func (c *ProjectsSubscriptionsModifyAckDeadlineCall) doRequest(alt string) (*http.Response, error) {
2013	reqHeaders := make(http.Header)
2014	for k, v := range c.header_ {
2015		reqHeaders[k] = v
2016	}
2017	reqHeaders.Set("User-Agent", c.s.userAgent())
2018	var body io.Reader = nil
2019	body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyackdeadlinerequest)
2020	if err != nil {
2021		return nil, err
2022	}
2023	reqHeaders.Set("Content-Type", "application/json")
2024	c.urlParams_.Set("alt", alt)
2025	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:modifyAckDeadline")
2026	urls += "?" + c.urlParams_.Encode()
2027	req, _ := http.NewRequest("POST", urls, body)
2028	req.Header = reqHeaders
2029	googleapi.Expand(req.URL, map[string]string{
2030		"subscription": c.subscription,
2031	})
2032	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2033}
2034
2035// Do executes the "pubsub.projects.subscriptions.modifyAckDeadline" call.
2036// Exactly one of *Empty or error will be non-nil. Any non-2xx status
2037// code is an error. Response headers are in either
2038// *Empty.ServerResponse.Header or (if a response was returned at all)
2039// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
2040// check whether the returned error was because http.StatusNotModified
2041// was returned.
2042func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2043	gensupport.SetOptions(c.urlParams_, opts...)
2044	res, err := c.doRequest("json")
2045	if res != nil && res.StatusCode == http.StatusNotModified {
2046		if res.Body != nil {
2047			res.Body.Close()
2048		}
2049		return nil, &googleapi.Error{
2050			Code:   res.StatusCode,
2051			Header: res.Header,
2052		}
2053	}
2054	if err != nil {
2055		return nil, err
2056	}
2057	defer googleapi.CloseBody(res)
2058	if err := googleapi.CheckResponse(res); err != nil {
2059		return nil, err
2060	}
2061	ret := &Empty{
2062		ServerResponse: googleapi.ServerResponse{
2063			Header:         res.Header,
2064			HTTPStatusCode: res.StatusCode,
2065		},
2066	}
2067	target := &ret
2068	if err := gensupport.DecodeResponse(target, res); err != nil {
2069		return nil, err
2070	}
2071	return ret, nil
2072	// {
2073	//   "description": "Modifies the ack deadline for a specific message. This method is useful\nto indicate that more time is needed to process a message by the\nsubscriber, or to make the message available for redelivery if the\nprocessing was interrupted. Note that this does not modify the\nsubscription-level `ackDeadlineSeconds` used for subsequent messages.",
2074	//   "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:modifyAckDeadline",
2075	//   "httpMethod": "POST",
2076	//   "id": "pubsub.projects.subscriptions.modifyAckDeadline",
2077	//   "parameterOrder": [
2078	//     "subscription"
2079	//   ],
2080	//   "parameters": {
2081	//     "subscription": {
2082	//       "description": "The name of the subscription.",
2083	//       "location": "path",
2084	//       "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
2085	//       "required": true,
2086	//       "type": "string"
2087	//     }
2088	//   },
2089	//   "path": "v1beta2/{+subscription}:modifyAckDeadline",
2090	//   "request": {
2091	//     "$ref": "ModifyAckDeadlineRequest"
2092	//   },
2093	//   "response": {
2094	//     "$ref": "Empty"
2095	//   },
2096	//   "scopes": [
2097	//     "https://www.googleapis.com/auth/cloud-platform",
2098	//     "https://www.googleapis.com/auth/pubsub"
2099	//   ]
2100	// }
2101
2102}
2103
2104// method id "pubsub.projects.subscriptions.modifyPushConfig":
2105
2106type ProjectsSubscriptionsModifyPushConfigCall struct {
2107	s                       *Service
2108	subscription            string
2109	modifypushconfigrequest *ModifyPushConfigRequest
2110	urlParams_              gensupport.URLParams
2111	ctx_                    context.Context
2112	header_                 http.Header
2113}
2114
2115// ModifyPushConfig: Modifies the `PushConfig` for a specified
2116// subscription.
2117//
2118// This may be used to change a push subscription to a pull one
2119// (signified by
2120// an empty `PushConfig`) or vice versa, or change the endpoint URL and
2121// other
2122// attributes of a push subscription. Messages will accumulate for
2123// delivery
2124// continuously through the call regardless of changes to the
2125// `PushConfig`.
2126func (r *ProjectsSubscriptionsService) ModifyPushConfig(subscription string, modifypushconfigrequest *ModifyPushConfigRequest) *ProjectsSubscriptionsModifyPushConfigCall {
2127	c := &ProjectsSubscriptionsModifyPushConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2128	c.subscription = subscription
2129	c.modifypushconfigrequest = modifypushconfigrequest
2130	return c
2131}
2132
2133// Fields allows partial responses to be retrieved. See
2134// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2135// for more information.
2136func (c *ProjectsSubscriptionsModifyPushConfigCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsModifyPushConfigCall {
2137	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2138	return c
2139}
2140
2141// Context sets the context to be used in this call's Do method. Any
2142// pending HTTP request will be aborted if the provided context is
2143// canceled.
2144func (c *ProjectsSubscriptionsModifyPushConfigCall) Context(ctx context.Context) *ProjectsSubscriptionsModifyPushConfigCall {
2145	c.ctx_ = ctx
2146	return c
2147}
2148
2149// Header returns an http.Header that can be modified by the caller to
2150// add HTTP headers to the request.
2151func (c *ProjectsSubscriptionsModifyPushConfigCall) Header() http.Header {
2152	if c.header_ == nil {
2153		c.header_ = make(http.Header)
2154	}
2155	return c.header_
2156}
2157
2158func (c *ProjectsSubscriptionsModifyPushConfigCall) doRequest(alt string) (*http.Response, error) {
2159	reqHeaders := make(http.Header)
2160	for k, v := range c.header_ {
2161		reqHeaders[k] = v
2162	}
2163	reqHeaders.Set("User-Agent", c.s.userAgent())
2164	var body io.Reader = nil
2165	body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifypushconfigrequest)
2166	if err != nil {
2167		return nil, err
2168	}
2169	reqHeaders.Set("Content-Type", "application/json")
2170	c.urlParams_.Set("alt", alt)
2171	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:modifyPushConfig")
2172	urls += "?" + c.urlParams_.Encode()
2173	req, _ := http.NewRequest("POST", urls, body)
2174	req.Header = reqHeaders
2175	googleapi.Expand(req.URL, map[string]string{
2176		"subscription": c.subscription,
2177	})
2178	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2179}
2180
2181// Do executes the "pubsub.projects.subscriptions.modifyPushConfig" call.
2182// Exactly one of *Empty or error will be non-nil. Any non-2xx status
2183// code is an error. Response headers are in either
2184// *Empty.ServerResponse.Header or (if a response was returned at all)
2185// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
2186// check whether the returned error was because http.StatusNotModified
2187// was returned.
2188func (c *ProjectsSubscriptionsModifyPushConfigCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2189	gensupport.SetOptions(c.urlParams_, opts...)
2190	res, err := c.doRequest("json")
2191	if res != nil && res.StatusCode == http.StatusNotModified {
2192		if res.Body != nil {
2193			res.Body.Close()
2194		}
2195		return nil, &googleapi.Error{
2196			Code:   res.StatusCode,
2197			Header: res.Header,
2198		}
2199	}
2200	if err != nil {
2201		return nil, err
2202	}
2203	defer googleapi.CloseBody(res)
2204	if err := googleapi.CheckResponse(res); err != nil {
2205		return nil, err
2206	}
2207	ret := &Empty{
2208		ServerResponse: googleapi.ServerResponse{
2209			Header:         res.Header,
2210			HTTPStatusCode: res.StatusCode,
2211		},
2212	}
2213	target := &ret
2214	if err := gensupport.DecodeResponse(target, res); err != nil {
2215		return nil, err
2216	}
2217	return ret, nil
2218	// {
2219	//   "description": "Modifies the `PushConfig` for a specified subscription.\n\nThis may be used to change a push subscription to a pull one (signified by\nan empty `PushConfig`) or vice versa, or change the endpoint URL and other\nattributes of a push subscription. Messages will accumulate for delivery\ncontinuously through the call regardless of changes to the `PushConfig`.",
2220	//   "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:modifyPushConfig",
2221	//   "httpMethod": "POST",
2222	//   "id": "pubsub.projects.subscriptions.modifyPushConfig",
2223	//   "parameterOrder": [
2224	//     "subscription"
2225	//   ],
2226	//   "parameters": {
2227	//     "subscription": {
2228	//       "description": "The name of the subscription.",
2229	//       "location": "path",
2230	//       "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
2231	//       "required": true,
2232	//       "type": "string"
2233	//     }
2234	//   },
2235	//   "path": "v1beta2/{+subscription}:modifyPushConfig",
2236	//   "request": {
2237	//     "$ref": "ModifyPushConfigRequest"
2238	//   },
2239	//   "response": {
2240	//     "$ref": "Empty"
2241	//   },
2242	//   "scopes": [
2243	//     "https://www.googleapis.com/auth/cloud-platform",
2244	//     "https://www.googleapis.com/auth/pubsub"
2245	//   ]
2246	// }
2247
2248}
2249
2250// method id "pubsub.projects.subscriptions.pull":
2251
2252type ProjectsSubscriptionsPullCall struct {
2253	s            *Service
2254	subscription string
2255	pullrequest  *PullRequest
2256	urlParams_   gensupport.URLParams
2257	ctx_         context.Context
2258	header_      http.Header
2259}
2260
2261// Pull: Pulls messages from the server. Returns an empty list if there
2262// are no
2263// messages available in the backlog. The server may return
2264// `UNAVAILABLE` if
2265// there are too many concurrent pull requests pending for the
2266// given
2267// subscription.
2268func (r *ProjectsSubscriptionsService) Pull(subscription string, pullrequest *PullRequest) *ProjectsSubscriptionsPullCall {
2269	c := &ProjectsSubscriptionsPullCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2270	c.subscription = subscription
2271	c.pullrequest = pullrequest
2272	return c
2273}
2274
2275// Fields allows partial responses to be retrieved. See
2276// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2277// for more information.
2278func (c *ProjectsSubscriptionsPullCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsPullCall {
2279	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2280	return c
2281}
2282
2283// Context sets the context to be used in this call's Do method. Any
2284// pending HTTP request will be aborted if the provided context is
2285// canceled.
2286func (c *ProjectsSubscriptionsPullCall) Context(ctx context.Context) *ProjectsSubscriptionsPullCall {
2287	c.ctx_ = ctx
2288	return c
2289}
2290
2291// Header returns an http.Header that can be modified by the caller to
2292// add HTTP headers to the request.
2293func (c *ProjectsSubscriptionsPullCall) Header() http.Header {
2294	if c.header_ == nil {
2295		c.header_ = make(http.Header)
2296	}
2297	return c.header_
2298}
2299
2300func (c *ProjectsSubscriptionsPullCall) doRequest(alt string) (*http.Response, error) {
2301	reqHeaders := make(http.Header)
2302	for k, v := range c.header_ {
2303		reqHeaders[k] = v
2304	}
2305	reqHeaders.Set("User-Agent", c.s.userAgent())
2306	var body io.Reader = nil
2307	body, err := googleapi.WithoutDataWrapper.JSONReader(c.pullrequest)
2308	if err != nil {
2309		return nil, err
2310	}
2311	reqHeaders.Set("Content-Type", "application/json")
2312	c.urlParams_.Set("alt", alt)
2313	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+subscription}:pull")
2314	urls += "?" + c.urlParams_.Encode()
2315	req, _ := http.NewRequest("POST", urls, body)
2316	req.Header = reqHeaders
2317	googleapi.Expand(req.URL, map[string]string{
2318		"subscription": c.subscription,
2319	})
2320	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2321}
2322
2323// Do executes the "pubsub.projects.subscriptions.pull" call.
2324// Exactly one of *PullResponse or error will be non-nil. Any non-2xx
2325// status code is an error. Response headers are in either
2326// *PullResponse.ServerResponse.Header or (if a response was returned at
2327// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
2328// to check whether the returned error was because
2329// http.StatusNotModified was returned.
2330func (c *ProjectsSubscriptionsPullCall) Do(opts ...googleapi.CallOption) (*PullResponse, error) {
2331	gensupport.SetOptions(c.urlParams_, opts...)
2332	res, err := c.doRequest("json")
2333	if res != nil && res.StatusCode == http.StatusNotModified {
2334		if res.Body != nil {
2335			res.Body.Close()
2336		}
2337		return nil, &googleapi.Error{
2338			Code:   res.StatusCode,
2339			Header: res.Header,
2340		}
2341	}
2342	if err != nil {
2343		return nil, err
2344	}
2345	defer googleapi.CloseBody(res)
2346	if err := googleapi.CheckResponse(res); err != nil {
2347		return nil, err
2348	}
2349	ret := &PullResponse{
2350		ServerResponse: googleapi.ServerResponse{
2351			Header:         res.Header,
2352			HTTPStatusCode: res.StatusCode,
2353		},
2354	}
2355	target := &ret
2356	if err := gensupport.DecodeResponse(target, res); err != nil {
2357		return nil, err
2358	}
2359	return ret, nil
2360	// {
2361	//   "description": "Pulls messages from the server. Returns an empty list if there are no\nmessages available in the backlog. The server may return `UNAVAILABLE` if\nthere are too many concurrent pull requests pending for the given\nsubscription.",
2362	//   "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:pull",
2363	//   "httpMethod": "POST",
2364	//   "id": "pubsub.projects.subscriptions.pull",
2365	//   "parameterOrder": [
2366	//     "subscription"
2367	//   ],
2368	//   "parameters": {
2369	//     "subscription": {
2370	//       "description": "The subscription from which messages should be pulled.",
2371	//       "location": "path",
2372	//       "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
2373	//       "required": true,
2374	//       "type": "string"
2375	//     }
2376	//   },
2377	//   "path": "v1beta2/{+subscription}:pull",
2378	//   "request": {
2379	//     "$ref": "PullRequest"
2380	//   },
2381	//   "response": {
2382	//     "$ref": "PullResponse"
2383	//   },
2384	//   "scopes": [
2385	//     "https://www.googleapis.com/auth/cloud-platform",
2386	//     "https://www.googleapis.com/auth/pubsub"
2387	//   ]
2388	// }
2389
2390}
2391
2392// method id "pubsub.projects.subscriptions.setIamPolicy":
2393
2394type ProjectsSubscriptionsSetIamPolicyCall struct {
2395	s                   *Service
2396	resource            string
2397	setiampolicyrequest *SetIamPolicyRequest
2398	urlParams_          gensupport.URLParams
2399	ctx_                context.Context
2400	header_             http.Header
2401}
2402
2403// SetIamPolicy: Sets the access control policy on the specified
2404// resource. Replaces any
2405// existing policy.
2406func (r *ProjectsSubscriptionsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSubscriptionsSetIamPolicyCall {
2407	c := &ProjectsSubscriptionsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2408	c.resource = resource
2409	c.setiampolicyrequest = setiampolicyrequest
2410	return c
2411}
2412
2413// Fields allows partial responses to be retrieved. See
2414// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2415// for more information.
2416func (c *ProjectsSubscriptionsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsSetIamPolicyCall {
2417	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2418	return c
2419}
2420
2421// Context sets the context to be used in this call's Do method. Any
2422// pending HTTP request will be aborted if the provided context is
2423// canceled.
2424func (c *ProjectsSubscriptionsSetIamPolicyCall) Context(ctx context.Context) *ProjectsSubscriptionsSetIamPolicyCall {
2425	c.ctx_ = ctx
2426	return c
2427}
2428
2429// Header returns an http.Header that can be modified by the caller to
2430// add HTTP headers to the request.
2431func (c *ProjectsSubscriptionsSetIamPolicyCall) Header() http.Header {
2432	if c.header_ == nil {
2433		c.header_ = make(http.Header)
2434	}
2435	return c.header_
2436}
2437
2438func (c *ProjectsSubscriptionsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
2439	reqHeaders := make(http.Header)
2440	for k, v := range c.header_ {
2441		reqHeaders[k] = v
2442	}
2443	reqHeaders.Set("User-Agent", c.s.userAgent())
2444	var body io.Reader = nil
2445	body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
2446	if err != nil {
2447		return nil, err
2448	}
2449	reqHeaders.Set("Content-Type", "application/json")
2450	c.urlParams_.Set("alt", alt)
2451	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:setIamPolicy")
2452	urls += "?" + c.urlParams_.Encode()
2453	req, _ := http.NewRequest("POST", urls, body)
2454	req.Header = reqHeaders
2455	googleapi.Expand(req.URL, map[string]string{
2456		"resource": c.resource,
2457	})
2458	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2459}
2460
2461// Do executes the "pubsub.projects.subscriptions.setIamPolicy" call.
2462// Exactly one of *Policy or error will be non-nil. Any non-2xx status
2463// code is an error. Response headers are in either
2464// *Policy.ServerResponse.Header or (if a response was returned at all)
2465// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
2466// check whether the returned error was because http.StatusNotModified
2467// was returned.
2468func (c *ProjectsSubscriptionsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
2469	gensupport.SetOptions(c.urlParams_, opts...)
2470	res, err := c.doRequest("json")
2471	if res != nil && res.StatusCode == http.StatusNotModified {
2472		if res.Body != nil {
2473			res.Body.Close()
2474		}
2475		return nil, &googleapi.Error{
2476			Code:   res.StatusCode,
2477			Header: res.Header,
2478		}
2479	}
2480	if err != nil {
2481		return nil, err
2482	}
2483	defer googleapi.CloseBody(res)
2484	if err := googleapi.CheckResponse(res); err != nil {
2485		return nil, err
2486	}
2487	ret := &Policy{
2488		ServerResponse: googleapi.ServerResponse{
2489			Header:         res.Header,
2490			HTTPStatusCode: res.StatusCode,
2491		},
2492	}
2493	target := &ret
2494	if err := gensupport.DecodeResponse(target, res); err != nil {
2495		return nil, err
2496	}
2497	return ret, nil
2498	// {
2499	//   "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
2500	//   "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:setIamPolicy",
2501	//   "httpMethod": "POST",
2502	//   "id": "pubsub.projects.subscriptions.setIamPolicy",
2503	//   "parameterOrder": [
2504	//     "resource"
2505	//   ],
2506	//   "parameters": {
2507	//     "resource": {
2508	//       "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
2509	//       "location": "path",
2510	//       "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
2511	//       "required": true,
2512	//       "type": "string"
2513	//     }
2514	//   },
2515	//   "path": "v1beta2/{+resource}:setIamPolicy",
2516	//   "request": {
2517	//     "$ref": "SetIamPolicyRequest"
2518	//   },
2519	//   "response": {
2520	//     "$ref": "Policy"
2521	//   },
2522	//   "scopes": [
2523	//     "https://www.googleapis.com/auth/cloud-platform",
2524	//     "https://www.googleapis.com/auth/pubsub"
2525	//   ]
2526	// }
2527
2528}
2529
2530// method id "pubsub.projects.subscriptions.testIamPermissions":
2531
2532type ProjectsSubscriptionsTestIamPermissionsCall struct {
2533	s                         *Service
2534	resource                  string
2535	testiampermissionsrequest *TestIamPermissionsRequest
2536	urlParams_                gensupport.URLParams
2537	ctx_                      context.Context
2538	header_                   http.Header
2539}
2540
2541// TestIamPermissions: Returns permissions that a caller has on the
2542// specified resource.
2543// If the resource does not exist, this will return an empty set
2544// of
2545// permissions, not a NOT_FOUND error.
2546//
2547// Note: This operation is designed to be used for building
2548// permission-aware
2549// UIs and command-line tools, not for authorization checking. This
2550// operation
2551// may "fail open" without warning.
2552func (r *ProjectsSubscriptionsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsSubscriptionsTestIamPermissionsCall {
2553	c := &ProjectsSubscriptionsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2554	c.resource = resource
2555	c.testiampermissionsrequest = testiampermissionsrequest
2556	return c
2557}
2558
2559// Fields allows partial responses to be retrieved. See
2560// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2561// for more information.
2562func (c *ProjectsSubscriptionsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsTestIamPermissionsCall {
2563	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2564	return c
2565}
2566
2567// Context sets the context to be used in this call's Do method. Any
2568// pending HTTP request will be aborted if the provided context is
2569// canceled.
2570func (c *ProjectsSubscriptionsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsSubscriptionsTestIamPermissionsCall {
2571	c.ctx_ = ctx
2572	return c
2573}
2574
2575// Header returns an http.Header that can be modified by the caller to
2576// add HTTP headers to the request.
2577func (c *ProjectsSubscriptionsTestIamPermissionsCall) Header() http.Header {
2578	if c.header_ == nil {
2579		c.header_ = make(http.Header)
2580	}
2581	return c.header_
2582}
2583
2584func (c *ProjectsSubscriptionsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
2585	reqHeaders := make(http.Header)
2586	for k, v := range c.header_ {
2587		reqHeaders[k] = v
2588	}
2589	reqHeaders.Set("User-Agent", c.s.userAgent())
2590	var body io.Reader = nil
2591	body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
2592	if err != nil {
2593		return nil, err
2594	}
2595	reqHeaders.Set("Content-Type", "application/json")
2596	c.urlParams_.Set("alt", alt)
2597	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:testIamPermissions")
2598	urls += "?" + c.urlParams_.Encode()
2599	req, _ := http.NewRequest("POST", urls, body)
2600	req.Header = reqHeaders
2601	googleapi.Expand(req.URL, map[string]string{
2602		"resource": c.resource,
2603	})
2604	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2605}
2606
2607// Do executes the "pubsub.projects.subscriptions.testIamPermissions" call.
2608// Exactly one of *TestIamPermissionsResponse or error will be non-nil.
2609// Any non-2xx status code is an error. Response headers are in either
2610// *TestIamPermissionsResponse.ServerResponse.Header or (if a response
2611// was returned at all) in error.(*googleapi.Error).Header. Use
2612// googleapi.IsNotModified to check whether the returned error was
2613// because http.StatusNotModified was returned.
2614func (c *ProjectsSubscriptionsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
2615	gensupport.SetOptions(c.urlParams_, opts...)
2616	res, err := c.doRequest("json")
2617	if res != nil && res.StatusCode == http.StatusNotModified {
2618		if res.Body != nil {
2619			res.Body.Close()
2620		}
2621		return nil, &googleapi.Error{
2622			Code:   res.StatusCode,
2623			Header: res.Header,
2624		}
2625	}
2626	if err != nil {
2627		return nil, err
2628	}
2629	defer googleapi.CloseBody(res)
2630	if err := googleapi.CheckResponse(res); err != nil {
2631		return nil, err
2632	}
2633	ret := &TestIamPermissionsResponse{
2634		ServerResponse: googleapi.ServerResponse{
2635			Header:         res.Header,
2636			HTTPStatusCode: res.StatusCode,
2637		},
2638	}
2639	target := &ret
2640	if err := gensupport.DecodeResponse(target, res); err != nil {
2641		return nil, err
2642	}
2643	return ret, nil
2644	// {
2645	//   "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.",
2646	//   "flatPath": "v1beta2/projects/{projectsId}/subscriptions/{subscriptionsId}:testIamPermissions",
2647	//   "httpMethod": "POST",
2648	//   "id": "pubsub.projects.subscriptions.testIamPermissions",
2649	//   "parameterOrder": [
2650	//     "resource"
2651	//   ],
2652	//   "parameters": {
2653	//     "resource": {
2654	//       "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
2655	//       "location": "path",
2656	//       "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
2657	//       "required": true,
2658	//       "type": "string"
2659	//     }
2660	//   },
2661	//   "path": "v1beta2/{+resource}:testIamPermissions",
2662	//   "request": {
2663	//     "$ref": "TestIamPermissionsRequest"
2664	//   },
2665	//   "response": {
2666	//     "$ref": "TestIamPermissionsResponse"
2667	//   },
2668	//   "scopes": [
2669	//     "https://www.googleapis.com/auth/cloud-platform",
2670	//     "https://www.googleapis.com/auth/pubsub"
2671	//   ]
2672	// }
2673
2674}
2675
2676// method id "pubsub.projects.topics.create":
2677
2678type ProjectsTopicsCreateCall struct {
2679	s          *Service
2680	name       string
2681	topic      *Topic
2682	urlParams_ gensupport.URLParams
2683	ctx_       context.Context
2684	header_    http.Header
2685}
2686
2687// Create: Creates the given topic with the given name.
2688func (r *ProjectsTopicsService) Create(name string, topic *Topic) *ProjectsTopicsCreateCall {
2689	c := &ProjectsTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2690	c.name = name
2691	c.topic = topic
2692	return c
2693}
2694
2695// Fields allows partial responses to be retrieved. See
2696// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2697// for more information.
2698func (c *ProjectsTopicsCreateCall) Fields(s ...googleapi.Field) *ProjectsTopicsCreateCall {
2699	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2700	return c
2701}
2702
2703// Context sets the context to be used in this call's Do method. Any
2704// pending HTTP request will be aborted if the provided context is
2705// canceled.
2706func (c *ProjectsTopicsCreateCall) Context(ctx context.Context) *ProjectsTopicsCreateCall {
2707	c.ctx_ = ctx
2708	return c
2709}
2710
2711// Header returns an http.Header that can be modified by the caller to
2712// add HTTP headers to the request.
2713func (c *ProjectsTopicsCreateCall) Header() http.Header {
2714	if c.header_ == nil {
2715		c.header_ = make(http.Header)
2716	}
2717	return c.header_
2718}
2719
2720func (c *ProjectsTopicsCreateCall) doRequest(alt string) (*http.Response, error) {
2721	reqHeaders := make(http.Header)
2722	for k, v := range c.header_ {
2723		reqHeaders[k] = v
2724	}
2725	reqHeaders.Set("User-Agent", c.s.userAgent())
2726	var body io.Reader = nil
2727	body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic)
2728	if err != nil {
2729		return nil, err
2730	}
2731	reqHeaders.Set("Content-Type", "application/json")
2732	c.urlParams_.Set("alt", alt)
2733	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+name}")
2734	urls += "?" + c.urlParams_.Encode()
2735	req, _ := http.NewRequest("PUT", urls, body)
2736	req.Header = reqHeaders
2737	googleapi.Expand(req.URL, map[string]string{
2738		"name": c.name,
2739	})
2740	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2741}
2742
2743// Do executes the "pubsub.projects.topics.create" call.
2744// Exactly one of *Topic or error will be non-nil. Any non-2xx status
2745// code is an error. Response headers are in either
2746// *Topic.ServerResponse.Header or (if a response was returned at all)
2747// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
2748// check whether the returned error was because http.StatusNotModified
2749// was returned.
2750func (c *ProjectsTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
2751	gensupport.SetOptions(c.urlParams_, opts...)
2752	res, err := c.doRequest("json")
2753	if res != nil && res.StatusCode == http.StatusNotModified {
2754		if res.Body != nil {
2755			res.Body.Close()
2756		}
2757		return nil, &googleapi.Error{
2758			Code:   res.StatusCode,
2759			Header: res.Header,
2760		}
2761	}
2762	if err != nil {
2763		return nil, err
2764	}
2765	defer googleapi.CloseBody(res)
2766	if err := googleapi.CheckResponse(res); err != nil {
2767		return nil, err
2768	}
2769	ret := &Topic{
2770		ServerResponse: googleapi.ServerResponse{
2771			Header:         res.Header,
2772			HTTPStatusCode: res.StatusCode,
2773		},
2774	}
2775	target := &ret
2776	if err := gensupport.DecodeResponse(target, res); err != nil {
2777		return nil, err
2778	}
2779	return ret, nil
2780	// {
2781	//   "description": "Creates the given topic with the given name.",
2782	//   "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}",
2783	//   "httpMethod": "PUT",
2784	//   "id": "pubsub.projects.topics.create",
2785	//   "parameterOrder": [
2786	//     "name"
2787	//   ],
2788	//   "parameters": {
2789	//     "name": {
2790	//       "description": "The name of the topic. It must have the format\n`\"projects/{project}/topics/{topic}\"`. `{topic}` must start with a letter,\nand contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes (`-`),\nunderscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or percent\nsigns (`%`). It must be between 3 and 255 characters in length, and it\nmust not start with `\"goog\"`.",
2791	//       "location": "path",
2792	//       "pattern": "^projects/[^/]+/topics/[^/]+$",
2793	//       "required": true,
2794	//       "type": "string"
2795	//     }
2796	//   },
2797	//   "path": "v1beta2/{+name}",
2798	//   "request": {
2799	//     "$ref": "Topic"
2800	//   },
2801	//   "response": {
2802	//     "$ref": "Topic"
2803	//   },
2804	//   "scopes": [
2805	//     "https://www.googleapis.com/auth/cloud-platform",
2806	//     "https://www.googleapis.com/auth/pubsub"
2807	//   ]
2808	// }
2809
2810}
2811
2812// method id "pubsub.projects.topics.delete":
2813
2814type ProjectsTopicsDeleteCall struct {
2815	s          *Service
2816	topic      string
2817	urlParams_ gensupport.URLParams
2818	ctx_       context.Context
2819	header_    http.Header
2820}
2821
2822// Delete: Deletes the topic with the given name. Returns `NOT_FOUND` if
2823// the topic
2824// does not exist. After a topic is deleted, a new topic may be created
2825// with
2826// the same name; this is an entirely new topic with none of the
2827// old
2828// configuration or subscriptions. Existing subscriptions to this topic
2829// are
2830// not deleted, but their `topic` field is set to `_deleted-topic_`.
2831func (r *ProjectsTopicsService) Delete(topic string) *ProjectsTopicsDeleteCall {
2832	c := &ProjectsTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2833	c.topic = topic
2834	return c
2835}
2836
2837// Fields allows partial responses to be retrieved. See
2838// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2839// for more information.
2840func (c *ProjectsTopicsDeleteCall) Fields(s ...googleapi.Field) *ProjectsTopicsDeleteCall {
2841	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2842	return c
2843}
2844
2845// Context sets the context to be used in this call's Do method. Any
2846// pending HTTP request will be aborted if the provided context is
2847// canceled.
2848func (c *ProjectsTopicsDeleteCall) Context(ctx context.Context) *ProjectsTopicsDeleteCall {
2849	c.ctx_ = ctx
2850	return c
2851}
2852
2853// Header returns an http.Header that can be modified by the caller to
2854// add HTTP headers to the request.
2855func (c *ProjectsTopicsDeleteCall) Header() http.Header {
2856	if c.header_ == nil {
2857		c.header_ = make(http.Header)
2858	}
2859	return c.header_
2860}
2861
2862func (c *ProjectsTopicsDeleteCall) doRequest(alt string) (*http.Response, error) {
2863	reqHeaders := make(http.Header)
2864	for k, v := range c.header_ {
2865		reqHeaders[k] = v
2866	}
2867	reqHeaders.Set("User-Agent", c.s.userAgent())
2868	var body io.Reader = nil
2869	c.urlParams_.Set("alt", alt)
2870	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}")
2871	urls += "?" + c.urlParams_.Encode()
2872	req, _ := http.NewRequest("DELETE", urls, body)
2873	req.Header = reqHeaders
2874	googleapi.Expand(req.URL, map[string]string{
2875		"topic": c.topic,
2876	})
2877	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2878}
2879
2880// Do executes the "pubsub.projects.topics.delete" call.
2881// Exactly one of *Empty or error will be non-nil. Any non-2xx status
2882// code is an error. Response headers are in either
2883// *Empty.ServerResponse.Header or (if a response was returned at all)
2884// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
2885// check whether the returned error was because http.StatusNotModified
2886// was returned.
2887func (c *ProjectsTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
2888	gensupport.SetOptions(c.urlParams_, opts...)
2889	res, err := c.doRequest("json")
2890	if res != nil && res.StatusCode == http.StatusNotModified {
2891		if res.Body != nil {
2892			res.Body.Close()
2893		}
2894		return nil, &googleapi.Error{
2895			Code:   res.StatusCode,
2896			Header: res.Header,
2897		}
2898	}
2899	if err != nil {
2900		return nil, err
2901	}
2902	defer googleapi.CloseBody(res)
2903	if err := googleapi.CheckResponse(res); err != nil {
2904		return nil, err
2905	}
2906	ret := &Empty{
2907		ServerResponse: googleapi.ServerResponse{
2908			Header:         res.Header,
2909			HTTPStatusCode: res.StatusCode,
2910		},
2911	}
2912	target := &ret
2913	if err := gensupport.DecodeResponse(target, res); err != nil {
2914		return nil, err
2915	}
2916	return ret, nil
2917	// {
2918	//   "description": "Deletes the topic with the given name. Returns `NOT_FOUND` if the topic\ndoes not exist. After a topic is deleted, a new topic may be created with\nthe same name; this is an entirely new topic with none of the old\nconfiguration or subscriptions. Existing subscriptions to this topic are\nnot deleted, but their `topic` field is set to `_deleted-topic_`.",
2919	//   "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}",
2920	//   "httpMethod": "DELETE",
2921	//   "id": "pubsub.projects.topics.delete",
2922	//   "parameterOrder": [
2923	//     "topic"
2924	//   ],
2925	//   "parameters": {
2926	//     "topic": {
2927	//       "description": "Name of the topic to delete.",
2928	//       "location": "path",
2929	//       "pattern": "^projects/[^/]+/topics/[^/]+$",
2930	//       "required": true,
2931	//       "type": "string"
2932	//     }
2933	//   },
2934	//   "path": "v1beta2/{+topic}",
2935	//   "response": {
2936	//     "$ref": "Empty"
2937	//   },
2938	//   "scopes": [
2939	//     "https://www.googleapis.com/auth/cloud-platform",
2940	//     "https://www.googleapis.com/auth/pubsub"
2941	//   ]
2942	// }
2943
2944}
2945
2946// method id "pubsub.projects.topics.get":
2947
2948type ProjectsTopicsGetCall struct {
2949	s            *Service
2950	topic        string
2951	urlParams_   gensupport.URLParams
2952	ifNoneMatch_ string
2953	ctx_         context.Context
2954	header_      http.Header
2955}
2956
2957// Get: Gets the configuration of a topic.
2958func (r *ProjectsTopicsService) Get(topic string) *ProjectsTopicsGetCall {
2959	c := &ProjectsTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2960	c.topic = topic
2961	return c
2962}
2963
2964// Fields allows partial responses to be retrieved. See
2965// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2966// for more information.
2967func (c *ProjectsTopicsGetCall) Fields(s ...googleapi.Field) *ProjectsTopicsGetCall {
2968	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2969	return c
2970}
2971
2972// IfNoneMatch sets the optional parameter which makes the operation
2973// fail if the object's ETag matches the given value. This is useful for
2974// getting updates only after the object has changed since the last
2975// request. Use googleapi.IsNotModified to check whether the response
2976// error from Do is the result of In-None-Match.
2977func (c *ProjectsTopicsGetCall) IfNoneMatch(entityTag string) *ProjectsTopicsGetCall {
2978	c.ifNoneMatch_ = entityTag
2979	return c
2980}
2981
2982// Context sets the context to be used in this call's Do method. Any
2983// pending HTTP request will be aborted if the provided context is
2984// canceled.
2985func (c *ProjectsTopicsGetCall) Context(ctx context.Context) *ProjectsTopicsGetCall {
2986	c.ctx_ = ctx
2987	return c
2988}
2989
2990// Header returns an http.Header that can be modified by the caller to
2991// add HTTP headers to the request.
2992func (c *ProjectsTopicsGetCall) Header() http.Header {
2993	if c.header_ == nil {
2994		c.header_ = make(http.Header)
2995	}
2996	return c.header_
2997}
2998
2999func (c *ProjectsTopicsGetCall) doRequest(alt string) (*http.Response, error) {
3000	reqHeaders := make(http.Header)
3001	for k, v := range c.header_ {
3002		reqHeaders[k] = v
3003	}
3004	reqHeaders.Set("User-Agent", c.s.userAgent())
3005	if c.ifNoneMatch_ != "" {
3006		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3007	}
3008	var body io.Reader = nil
3009	c.urlParams_.Set("alt", alt)
3010	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}")
3011	urls += "?" + c.urlParams_.Encode()
3012	req, _ := http.NewRequest("GET", urls, body)
3013	req.Header = reqHeaders
3014	googleapi.Expand(req.URL, map[string]string{
3015		"topic": c.topic,
3016	})
3017	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3018}
3019
3020// Do executes the "pubsub.projects.topics.get" call.
3021// Exactly one of *Topic or error will be non-nil. Any non-2xx status
3022// code is an error. Response headers are in either
3023// *Topic.ServerResponse.Header or (if a response was returned at all)
3024// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
3025// check whether the returned error was because http.StatusNotModified
3026// was returned.
3027func (c *ProjectsTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
3028	gensupport.SetOptions(c.urlParams_, opts...)
3029	res, err := c.doRequest("json")
3030	if res != nil && res.StatusCode == http.StatusNotModified {
3031		if res.Body != nil {
3032			res.Body.Close()
3033		}
3034		return nil, &googleapi.Error{
3035			Code:   res.StatusCode,
3036			Header: res.Header,
3037		}
3038	}
3039	if err != nil {
3040		return nil, err
3041	}
3042	defer googleapi.CloseBody(res)
3043	if err := googleapi.CheckResponse(res); err != nil {
3044		return nil, err
3045	}
3046	ret := &Topic{
3047		ServerResponse: googleapi.ServerResponse{
3048			Header:         res.Header,
3049			HTTPStatusCode: res.StatusCode,
3050		},
3051	}
3052	target := &ret
3053	if err := gensupport.DecodeResponse(target, res); err != nil {
3054		return nil, err
3055	}
3056	return ret, nil
3057	// {
3058	//   "description": "Gets the configuration of a topic.",
3059	//   "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}",
3060	//   "httpMethod": "GET",
3061	//   "id": "pubsub.projects.topics.get",
3062	//   "parameterOrder": [
3063	//     "topic"
3064	//   ],
3065	//   "parameters": {
3066	//     "topic": {
3067	//       "description": "The name of the topic to get.",
3068	//       "location": "path",
3069	//       "pattern": "^projects/[^/]+/topics/[^/]+$",
3070	//       "required": true,
3071	//       "type": "string"
3072	//     }
3073	//   },
3074	//   "path": "v1beta2/{+topic}",
3075	//   "response": {
3076	//     "$ref": "Topic"
3077	//   },
3078	//   "scopes": [
3079	//     "https://www.googleapis.com/auth/cloud-platform",
3080	//     "https://www.googleapis.com/auth/pubsub"
3081	//   ]
3082	// }
3083
3084}
3085
3086// method id "pubsub.projects.topics.getIamPolicy":
3087
3088type ProjectsTopicsGetIamPolicyCall struct {
3089	s            *Service
3090	resource     string
3091	urlParams_   gensupport.URLParams
3092	ifNoneMatch_ string
3093	ctx_         context.Context
3094	header_      http.Header
3095}
3096
3097// GetIamPolicy: Gets the access control policy for a resource.
3098// Returns an empty policy if the resource exists and does not have a
3099// policy
3100// set.
3101func (r *ProjectsTopicsService) GetIamPolicy(resource string) *ProjectsTopicsGetIamPolicyCall {
3102	c := &ProjectsTopicsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3103	c.resource = resource
3104	return c
3105}
3106
3107// Fields allows partial responses to be retrieved. See
3108// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3109// for more information.
3110func (c *ProjectsTopicsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsTopicsGetIamPolicyCall {
3111	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3112	return c
3113}
3114
3115// IfNoneMatch sets the optional parameter which makes the operation
3116// fail if the object's ETag matches the given value. This is useful for
3117// getting updates only after the object has changed since the last
3118// request. Use googleapi.IsNotModified to check whether the response
3119// error from Do is the result of In-None-Match.
3120func (c *ProjectsTopicsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsTopicsGetIamPolicyCall {
3121	c.ifNoneMatch_ = entityTag
3122	return c
3123}
3124
3125// Context sets the context to be used in this call's Do method. Any
3126// pending HTTP request will be aborted if the provided context is
3127// canceled.
3128func (c *ProjectsTopicsGetIamPolicyCall) Context(ctx context.Context) *ProjectsTopicsGetIamPolicyCall {
3129	c.ctx_ = ctx
3130	return c
3131}
3132
3133// Header returns an http.Header that can be modified by the caller to
3134// add HTTP headers to the request.
3135func (c *ProjectsTopicsGetIamPolicyCall) Header() http.Header {
3136	if c.header_ == nil {
3137		c.header_ = make(http.Header)
3138	}
3139	return c.header_
3140}
3141
3142func (c *ProjectsTopicsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
3143	reqHeaders := make(http.Header)
3144	for k, v := range c.header_ {
3145		reqHeaders[k] = v
3146	}
3147	reqHeaders.Set("User-Agent", c.s.userAgent())
3148	if c.ifNoneMatch_ != "" {
3149		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3150	}
3151	var body io.Reader = nil
3152	c.urlParams_.Set("alt", alt)
3153	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:getIamPolicy")
3154	urls += "?" + c.urlParams_.Encode()
3155	req, _ := http.NewRequest("GET", urls, body)
3156	req.Header = reqHeaders
3157	googleapi.Expand(req.URL, map[string]string{
3158		"resource": c.resource,
3159	})
3160	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3161}
3162
3163// Do executes the "pubsub.projects.topics.getIamPolicy" call.
3164// Exactly one of *Policy or error will be non-nil. Any non-2xx status
3165// code is an error. Response headers are in either
3166// *Policy.ServerResponse.Header or (if a response was returned at all)
3167// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
3168// check whether the returned error was because http.StatusNotModified
3169// was returned.
3170func (c *ProjectsTopicsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
3171	gensupport.SetOptions(c.urlParams_, opts...)
3172	res, err := c.doRequest("json")
3173	if res != nil && res.StatusCode == http.StatusNotModified {
3174		if res.Body != nil {
3175			res.Body.Close()
3176		}
3177		return nil, &googleapi.Error{
3178			Code:   res.StatusCode,
3179			Header: res.Header,
3180		}
3181	}
3182	if err != nil {
3183		return nil, err
3184	}
3185	defer googleapi.CloseBody(res)
3186	if err := googleapi.CheckResponse(res); err != nil {
3187		return nil, err
3188	}
3189	ret := &Policy{
3190		ServerResponse: googleapi.ServerResponse{
3191			Header:         res.Header,
3192			HTTPStatusCode: res.StatusCode,
3193		},
3194	}
3195	target := &ret
3196	if err := gensupport.DecodeResponse(target, res); err != nil {
3197		return nil, err
3198	}
3199	return ret, nil
3200	// {
3201	//   "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
3202	//   "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:getIamPolicy",
3203	//   "httpMethod": "GET",
3204	//   "id": "pubsub.projects.topics.getIamPolicy",
3205	//   "parameterOrder": [
3206	//     "resource"
3207	//   ],
3208	//   "parameters": {
3209	//     "resource": {
3210	//       "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
3211	//       "location": "path",
3212	//       "pattern": "^projects/[^/]+/topics/[^/]+$",
3213	//       "required": true,
3214	//       "type": "string"
3215	//     }
3216	//   },
3217	//   "path": "v1beta2/{+resource}:getIamPolicy",
3218	//   "response": {
3219	//     "$ref": "Policy"
3220	//   },
3221	//   "scopes": [
3222	//     "https://www.googleapis.com/auth/cloud-platform",
3223	//     "https://www.googleapis.com/auth/pubsub"
3224	//   ]
3225	// }
3226
3227}
3228
3229// method id "pubsub.projects.topics.list":
3230
3231type ProjectsTopicsListCall struct {
3232	s            *Service
3233	project      string
3234	urlParams_   gensupport.URLParams
3235	ifNoneMatch_ string
3236	ctx_         context.Context
3237	header_      http.Header
3238}
3239
3240// List: Lists matching topics.
3241func (r *ProjectsTopicsService) List(project string) *ProjectsTopicsListCall {
3242	c := &ProjectsTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3243	c.project = project
3244	return c
3245}
3246
3247// PageSize sets the optional parameter "pageSize": Maximum number of
3248// topics to return.
3249func (c *ProjectsTopicsListCall) PageSize(pageSize int64) *ProjectsTopicsListCall {
3250	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
3251	return c
3252}
3253
3254// PageToken sets the optional parameter "pageToken": The value returned
3255// by the last `ListTopicsResponse`; indicates that this is
3256// a continuation of a prior `ListTopics` call, and that the system
3257// should
3258// return the next page of data.
3259func (c *ProjectsTopicsListCall) PageToken(pageToken string) *ProjectsTopicsListCall {
3260	c.urlParams_.Set("pageToken", pageToken)
3261	return c
3262}
3263
3264// Fields allows partial responses to be retrieved. See
3265// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3266// for more information.
3267func (c *ProjectsTopicsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsListCall {
3268	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3269	return c
3270}
3271
3272// IfNoneMatch sets the optional parameter which makes the operation
3273// fail if the object's ETag matches the given value. This is useful for
3274// getting updates only after the object has changed since the last
3275// request. Use googleapi.IsNotModified to check whether the response
3276// error from Do is the result of In-None-Match.
3277func (c *ProjectsTopicsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsListCall {
3278	c.ifNoneMatch_ = entityTag
3279	return c
3280}
3281
3282// Context sets the context to be used in this call's Do method. Any
3283// pending HTTP request will be aborted if the provided context is
3284// canceled.
3285func (c *ProjectsTopicsListCall) Context(ctx context.Context) *ProjectsTopicsListCall {
3286	c.ctx_ = ctx
3287	return c
3288}
3289
3290// Header returns an http.Header that can be modified by the caller to
3291// add HTTP headers to the request.
3292func (c *ProjectsTopicsListCall) Header() http.Header {
3293	if c.header_ == nil {
3294		c.header_ = make(http.Header)
3295	}
3296	return c.header_
3297}
3298
3299func (c *ProjectsTopicsListCall) doRequest(alt string) (*http.Response, error) {
3300	reqHeaders := make(http.Header)
3301	for k, v := range c.header_ {
3302		reqHeaders[k] = v
3303	}
3304	reqHeaders.Set("User-Agent", c.s.userAgent())
3305	if c.ifNoneMatch_ != "" {
3306		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3307	}
3308	var body io.Reader = nil
3309	c.urlParams_.Set("alt", alt)
3310	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+project}/topics")
3311	urls += "?" + c.urlParams_.Encode()
3312	req, _ := http.NewRequest("GET", urls, body)
3313	req.Header = reqHeaders
3314	googleapi.Expand(req.URL, map[string]string{
3315		"project": c.project,
3316	})
3317	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3318}
3319
3320// Do executes the "pubsub.projects.topics.list" call.
3321// Exactly one of *ListTopicsResponse or error will be non-nil. Any
3322// non-2xx status code is an error. Response headers are in either
3323// *ListTopicsResponse.ServerResponse.Header or (if a response was
3324// returned at all) in error.(*googleapi.Error).Header. Use
3325// googleapi.IsNotModified to check whether the returned error was
3326// because http.StatusNotModified was returned.
3327func (c *ProjectsTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicsResponse, error) {
3328	gensupport.SetOptions(c.urlParams_, opts...)
3329	res, err := c.doRequest("json")
3330	if res != nil && res.StatusCode == http.StatusNotModified {
3331		if res.Body != nil {
3332			res.Body.Close()
3333		}
3334		return nil, &googleapi.Error{
3335			Code:   res.StatusCode,
3336			Header: res.Header,
3337		}
3338	}
3339	if err != nil {
3340		return nil, err
3341	}
3342	defer googleapi.CloseBody(res)
3343	if err := googleapi.CheckResponse(res); err != nil {
3344		return nil, err
3345	}
3346	ret := &ListTopicsResponse{
3347		ServerResponse: googleapi.ServerResponse{
3348			Header:         res.Header,
3349			HTTPStatusCode: res.StatusCode,
3350		},
3351	}
3352	target := &ret
3353	if err := gensupport.DecodeResponse(target, res); err != nil {
3354		return nil, err
3355	}
3356	return ret, nil
3357	// {
3358	//   "description": "Lists matching topics.",
3359	//   "flatPath": "v1beta2/projects/{projectsId}/topics",
3360	//   "httpMethod": "GET",
3361	//   "id": "pubsub.projects.topics.list",
3362	//   "parameterOrder": [
3363	//     "project"
3364	//   ],
3365	//   "parameters": {
3366	//     "pageSize": {
3367	//       "description": "Maximum number of topics to return.",
3368	//       "format": "int32",
3369	//       "location": "query",
3370	//       "type": "integer"
3371	//     },
3372	//     "pageToken": {
3373	//       "description": "The value returned by the last `ListTopicsResponse`; indicates that this is\na continuation of a prior `ListTopics` call, and that the system should\nreturn the next page of data.",
3374	//       "location": "query",
3375	//       "type": "string"
3376	//     },
3377	//     "project": {
3378	//       "description": "The name of the cloud project that topics belong to.",
3379	//       "location": "path",
3380	//       "pattern": "^projects/[^/]+$",
3381	//       "required": true,
3382	//       "type": "string"
3383	//     }
3384	//   },
3385	//   "path": "v1beta2/{+project}/topics",
3386	//   "response": {
3387	//     "$ref": "ListTopicsResponse"
3388	//   },
3389	//   "scopes": [
3390	//     "https://www.googleapis.com/auth/cloud-platform",
3391	//     "https://www.googleapis.com/auth/pubsub"
3392	//   ]
3393	// }
3394
3395}
3396
3397// Pages invokes f for each page of results.
3398// A non-nil error returned from f will halt the iteration.
3399// The provided context supersedes any context provided to the Context method.
3400func (c *ProjectsTopicsListCall) Pages(ctx context.Context, f func(*ListTopicsResponse) error) error {
3401	c.ctx_ = ctx
3402	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
3403	for {
3404		x, err := c.Do()
3405		if err != nil {
3406			return err
3407		}
3408		if err := f(x); err != nil {
3409			return err
3410		}
3411		if x.NextPageToken == "" {
3412			return nil
3413		}
3414		c.PageToken(x.NextPageToken)
3415	}
3416}
3417
3418// method id "pubsub.projects.topics.publish":
3419
3420type ProjectsTopicsPublishCall struct {
3421	s              *Service
3422	topic          string
3423	publishrequest *PublishRequest
3424	urlParams_     gensupport.URLParams
3425	ctx_           context.Context
3426	header_        http.Header
3427}
3428
3429// Publish: Adds one or more messages to the topic. Returns `NOT_FOUND`
3430// if the topic
3431// does not exist. The message payload must not be empty; it must
3432// contain
3433//  either a non-empty data field, or at least one attribute.
3434func (r *ProjectsTopicsService) Publish(topic string, publishrequest *PublishRequest) *ProjectsTopicsPublishCall {
3435	c := &ProjectsTopicsPublishCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3436	c.topic = topic
3437	c.publishrequest = publishrequest
3438	return c
3439}
3440
3441// Fields allows partial responses to be retrieved. See
3442// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3443// for more information.
3444func (c *ProjectsTopicsPublishCall) Fields(s ...googleapi.Field) *ProjectsTopicsPublishCall {
3445	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3446	return c
3447}
3448
3449// Context sets the context to be used in this call's Do method. Any
3450// pending HTTP request will be aborted if the provided context is
3451// canceled.
3452func (c *ProjectsTopicsPublishCall) Context(ctx context.Context) *ProjectsTopicsPublishCall {
3453	c.ctx_ = ctx
3454	return c
3455}
3456
3457// Header returns an http.Header that can be modified by the caller to
3458// add HTTP headers to the request.
3459func (c *ProjectsTopicsPublishCall) Header() http.Header {
3460	if c.header_ == nil {
3461		c.header_ = make(http.Header)
3462	}
3463	return c.header_
3464}
3465
3466func (c *ProjectsTopicsPublishCall) doRequest(alt string) (*http.Response, error) {
3467	reqHeaders := make(http.Header)
3468	for k, v := range c.header_ {
3469		reqHeaders[k] = v
3470	}
3471	reqHeaders.Set("User-Agent", c.s.userAgent())
3472	var body io.Reader = nil
3473	body, err := googleapi.WithoutDataWrapper.JSONReader(c.publishrequest)
3474	if err != nil {
3475		return nil, err
3476	}
3477	reqHeaders.Set("Content-Type", "application/json")
3478	c.urlParams_.Set("alt", alt)
3479	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}:publish")
3480	urls += "?" + c.urlParams_.Encode()
3481	req, _ := http.NewRequest("POST", urls, body)
3482	req.Header = reqHeaders
3483	googleapi.Expand(req.URL, map[string]string{
3484		"topic": c.topic,
3485	})
3486	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3487}
3488
3489// Do executes the "pubsub.projects.topics.publish" call.
3490// Exactly one of *PublishResponse or error will be non-nil. Any non-2xx
3491// status code is an error. Response headers are in either
3492// *PublishResponse.ServerResponse.Header or (if a response was returned
3493// at all) in error.(*googleapi.Error).Header. Use
3494// googleapi.IsNotModified to check whether the returned error was
3495// because http.StatusNotModified was returned.
3496func (c *ProjectsTopicsPublishCall) Do(opts ...googleapi.CallOption) (*PublishResponse, error) {
3497	gensupport.SetOptions(c.urlParams_, opts...)
3498	res, err := c.doRequest("json")
3499	if res != nil && res.StatusCode == http.StatusNotModified {
3500		if res.Body != nil {
3501			res.Body.Close()
3502		}
3503		return nil, &googleapi.Error{
3504			Code:   res.StatusCode,
3505			Header: res.Header,
3506		}
3507	}
3508	if err != nil {
3509		return nil, err
3510	}
3511	defer googleapi.CloseBody(res)
3512	if err := googleapi.CheckResponse(res); err != nil {
3513		return nil, err
3514	}
3515	ret := &PublishResponse{
3516		ServerResponse: googleapi.ServerResponse{
3517			Header:         res.Header,
3518			HTTPStatusCode: res.StatusCode,
3519		},
3520	}
3521	target := &ret
3522	if err := gensupport.DecodeResponse(target, res); err != nil {
3523		return nil, err
3524	}
3525	return ret, nil
3526	// {
3527	//   "description": "Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic\ndoes not exist. The message payload must not be empty; it must contain\n either a non-empty data field, or at least one attribute.",
3528	//   "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:publish",
3529	//   "httpMethod": "POST",
3530	//   "id": "pubsub.projects.topics.publish",
3531	//   "parameterOrder": [
3532	//     "topic"
3533	//   ],
3534	//   "parameters": {
3535	//     "topic": {
3536	//       "description": "The messages in the request will be published on this topic.",
3537	//       "location": "path",
3538	//       "pattern": "^projects/[^/]+/topics/[^/]+$",
3539	//       "required": true,
3540	//       "type": "string"
3541	//     }
3542	//   },
3543	//   "path": "v1beta2/{+topic}:publish",
3544	//   "request": {
3545	//     "$ref": "PublishRequest"
3546	//   },
3547	//   "response": {
3548	//     "$ref": "PublishResponse"
3549	//   },
3550	//   "scopes": [
3551	//     "https://www.googleapis.com/auth/cloud-platform",
3552	//     "https://www.googleapis.com/auth/pubsub"
3553	//   ]
3554	// }
3555
3556}
3557
3558// method id "pubsub.projects.topics.setIamPolicy":
3559
3560type ProjectsTopicsSetIamPolicyCall struct {
3561	s                   *Service
3562	resource            string
3563	setiampolicyrequest *SetIamPolicyRequest
3564	urlParams_          gensupport.URLParams
3565	ctx_                context.Context
3566	header_             http.Header
3567}
3568
3569// SetIamPolicy: Sets the access control policy on the specified
3570// resource. Replaces any
3571// existing policy.
3572func (r *ProjectsTopicsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsTopicsSetIamPolicyCall {
3573	c := &ProjectsTopicsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3574	c.resource = resource
3575	c.setiampolicyrequest = setiampolicyrequest
3576	return c
3577}
3578
3579// Fields allows partial responses to be retrieved. See
3580// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3581// for more information.
3582func (c *ProjectsTopicsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsTopicsSetIamPolicyCall {
3583	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3584	return c
3585}
3586
3587// Context sets the context to be used in this call's Do method. Any
3588// pending HTTP request will be aborted if the provided context is
3589// canceled.
3590func (c *ProjectsTopicsSetIamPolicyCall) Context(ctx context.Context) *ProjectsTopicsSetIamPolicyCall {
3591	c.ctx_ = ctx
3592	return c
3593}
3594
3595// Header returns an http.Header that can be modified by the caller to
3596// add HTTP headers to the request.
3597func (c *ProjectsTopicsSetIamPolicyCall) Header() http.Header {
3598	if c.header_ == nil {
3599		c.header_ = make(http.Header)
3600	}
3601	return c.header_
3602}
3603
3604func (c *ProjectsTopicsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
3605	reqHeaders := make(http.Header)
3606	for k, v := range c.header_ {
3607		reqHeaders[k] = v
3608	}
3609	reqHeaders.Set("User-Agent", c.s.userAgent())
3610	var body io.Reader = nil
3611	body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
3612	if err != nil {
3613		return nil, err
3614	}
3615	reqHeaders.Set("Content-Type", "application/json")
3616	c.urlParams_.Set("alt", alt)
3617	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:setIamPolicy")
3618	urls += "?" + c.urlParams_.Encode()
3619	req, _ := http.NewRequest("POST", urls, body)
3620	req.Header = reqHeaders
3621	googleapi.Expand(req.URL, map[string]string{
3622		"resource": c.resource,
3623	})
3624	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3625}
3626
3627// Do executes the "pubsub.projects.topics.setIamPolicy" call.
3628// Exactly one of *Policy or error will be non-nil. Any non-2xx status
3629// code is an error. Response headers are in either
3630// *Policy.ServerResponse.Header or (if a response was returned at all)
3631// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
3632// check whether the returned error was because http.StatusNotModified
3633// was returned.
3634func (c *ProjectsTopicsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
3635	gensupport.SetOptions(c.urlParams_, opts...)
3636	res, err := c.doRequest("json")
3637	if res != nil && res.StatusCode == http.StatusNotModified {
3638		if res.Body != nil {
3639			res.Body.Close()
3640		}
3641		return nil, &googleapi.Error{
3642			Code:   res.StatusCode,
3643			Header: res.Header,
3644		}
3645	}
3646	if err != nil {
3647		return nil, err
3648	}
3649	defer googleapi.CloseBody(res)
3650	if err := googleapi.CheckResponse(res); err != nil {
3651		return nil, err
3652	}
3653	ret := &Policy{
3654		ServerResponse: googleapi.ServerResponse{
3655			Header:         res.Header,
3656			HTTPStatusCode: res.StatusCode,
3657		},
3658	}
3659	target := &ret
3660	if err := gensupport.DecodeResponse(target, res); err != nil {
3661		return nil, err
3662	}
3663	return ret, nil
3664	// {
3665	//   "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
3666	//   "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:setIamPolicy",
3667	//   "httpMethod": "POST",
3668	//   "id": "pubsub.projects.topics.setIamPolicy",
3669	//   "parameterOrder": [
3670	//     "resource"
3671	//   ],
3672	//   "parameters": {
3673	//     "resource": {
3674	//       "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
3675	//       "location": "path",
3676	//       "pattern": "^projects/[^/]+/topics/[^/]+$",
3677	//       "required": true,
3678	//       "type": "string"
3679	//     }
3680	//   },
3681	//   "path": "v1beta2/{+resource}:setIamPolicy",
3682	//   "request": {
3683	//     "$ref": "SetIamPolicyRequest"
3684	//   },
3685	//   "response": {
3686	//     "$ref": "Policy"
3687	//   },
3688	//   "scopes": [
3689	//     "https://www.googleapis.com/auth/cloud-platform",
3690	//     "https://www.googleapis.com/auth/pubsub"
3691	//   ]
3692	// }
3693
3694}
3695
3696// method id "pubsub.projects.topics.testIamPermissions":
3697
3698type ProjectsTopicsTestIamPermissionsCall struct {
3699	s                         *Service
3700	resource                  string
3701	testiampermissionsrequest *TestIamPermissionsRequest
3702	urlParams_                gensupport.URLParams
3703	ctx_                      context.Context
3704	header_                   http.Header
3705}
3706
3707// TestIamPermissions: Returns permissions that a caller has on the
3708// specified resource.
3709// If the resource does not exist, this will return an empty set
3710// of
3711// permissions, not a NOT_FOUND error.
3712//
3713// Note: This operation is designed to be used for building
3714// permission-aware
3715// UIs and command-line tools, not for authorization checking. This
3716// operation
3717// may "fail open" without warning.
3718func (r *ProjectsTopicsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsTopicsTestIamPermissionsCall {
3719	c := &ProjectsTopicsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3720	c.resource = resource
3721	c.testiampermissionsrequest = testiampermissionsrequest
3722	return c
3723}
3724
3725// Fields allows partial responses to be retrieved. See
3726// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3727// for more information.
3728func (c *ProjectsTopicsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsTopicsTestIamPermissionsCall {
3729	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3730	return c
3731}
3732
3733// Context sets the context to be used in this call's Do method. Any
3734// pending HTTP request will be aborted if the provided context is
3735// canceled.
3736func (c *ProjectsTopicsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsTopicsTestIamPermissionsCall {
3737	c.ctx_ = ctx
3738	return c
3739}
3740
3741// Header returns an http.Header that can be modified by the caller to
3742// add HTTP headers to the request.
3743func (c *ProjectsTopicsTestIamPermissionsCall) Header() http.Header {
3744	if c.header_ == nil {
3745		c.header_ = make(http.Header)
3746	}
3747	return c.header_
3748}
3749
3750func (c *ProjectsTopicsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
3751	reqHeaders := make(http.Header)
3752	for k, v := range c.header_ {
3753		reqHeaders[k] = v
3754	}
3755	reqHeaders.Set("User-Agent", c.s.userAgent())
3756	var body io.Reader = nil
3757	body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
3758	if err != nil {
3759		return nil, err
3760	}
3761	reqHeaders.Set("Content-Type", "application/json")
3762	c.urlParams_.Set("alt", alt)
3763	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+resource}:testIamPermissions")
3764	urls += "?" + c.urlParams_.Encode()
3765	req, _ := http.NewRequest("POST", urls, body)
3766	req.Header = reqHeaders
3767	googleapi.Expand(req.URL, map[string]string{
3768		"resource": c.resource,
3769	})
3770	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3771}
3772
3773// Do executes the "pubsub.projects.topics.testIamPermissions" call.
3774// Exactly one of *TestIamPermissionsResponse or error will be non-nil.
3775// Any non-2xx status code is an error. Response headers are in either
3776// *TestIamPermissionsResponse.ServerResponse.Header or (if a response
3777// was returned at all) in error.(*googleapi.Error).Header. Use
3778// googleapi.IsNotModified to check whether the returned error was
3779// because http.StatusNotModified was returned.
3780func (c *ProjectsTopicsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
3781	gensupport.SetOptions(c.urlParams_, opts...)
3782	res, err := c.doRequest("json")
3783	if res != nil && res.StatusCode == http.StatusNotModified {
3784		if res.Body != nil {
3785			res.Body.Close()
3786		}
3787		return nil, &googleapi.Error{
3788			Code:   res.StatusCode,
3789			Header: res.Header,
3790		}
3791	}
3792	if err != nil {
3793		return nil, err
3794	}
3795	defer googleapi.CloseBody(res)
3796	if err := googleapi.CheckResponse(res); err != nil {
3797		return nil, err
3798	}
3799	ret := &TestIamPermissionsResponse{
3800		ServerResponse: googleapi.ServerResponse{
3801			Header:         res.Header,
3802			HTTPStatusCode: res.StatusCode,
3803		},
3804	}
3805	target := &ret
3806	if err := gensupport.DecodeResponse(target, res); err != nil {
3807		return nil, err
3808	}
3809	return ret, nil
3810	// {
3811	//   "description": "Returns permissions that a caller has on the specified resource.\nIf the resource does not exist, this will return an empty set of\npermissions, not a NOT_FOUND error.\n\nNote: This operation is designed to be used for building permission-aware\nUIs and command-line tools, not for authorization checking. This operation\nmay \"fail open\" without warning.",
3812	//   "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}:testIamPermissions",
3813	//   "httpMethod": "POST",
3814	//   "id": "pubsub.projects.topics.testIamPermissions",
3815	//   "parameterOrder": [
3816	//     "resource"
3817	//   ],
3818	//   "parameters": {
3819	//     "resource": {
3820	//       "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
3821	//       "location": "path",
3822	//       "pattern": "^projects/[^/]+/topics/[^/]+$",
3823	//       "required": true,
3824	//       "type": "string"
3825	//     }
3826	//   },
3827	//   "path": "v1beta2/{+resource}:testIamPermissions",
3828	//   "request": {
3829	//     "$ref": "TestIamPermissionsRequest"
3830	//   },
3831	//   "response": {
3832	//     "$ref": "TestIamPermissionsResponse"
3833	//   },
3834	//   "scopes": [
3835	//     "https://www.googleapis.com/auth/cloud-platform",
3836	//     "https://www.googleapis.com/auth/pubsub"
3837	//   ]
3838	// }
3839
3840}
3841
3842// method id "pubsub.projects.topics.subscriptions.list":
3843
3844type ProjectsTopicsSubscriptionsListCall struct {
3845	s            *Service
3846	topic        string
3847	urlParams_   gensupport.URLParams
3848	ifNoneMatch_ string
3849	ctx_         context.Context
3850	header_      http.Header
3851}
3852
3853// List: Lists the name of the subscriptions for this topic.
3854func (r *ProjectsTopicsSubscriptionsService) List(topic string) *ProjectsTopicsSubscriptionsListCall {
3855	c := &ProjectsTopicsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3856	c.topic = topic
3857	return c
3858}
3859
3860// PageSize sets the optional parameter "pageSize": Maximum number of
3861// subscription names to return.
3862func (c *ProjectsTopicsSubscriptionsListCall) PageSize(pageSize int64) *ProjectsTopicsSubscriptionsListCall {
3863	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
3864	return c
3865}
3866
3867// PageToken sets the optional parameter "pageToken": The value returned
3868// by the last `ListTopicSubscriptionsResponse`; indicates
3869// that this is a continuation of a prior `ListTopicSubscriptions` call,
3870// and
3871// that the system should return the next page of data.
3872func (c *ProjectsTopicsSubscriptionsListCall) PageToken(pageToken string) *ProjectsTopicsSubscriptionsListCall {
3873	c.urlParams_.Set("pageToken", pageToken)
3874	return c
3875}
3876
3877// Fields allows partial responses to be retrieved. See
3878// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3879// for more information.
3880func (c *ProjectsTopicsSubscriptionsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsSubscriptionsListCall {
3881	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3882	return c
3883}
3884
3885// IfNoneMatch sets the optional parameter which makes the operation
3886// fail if the object's ETag matches the given value. This is useful for
3887// getting updates only after the object has changed since the last
3888// request. Use googleapi.IsNotModified to check whether the response
3889// error from Do is the result of In-None-Match.
3890func (c *ProjectsTopicsSubscriptionsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsSubscriptionsListCall {
3891	c.ifNoneMatch_ = entityTag
3892	return c
3893}
3894
3895// Context sets the context to be used in this call's Do method. Any
3896// pending HTTP request will be aborted if the provided context is
3897// canceled.
3898func (c *ProjectsTopicsSubscriptionsListCall) Context(ctx context.Context) *ProjectsTopicsSubscriptionsListCall {
3899	c.ctx_ = ctx
3900	return c
3901}
3902
3903// Header returns an http.Header that can be modified by the caller to
3904// add HTTP headers to the request.
3905func (c *ProjectsTopicsSubscriptionsListCall) Header() http.Header {
3906	if c.header_ == nil {
3907		c.header_ = make(http.Header)
3908	}
3909	return c.header_
3910}
3911
3912func (c *ProjectsTopicsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
3913	reqHeaders := make(http.Header)
3914	for k, v := range c.header_ {
3915		reqHeaders[k] = v
3916	}
3917	reqHeaders.Set("User-Agent", c.s.userAgent())
3918	if c.ifNoneMatch_ != "" {
3919		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3920	}
3921	var body io.Reader = nil
3922	c.urlParams_.Set("alt", alt)
3923	urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta2/{+topic}/subscriptions")
3924	urls += "?" + c.urlParams_.Encode()
3925	req, _ := http.NewRequest("GET", urls, body)
3926	req.Header = reqHeaders
3927	googleapi.Expand(req.URL, map[string]string{
3928		"topic": c.topic,
3929	})
3930	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3931}
3932
3933// Do executes the "pubsub.projects.topics.subscriptions.list" call.
3934// Exactly one of *ListTopicSubscriptionsResponse or error will be
3935// non-nil. Any non-2xx status code is an error. Response headers are in
3936// either *ListTopicSubscriptionsResponse.ServerResponse.Header or (if a
3937// response was returned at all) in error.(*googleapi.Error).Header. Use
3938// googleapi.IsNotModified to check whether the returned error was
3939// because http.StatusNotModified was returned.
3940func (c *ProjectsTopicsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListTopicSubscriptionsResponse, error) {
3941	gensupport.SetOptions(c.urlParams_, opts...)
3942	res, err := c.doRequest("json")
3943	if res != nil && res.StatusCode == http.StatusNotModified {
3944		if res.Body != nil {
3945			res.Body.Close()
3946		}
3947		return nil, &googleapi.Error{
3948			Code:   res.StatusCode,
3949			Header: res.Header,
3950		}
3951	}
3952	if err != nil {
3953		return nil, err
3954	}
3955	defer googleapi.CloseBody(res)
3956	if err := googleapi.CheckResponse(res); err != nil {
3957		return nil, err
3958	}
3959	ret := &ListTopicSubscriptionsResponse{
3960		ServerResponse: googleapi.ServerResponse{
3961			Header:         res.Header,
3962			HTTPStatusCode: res.StatusCode,
3963		},
3964	}
3965	target := &ret
3966	if err := gensupport.DecodeResponse(target, res); err != nil {
3967		return nil, err
3968	}
3969	return ret, nil
3970	// {
3971	//   "description": "Lists the name of the subscriptions for this topic.",
3972	//   "flatPath": "v1beta2/projects/{projectsId}/topics/{topicsId}/subscriptions",
3973	//   "httpMethod": "GET",
3974	//   "id": "pubsub.projects.topics.subscriptions.list",
3975	//   "parameterOrder": [
3976	//     "topic"
3977	//   ],
3978	//   "parameters": {
3979	//     "pageSize": {
3980	//       "description": "Maximum number of subscription names to return.",
3981	//       "format": "int32",
3982	//       "location": "query",
3983	//       "type": "integer"
3984	//     },
3985	//     "pageToken": {
3986	//       "description": "The value returned by the last `ListTopicSubscriptionsResponse`; indicates\nthat this is a continuation of a prior `ListTopicSubscriptions` call, and\nthat the system should return the next page of data.",
3987	//       "location": "query",
3988	//       "type": "string"
3989	//     },
3990	//     "topic": {
3991	//       "description": "The name of the topic that subscriptions are attached to.",
3992	//       "location": "path",
3993	//       "pattern": "^projects/[^/]+/topics/[^/]+$",
3994	//       "required": true,
3995	//       "type": "string"
3996	//     }
3997	//   },
3998	//   "path": "v1beta2/{+topic}/subscriptions",
3999	//   "response": {
4000	//     "$ref": "ListTopicSubscriptionsResponse"
4001	//   },
4002	//   "scopes": [
4003	//     "https://www.googleapis.com/auth/cloud-platform",
4004	//     "https://www.googleapis.com/auth/pubsub"
4005	//   ]
4006	// }
4007
4008}
4009
4010// Pages invokes f for each page of results.
4011// A non-nil error returned from f will halt the iteration.
4012// The provided context supersedes any context provided to the Context method.
4013func (c *ProjectsTopicsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListTopicSubscriptionsResponse) error) error {
4014	c.ctx_ = ctx
4015	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
4016	for {
4017		x, err := c.Do()
4018		if err != nil {
4019			return err
4020		}
4021		if err := f(x); err != nil {
4022			return err
4023		}
4024		if x.NextPageToken == "" {
4025			return nil
4026		}
4027		c.PageToken(x.NextPageToken)
4028	}
4029}
4030