You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

4030 lines
139 KiB

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