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.
 
 
 

6708 lines
236 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package pubsub provides access to the Cloud Pub/Sub API.
  6. //
  7. // This package is DEPRECATED. Use package cloud.google.com/go/pubsub instead.
  8. //
  9. // For product documentation, see: https://cloud.google.com/pubsub/docs
  10. //
  11. // Creating a client
  12. //
  13. // Usage example:
  14. //
  15. // import "google.golang.org/api/pubsub/v1"
  16. // ...
  17. // ctx := context.Background()
  18. // pubsubService, err := pubsub.NewService(ctx)
  19. //
  20. // In this example, Google Application Default Credentials are used for authentication.
  21. //
  22. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  23. //
  24. // Other authentication options
  25. //
  26. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  27. //
  28. // pubsubService, err := pubsub.NewService(ctx, option.WithScopes(pubsub.PubsubScope))
  29. //
  30. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  31. //
  32. // pubsubService, err := pubsub.NewService(ctx, option.WithAPIKey("AIza..."))
  33. //
  34. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  35. //
  36. // config := &oauth2.Config{...}
  37. // // ...
  38. // token, err := config.Exchange(ctx, ...)
  39. // pubsubService, err := pubsub.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  40. //
  41. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  42. package pubsub // import "google.golang.org/api/pubsub/v1"
  43. import (
  44. "bytes"
  45. "context"
  46. "encoding/json"
  47. "errors"
  48. "fmt"
  49. "io"
  50. "net/http"
  51. "net/url"
  52. "strconv"
  53. "strings"
  54. gensupport "google.golang.org/api/gensupport"
  55. googleapi "google.golang.org/api/googleapi"
  56. option "google.golang.org/api/option"
  57. htransport "google.golang.org/api/transport/http"
  58. )
  59. // Always reference these packages, just in case the auto-generated code
  60. // below doesn't.
  61. var _ = bytes.NewBuffer
  62. var _ = strconv.Itoa
  63. var _ = fmt.Sprintf
  64. var _ = json.NewDecoder
  65. var _ = io.Copy
  66. var _ = url.Parse
  67. var _ = gensupport.MarshalJSON
  68. var _ = googleapi.Version
  69. var _ = errors.New
  70. var _ = strings.Replace
  71. var _ = context.Canceled
  72. const apiId = "pubsub:v1"
  73. const apiName = "pubsub"
  74. const apiVersion = "v1"
  75. const basePath = "https://pubsub.googleapis.com/"
  76. // OAuth2 scopes used by this API.
  77. const (
  78. // View and manage your data across Google Cloud Platform services
  79. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform"
  80. // View and manage Pub/Sub topics and subscriptions
  81. PubsubScope = "https://www.googleapis.com/auth/pubsub"
  82. )
  83. // NewService creates a new Service.
  84. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  85. scopesOption := option.WithScopes(
  86. "https://www.googleapis.com/auth/cloud-platform",
  87. "https://www.googleapis.com/auth/pubsub",
  88. )
  89. // NOTE: prepend, so we don't override user-specified scopes.
  90. opts = append([]option.ClientOption{scopesOption}, opts...)
  91. client, endpoint, err := htransport.NewClient(ctx, opts...)
  92. if err != nil {
  93. return nil, err
  94. }
  95. s, err := New(client)
  96. if err != nil {
  97. return nil, err
  98. }
  99. if endpoint != "" {
  100. s.BasePath = endpoint
  101. }
  102. return s, nil
  103. }
  104. // New creates a new Service. It uses the provided http.Client for requests.
  105. //
  106. // Deprecated: please use NewService instead.
  107. // To provide a custom HTTP client, use option.WithHTTPClient.
  108. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  109. func New(client *http.Client) (*Service, error) {
  110. if client == nil {
  111. return nil, errors.New("client is nil")
  112. }
  113. s := &Service{client: client, BasePath: basePath}
  114. s.Projects = NewProjectsService(s)
  115. return s, nil
  116. }
  117. type Service struct {
  118. client *http.Client
  119. BasePath string // API endpoint base URL
  120. UserAgent string // optional additional User-Agent fragment
  121. Projects *ProjectsService
  122. }
  123. func (s *Service) userAgent() string {
  124. if s.UserAgent == "" {
  125. return googleapi.UserAgent
  126. }
  127. return googleapi.UserAgent + " " + s.UserAgent
  128. }
  129. func NewProjectsService(s *Service) *ProjectsService {
  130. rs := &ProjectsService{s: s}
  131. rs.Snapshots = NewProjectsSnapshotsService(s)
  132. rs.Subscriptions = NewProjectsSubscriptionsService(s)
  133. rs.Topics = NewProjectsTopicsService(s)
  134. return rs
  135. }
  136. type ProjectsService struct {
  137. s *Service
  138. Snapshots *ProjectsSnapshotsService
  139. Subscriptions *ProjectsSubscriptionsService
  140. Topics *ProjectsTopicsService
  141. }
  142. func NewProjectsSnapshotsService(s *Service) *ProjectsSnapshotsService {
  143. rs := &ProjectsSnapshotsService{s: s}
  144. return rs
  145. }
  146. type ProjectsSnapshotsService struct {
  147. s *Service
  148. }
  149. func NewProjectsSubscriptionsService(s *Service) *ProjectsSubscriptionsService {
  150. rs := &ProjectsSubscriptionsService{s: s}
  151. return rs
  152. }
  153. type ProjectsSubscriptionsService struct {
  154. s *Service
  155. }
  156. func NewProjectsTopicsService(s *Service) *ProjectsTopicsService {
  157. rs := &ProjectsTopicsService{s: s}
  158. rs.Snapshots = NewProjectsTopicsSnapshotsService(s)
  159. rs.Subscriptions = NewProjectsTopicsSubscriptionsService(s)
  160. return rs
  161. }
  162. type ProjectsTopicsService struct {
  163. s *Service
  164. Snapshots *ProjectsTopicsSnapshotsService
  165. Subscriptions *ProjectsTopicsSubscriptionsService
  166. }
  167. func NewProjectsTopicsSnapshotsService(s *Service) *ProjectsTopicsSnapshotsService {
  168. rs := &ProjectsTopicsSnapshotsService{s: s}
  169. return rs
  170. }
  171. type ProjectsTopicsSnapshotsService struct {
  172. s *Service
  173. }
  174. func NewProjectsTopicsSubscriptionsService(s *Service) *ProjectsTopicsSubscriptionsService {
  175. rs := &ProjectsTopicsSubscriptionsService{s: s}
  176. return rs
  177. }
  178. type ProjectsTopicsSubscriptionsService struct {
  179. s *Service
  180. }
  181. // AcknowledgeRequest: Request for the Acknowledge method.
  182. type AcknowledgeRequest struct {
  183. // AckIds: The acknowledgment ID for the messages being acknowledged
  184. // that was returned
  185. // by the Pub/Sub system in the `Pull` response. Must not be empty.
  186. AckIds []string `json:"ackIds,omitempty"`
  187. // ForceSendFields is a list of field names (e.g. "AckIds") to
  188. // unconditionally include in API requests. By default, fields with
  189. // empty values are omitted from API requests. However, any non-pointer,
  190. // non-interface field appearing in ForceSendFields will be sent to the
  191. // server regardless of whether the field is empty or not. This may be
  192. // used to include empty fields in Patch requests.
  193. ForceSendFields []string `json:"-"`
  194. // NullFields is a list of field names (e.g. "AckIds") to include in API
  195. // requests with the JSON null value. By default, fields with empty
  196. // values are omitted from API requests. However, any field with an
  197. // empty value appearing in NullFields will be sent to the server as
  198. // null. It is an error if a field in this list has a non-empty value.
  199. // This may be used to include null fields in Patch requests.
  200. NullFields []string `json:"-"`
  201. }
  202. func (s *AcknowledgeRequest) MarshalJSON() ([]byte, error) {
  203. type NoMethod AcknowledgeRequest
  204. raw := NoMethod(*s)
  205. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  206. }
  207. // Binding: Associates `members` with a `role`.
  208. type Binding struct {
  209. // Condition: Unimplemented. The condition that is associated with this
  210. // binding.
  211. // NOTE: an unsatisfied condition will not allow user access via
  212. // current
  213. // binding. Different bindings, including their conditions, are
  214. // examined
  215. // independently.
  216. Condition *Expr `json:"condition,omitempty"`
  217. // Members: Specifies the identities requesting access for a Cloud
  218. // Platform resource.
  219. // `members` can have the following values:
  220. //
  221. // * `allUsers`: A special identifier that represents anyone who is
  222. // on the internet; with or without a Google account.
  223. //
  224. // * `allAuthenticatedUsers`: A special identifier that represents
  225. // anyone
  226. // who is authenticated with a Google account or a service
  227. // account.
  228. //
  229. // * `user:{emailid}`: An email address that represents a specific
  230. // Google
  231. // account. For example, `alice@gmail.com` .
  232. //
  233. //
  234. // * `serviceAccount:{emailid}`: An email address that represents a
  235. // service
  236. // account. For example,
  237. // `my-other-app@appspot.gserviceaccount.com`.
  238. //
  239. // * `group:{emailid}`: An email address that represents a Google
  240. // group.
  241. // For example, `admins@example.com`.
  242. //
  243. //
  244. // * `domain:{domain}`: The G Suite domain (primary) that represents all
  245. // the
  246. // users of that domain. For example, `google.com` or
  247. // `example.com`.
  248. //
  249. //
  250. Members []string `json:"members,omitempty"`
  251. // Role: Role that is assigned to `members`.
  252. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  253. Role string `json:"role,omitempty"`
  254. // ForceSendFields is a list of field names (e.g. "Condition") to
  255. // unconditionally include in API requests. By default, fields with
  256. // empty values are omitted from API requests. However, any non-pointer,
  257. // non-interface field appearing in ForceSendFields will be sent to the
  258. // server regardless of whether the field is empty or not. This may be
  259. // used to include empty fields in Patch requests.
  260. ForceSendFields []string `json:"-"`
  261. // NullFields is a list of field names (e.g. "Condition") to include in
  262. // API requests with the JSON null value. By default, fields with empty
  263. // values are omitted from API requests. However, any field with an
  264. // empty value appearing in NullFields will be sent to the server as
  265. // null. It is an error if a field in this list has a non-empty value.
  266. // This may be used to include null fields in Patch requests.
  267. NullFields []string `json:"-"`
  268. }
  269. func (s *Binding) MarshalJSON() ([]byte, error) {
  270. type NoMethod Binding
  271. raw := NoMethod(*s)
  272. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  273. }
  274. // CreateSnapshotRequest: Request for the `CreateSnapshot`
  275. // method.<br><br>
  276. // <b>BETA:</b> This feature is part of a beta release. This API might
  277. // be changed in
  278. // backward-incompatible ways and is not recommended for production
  279. // use.
  280. // It is not subject to any SLA or deprecation policy.
  281. type CreateSnapshotRequest struct {
  282. // Labels: See <a href="https://cloud.google.com/pubsub/docs/labels">
  283. // Creating and
  284. // managing labels</a>.
  285. Labels map[string]string `json:"labels,omitempty"`
  286. // Subscription: The subscription whose backlog the snapshot
  287. // retains.
  288. // Specifically, the created snapshot is guaranteed to retain:
  289. // (a) The existing backlog on the subscription. More precisely, this
  290. // is
  291. // defined as the messages in the subscription's backlog that are
  292. // unacknowledged upon the successful completion of the
  293. // `CreateSnapshot` request; as well as:
  294. // (b) Any messages published to the subscription's topic following
  295. // the
  296. // successful completion of the CreateSnapshot request.
  297. // Format is `projects/{project}/subscriptions/{sub}`.
  298. Subscription string `json:"subscription,omitempty"`
  299. // ForceSendFields is a list of field names (e.g. "Labels") to
  300. // unconditionally include in API requests. By default, fields with
  301. // empty values are omitted from API requests. However, any non-pointer,
  302. // non-interface field appearing in ForceSendFields will be sent to the
  303. // server regardless of whether the field is empty or not. This may be
  304. // used to include empty fields in Patch requests.
  305. ForceSendFields []string `json:"-"`
  306. // NullFields is a list of field names (e.g. "Labels") to include in API
  307. // requests with the JSON null value. By default, fields with empty
  308. // values are omitted from API requests. However, any field with an
  309. // empty value appearing in NullFields will be sent to the server as
  310. // null. It is an error if a field in this list has a non-empty value.
  311. // This may be used to include null fields in Patch requests.
  312. NullFields []string `json:"-"`
  313. }
  314. func (s *CreateSnapshotRequest) MarshalJSON() ([]byte, error) {
  315. type NoMethod CreateSnapshotRequest
  316. raw := NoMethod(*s)
  317. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  318. }
  319. // Empty: A generic empty message that you can re-use to avoid defining
  320. // duplicated
  321. // empty messages in your APIs. A typical example is to use it as the
  322. // request
  323. // or the response type of an API method. For instance:
  324. //
  325. // service Foo {
  326. // rpc Bar(google.protobuf.Empty) returns
  327. // (google.protobuf.Empty);
  328. // }
  329. //
  330. // The JSON representation for `Empty` is empty JSON object `{}`.
  331. type Empty struct {
  332. // ServerResponse contains the HTTP response code and headers from the
  333. // server.
  334. googleapi.ServerResponse `json:"-"`
  335. }
  336. // ExpirationPolicy: A policy that specifies the conditions for resource
  337. // expiration (i.e.,
  338. // automatic resource deletion).
  339. type ExpirationPolicy struct {
  340. // Ttl: Specifies the "time-to-live" duration for an associated
  341. // resource. The
  342. // resource expires if it is not active for a period of `ttl`. The
  343. // definition
  344. // of "activity" depends on the type of the associated resource. The
  345. // minimum
  346. // and maximum allowed values for `ttl` depend on the type of the
  347. // associated
  348. // resource, as well. If `ttl` is not set, the associated resource
  349. // never
  350. // expires.
  351. Ttl string `json:"ttl,omitempty"`
  352. // ForceSendFields is a list of field names (e.g. "Ttl") to
  353. // unconditionally include in API requests. By default, fields with
  354. // empty values are omitted from API requests. However, any non-pointer,
  355. // non-interface field appearing in ForceSendFields will be sent to the
  356. // server regardless of whether the field is empty or not. This may be
  357. // used to include empty fields in Patch requests.
  358. ForceSendFields []string `json:"-"`
  359. // NullFields is a list of field names (e.g. "Ttl") to include in API
  360. // requests with the JSON null value. By default, fields with empty
  361. // values are omitted from API requests. However, any field with an
  362. // empty value appearing in NullFields will be sent to the server as
  363. // null. It is an error if a field in this list has a non-empty value.
  364. // This may be used to include null fields in Patch requests.
  365. NullFields []string `json:"-"`
  366. }
  367. func (s *ExpirationPolicy) MarshalJSON() ([]byte, error) {
  368. type NoMethod ExpirationPolicy
  369. raw := NoMethod(*s)
  370. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  371. }
  372. // Expr: Represents an expression text. Example:
  373. //
  374. // title: "User account presence"
  375. // description: "Determines whether the request has a user account"
  376. // expression: "size(request.user) > 0"
  377. type Expr struct {
  378. // Description: An optional description of the expression. This is a
  379. // longer text which
  380. // describes the expression, e.g. when hovered over it in a UI.
  381. Description string `json:"description,omitempty"`
  382. // Expression: Textual representation of an expression in
  383. // Common Expression Language syntax.
  384. //
  385. // The application context of the containing message determines
  386. // which
  387. // well-known feature set of CEL is supported.
  388. Expression string `json:"expression,omitempty"`
  389. // Location: An optional string indicating the location of the
  390. // expression for error
  391. // reporting, e.g. a file name and a position in the file.
  392. Location string `json:"location,omitempty"`
  393. // Title: An optional title for the expression, i.e. a short string
  394. // describing
  395. // its purpose. This can be used e.g. in UIs which allow to enter
  396. // the
  397. // expression.
  398. Title string `json:"title,omitempty"`
  399. // ForceSendFields is a list of field names (e.g. "Description") to
  400. // unconditionally include in API requests. By default, fields with
  401. // empty values are omitted from API requests. However, any non-pointer,
  402. // non-interface field appearing in ForceSendFields will be sent to the
  403. // server regardless of whether the field is empty or not. This may be
  404. // used to include empty fields in Patch requests.
  405. ForceSendFields []string `json:"-"`
  406. // NullFields is a list of field names (e.g. "Description") to include
  407. // in API requests with the JSON null value. By default, fields with
  408. // empty values are omitted from API requests. However, any field with
  409. // an empty value appearing in NullFields will be sent to the server as
  410. // null. It is an error if a field in this list has a non-empty value.
  411. // This may be used to include null fields in Patch requests.
  412. NullFields []string `json:"-"`
  413. }
  414. func (s *Expr) MarshalJSON() ([]byte, error) {
  415. type NoMethod Expr
  416. raw := NoMethod(*s)
  417. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  418. }
  419. // ListSnapshotsResponse: Response for the `ListSnapshots`
  420. // method.<br><br>
  421. // <b>BETA:</b> This feature is part of a beta release. This API might
  422. // be
  423. // changed in backward-incompatible ways and is not recommended for
  424. // production
  425. // use. It is not subject to any SLA or deprecation policy.
  426. type ListSnapshotsResponse struct {
  427. // NextPageToken: If not empty, indicates that there may be more
  428. // snapshot that match the
  429. // request; this value should be passed in a new `ListSnapshotsRequest`.
  430. NextPageToken string `json:"nextPageToken,omitempty"`
  431. // Snapshots: The resulting snapshots.
  432. Snapshots []*Snapshot `json:"snapshots,omitempty"`
  433. // ServerResponse contains the HTTP response code and headers from the
  434. // server.
  435. googleapi.ServerResponse `json:"-"`
  436. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  437. // unconditionally include in API requests. By default, fields with
  438. // empty values are omitted from API requests. However, any non-pointer,
  439. // non-interface field appearing in ForceSendFields will be sent to the
  440. // server regardless of whether the field is empty or not. This may be
  441. // used to include empty fields in Patch requests.
  442. ForceSendFields []string `json:"-"`
  443. // NullFields is a list of field names (e.g. "NextPageToken") to include
  444. // in API requests with the JSON null value. By default, fields with
  445. // empty values are omitted from API requests. However, any field with
  446. // an empty value appearing in NullFields will be sent to the server as
  447. // null. It is an error if a field in this list has a non-empty value.
  448. // This may be used to include null fields in Patch requests.
  449. NullFields []string `json:"-"`
  450. }
  451. func (s *ListSnapshotsResponse) MarshalJSON() ([]byte, error) {
  452. type NoMethod ListSnapshotsResponse
  453. raw := NoMethod(*s)
  454. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  455. }
  456. // ListSubscriptionsResponse: Response for the `ListSubscriptions`
  457. // method.
  458. type ListSubscriptionsResponse struct {
  459. // NextPageToken: If not empty, indicates that there may be more
  460. // subscriptions that match
  461. // the request; this value should be passed in a
  462. // new
  463. // `ListSubscriptionsRequest` to get more subscriptions.
  464. NextPageToken string `json:"nextPageToken,omitempty"`
  465. // Subscriptions: The subscriptions that match the request.
  466. Subscriptions []*Subscription `json:"subscriptions,omitempty"`
  467. // ServerResponse contains the HTTP response code and headers from the
  468. // server.
  469. googleapi.ServerResponse `json:"-"`
  470. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  471. // unconditionally include in API requests. By default, fields with
  472. // empty values are omitted from API requests. However, any non-pointer,
  473. // non-interface field appearing in ForceSendFields will be sent to the
  474. // server regardless of whether the field is empty or not. This may be
  475. // used to include empty fields in Patch requests.
  476. ForceSendFields []string `json:"-"`
  477. // NullFields is a list of field names (e.g. "NextPageToken") to include
  478. // in API requests with the JSON null value. By default, fields with
  479. // empty values are omitted from API requests. However, any field with
  480. // an empty value appearing in NullFields will be sent to the server as
  481. // null. It is an error if a field in this list has a non-empty value.
  482. // This may be used to include null fields in Patch requests.
  483. NullFields []string `json:"-"`
  484. }
  485. func (s *ListSubscriptionsResponse) MarshalJSON() ([]byte, error) {
  486. type NoMethod ListSubscriptionsResponse
  487. raw := NoMethod(*s)
  488. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  489. }
  490. // ListTopicSnapshotsResponse: Response for the `ListTopicSnapshots`
  491. // method.<br><br>
  492. // <b>BETA:</b> This feature is part of a beta release. This API might
  493. // be
  494. // changed in backward-incompatible ways and is not recommended for
  495. // production
  496. // use. It is not subject to any SLA or deprecation policy.
  497. type ListTopicSnapshotsResponse struct {
  498. // NextPageToken: If not empty, indicates that there may be more
  499. // snapshots that match
  500. // the request; this value should be passed in a
  501. // new
  502. // `ListTopicSnapshotsRequest` to get more snapshots.
  503. NextPageToken string `json:"nextPageToken,omitempty"`
  504. // Snapshots: The names of the snapshots that match the request.
  505. Snapshots []string `json:"snapshots,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. "NextPageToken") 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. "NextPageToken") to include
  517. // in API requests with the JSON null value. By default, fields with
  518. // empty values are omitted from API requests. However, any field with
  519. // an 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 *ListTopicSnapshotsResponse) MarshalJSON() ([]byte, error) {
  525. type NoMethod ListTopicSnapshotsResponse
  526. raw := NoMethod(*s)
  527. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  528. }
  529. // ListTopicSubscriptionsResponse: Response for the
  530. // `ListTopicSubscriptions` method.
  531. type ListTopicSubscriptionsResponse struct {
  532. // NextPageToken: If not empty, indicates that there may be more
  533. // subscriptions that match
  534. // the request; this value should be passed in a
  535. // new
  536. // `ListTopicSubscriptionsRequest` to get more subscriptions.
  537. NextPageToken string `json:"nextPageToken,omitempty"`
  538. // Subscriptions: The names of the subscriptions that match the request.
  539. Subscriptions []string `json:"subscriptions,omitempty"`
  540. // ServerResponse contains the HTTP response code and headers from the
  541. // server.
  542. googleapi.ServerResponse `json:"-"`
  543. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  544. // unconditionally include in API requests. By default, fields with
  545. // empty values are omitted from API requests. However, any non-pointer,
  546. // non-interface field appearing in ForceSendFields will be sent to the
  547. // server regardless of whether the field is empty or not. This may be
  548. // used to include empty fields in Patch requests.
  549. ForceSendFields []string `json:"-"`
  550. // NullFields is a list of field names (e.g. "NextPageToken") to include
  551. // in API requests with the JSON null value. By default, fields with
  552. // empty values are omitted from API requests. However, any field with
  553. // an empty value appearing in NullFields will be sent to the server as
  554. // null. It is an error if a field in this list has a non-empty value.
  555. // This may be used to include null fields in Patch requests.
  556. NullFields []string `json:"-"`
  557. }
  558. func (s *ListTopicSubscriptionsResponse) MarshalJSON() ([]byte, error) {
  559. type NoMethod ListTopicSubscriptionsResponse
  560. raw := NoMethod(*s)
  561. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  562. }
  563. // ListTopicsResponse: Response for the `ListTopics` method.
  564. type ListTopicsResponse struct {
  565. // NextPageToken: If not empty, indicates that there may be more topics
  566. // that match the
  567. // request; this value should be passed in a new `ListTopicsRequest`.
  568. NextPageToken string `json:"nextPageToken,omitempty"`
  569. // Topics: The resulting topics.
  570. Topics []*Topic `json:"topics,omitempty"`
  571. // ServerResponse contains the HTTP response code and headers from the
  572. // server.
  573. googleapi.ServerResponse `json:"-"`
  574. // ForceSendFields is a list of field names (e.g. "NextPageToken") to
  575. // unconditionally include in API requests. By default, fields with
  576. // empty values are omitted from API requests. However, any non-pointer,
  577. // non-interface field appearing in ForceSendFields will be sent to the
  578. // server regardless of whether the field is empty or not. This may be
  579. // used to include empty fields in Patch requests.
  580. ForceSendFields []string `json:"-"`
  581. // NullFields is a list of field names (e.g. "NextPageToken") to include
  582. // in API requests with the JSON null value. By default, fields with
  583. // empty values are omitted from API requests. However, any field with
  584. // an empty value appearing in NullFields will be sent to the server as
  585. // null. It is an error if a field in this list has a non-empty value.
  586. // This may be used to include null fields in Patch requests.
  587. NullFields []string `json:"-"`
  588. }
  589. func (s *ListTopicsResponse) MarshalJSON() ([]byte, error) {
  590. type NoMethod ListTopicsResponse
  591. raw := NoMethod(*s)
  592. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  593. }
  594. // ModifyAckDeadlineRequest: Request for the ModifyAckDeadline method.
  595. type ModifyAckDeadlineRequest struct {
  596. // AckDeadlineSeconds: The new ack deadline with respect to the time
  597. // this request was sent to
  598. // the Pub/Sub system. For example, if the value is 10, the new
  599. // ack deadline will expire 10 seconds after the `ModifyAckDeadline`
  600. // call
  601. // was made. Specifying zero might immediately make the message
  602. // available for
  603. // delivery to another subscriber client. This typically results in
  604. // an
  605. // increase in the rate of message redeliveries (that is,
  606. // duplicates).
  607. // The minimum deadline you can specify is 0 seconds.
  608. // The maximum deadline you can specify is 600 seconds (10 minutes).
  609. AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
  610. // AckIds: List of acknowledgment IDs.
  611. AckIds []string `json:"ackIds,omitempty"`
  612. // ForceSendFields is a list of field names (e.g. "AckDeadlineSeconds")
  613. // to unconditionally include in API requests. By default, fields with
  614. // empty values are omitted from API requests. However, any non-pointer,
  615. // non-interface field appearing in ForceSendFields will be sent to the
  616. // server regardless of whether the field is empty or not. This may be
  617. // used to include empty fields in Patch requests.
  618. ForceSendFields []string `json:"-"`
  619. // NullFields is a list of field names (e.g. "AckDeadlineSeconds") to
  620. // include in API requests with the JSON null value. By default, fields
  621. // with empty values are omitted from API requests. However, any field
  622. // with an empty value appearing in NullFields will be sent to the
  623. // server as null. It is an error if a field in this list has a
  624. // non-empty value. This may be used to include null fields in Patch
  625. // requests.
  626. NullFields []string `json:"-"`
  627. }
  628. func (s *ModifyAckDeadlineRequest) MarshalJSON() ([]byte, error) {
  629. type NoMethod ModifyAckDeadlineRequest
  630. raw := NoMethod(*s)
  631. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  632. }
  633. // ModifyPushConfigRequest: Request for the ModifyPushConfig method.
  634. type ModifyPushConfigRequest struct {
  635. // PushConfig: The push configuration for future deliveries.
  636. //
  637. // An empty `pushConfig` indicates that the Pub/Sub system should
  638. // stop pushing messages from the given subscription and allow
  639. // messages to be pulled and acknowledged - effectively pausing
  640. // the subscription if `Pull` or `StreamingPull` is not called.
  641. PushConfig *PushConfig `json:"pushConfig,omitempty"`
  642. // ForceSendFields is a list of field names (e.g. "PushConfig") to
  643. // unconditionally include in API requests. By default, fields with
  644. // empty values are omitted from API requests. However, any non-pointer,
  645. // non-interface field appearing in ForceSendFields will be sent to the
  646. // server regardless of whether the field is empty or not. This may be
  647. // used to include empty fields in Patch requests.
  648. ForceSendFields []string `json:"-"`
  649. // NullFields is a list of field names (e.g. "PushConfig") to include in
  650. // API requests with the JSON null value. By default, fields with empty
  651. // values are omitted from API requests. However, any field with an
  652. // empty value appearing in NullFields will be sent to the server as
  653. // null. It is an error if a field in this list has a non-empty value.
  654. // This may be used to include null fields in Patch requests.
  655. NullFields []string `json:"-"`
  656. }
  657. func (s *ModifyPushConfigRequest) MarshalJSON() ([]byte, error) {
  658. type NoMethod ModifyPushConfigRequest
  659. raw := NoMethod(*s)
  660. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  661. }
  662. // Policy: Defines an Identity and Access Management (IAM) policy. It is
  663. // used to
  664. // specify access control policies for Cloud Platform resources.
  665. //
  666. //
  667. // A `Policy` consists of a list of `bindings`. A `binding` binds a list
  668. // of
  669. // `members` to a `role`, where the members can be user accounts, Google
  670. // groups,
  671. // Google domains, and service accounts. A `role` is a named list of
  672. // permissions
  673. // defined by IAM.
  674. //
  675. // **JSON Example**
  676. //
  677. // {
  678. // "bindings": [
  679. // {
  680. // "role": "roles/owner",
  681. // "members": [
  682. // "user:mike@example.com",
  683. // "group:admins@example.com",
  684. // "domain:google.com",
  685. //
  686. // "serviceAccount:my-other-app@appspot.gserviceaccount.com"
  687. // ]
  688. // },
  689. // {
  690. // "role": "roles/viewer",
  691. // "members": ["user:sean@example.com"]
  692. // }
  693. // ]
  694. // }
  695. //
  696. // **YAML Example**
  697. //
  698. // bindings:
  699. // - members:
  700. // - user:mike@example.com
  701. // - group:admins@example.com
  702. // - domain:google.com
  703. // - serviceAccount:my-other-app@appspot.gserviceaccount.com
  704. // role: roles/owner
  705. // - members:
  706. // - user:sean@example.com
  707. // role: roles/viewer
  708. //
  709. //
  710. // For a description of IAM and its features, see the
  711. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  712. type Policy struct {
  713. // Bindings: Associates a list of `members` to a `role`.
  714. // `bindings` with no members will result in an error.
  715. Bindings []*Binding `json:"bindings,omitempty"`
  716. // Etag: `etag` is used for optimistic concurrency control as a way to
  717. // help
  718. // prevent simultaneous updates of a policy from overwriting each
  719. // other.
  720. // It is strongly suggested that systems make use of the `etag` in
  721. // the
  722. // read-modify-write cycle to perform policy updates in order to avoid
  723. // race
  724. // conditions: An `etag` is returned in the response to `getIamPolicy`,
  725. // and
  726. // systems are expected to put that etag in the request to
  727. // `setIamPolicy` to
  728. // ensure that their change will be applied to the same version of the
  729. // policy.
  730. //
  731. // If no `etag` is provided in the call to `setIamPolicy`, then the
  732. // existing
  733. // policy is overwritten blindly.
  734. Etag string `json:"etag,omitempty"`
  735. // Version: Deprecated.
  736. Version int64 `json:"version,omitempty"`
  737. // ServerResponse contains the HTTP response code and headers from the
  738. // server.
  739. googleapi.ServerResponse `json:"-"`
  740. // ForceSendFields is a list of field names (e.g. "Bindings") 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. "Bindings") to include in
  748. // API 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 *Policy) MarshalJSON() ([]byte, error) {
  756. type NoMethod Policy
  757. raw := NoMethod(*s)
  758. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  759. }
  760. // PublishRequest: Request for the Publish method.
  761. type PublishRequest struct {
  762. // Messages: The messages to publish.
  763. Messages []*PubsubMessage `json:"messages,omitempty"`
  764. // ForceSendFields is a list of field names (e.g. "Messages") to
  765. // unconditionally include in API requests. By default, fields with
  766. // empty values are omitted from API requests. However, any non-pointer,
  767. // non-interface field appearing in ForceSendFields will be sent to the
  768. // server regardless of whether the field is empty or not. This may be
  769. // used to include empty fields in Patch requests.
  770. ForceSendFields []string `json:"-"`
  771. // NullFields is a list of field names (e.g. "Messages") to include in
  772. // API requests with the JSON null value. By default, fields with empty
  773. // values are omitted from API requests. However, any field with an
  774. // empty value appearing in NullFields will be sent to the server as
  775. // null. It is an error if a field in this list has a non-empty value.
  776. // This may be used to include null fields in Patch requests.
  777. NullFields []string `json:"-"`
  778. }
  779. func (s *PublishRequest) MarshalJSON() ([]byte, error) {
  780. type NoMethod PublishRequest
  781. raw := NoMethod(*s)
  782. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  783. }
  784. // PublishResponse: Response for the `Publish` method.
  785. type PublishResponse struct {
  786. // MessageIds: The server-assigned ID of each published message, in the
  787. // same order as
  788. // the messages in the request. IDs are guaranteed to be unique
  789. // within
  790. // the topic.
  791. MessageIds []string `json:"messageIds,omitempty"`
  792. // ServerResponse contains the HTTP response code and headers from the
  793. // server.
  794. googleapi.ServerResponse `json:"-"`
  795. // ForceSendFields is a list of field names (e.g. "MessageIds") to
  796. // unconditionally include in API requests. By default, fields with
  797. // empty values are omitted from API requests. However, any non-pointer,
  798. // non-interface field appearing in ForceSendFields will be sent to the
  799. // server regardless of whether the field is empty or not. This may be
  800. // used to include empty fields in Patch requests.
  801. ForceSendFields []string `json:"-"`
  802. // NullFields is a list of field names (e.g. "MessageIds") to include in
  803. // API requests with the JSON null value. By default, fields with empty
  804. // values are omitted from API requests. However, any field with an
  805. // empty value appearing in NullFields will be sent to the server as
  806. // null. It is an error if a field in this list has a non-empty value.
  807. // This may be used to include null fields in Patch requests.
  808. NullFields []string `json:"-"`
  809. }
  810. func (s *PublishResponse) MarshalJSON() ([]byte, error) {
  811. type NoMethod PublishResponse
  812. raw := NoMethod(*s)
  813. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  814. }
  815. // PubsubMessage: A message that is published by publishers and consumed
  816. // by subscribers. The
  817. // message must contain either a non-empty data field or at least one
  818. // attribute.
  819. // Note that client libraries represent this object
  820. // differently
  821. // depending on the language. See the corresponding
  822. // <a
  823. // href="https://cloud.google.com/pubsub/docs/reference/libraries">client
  824. //
  825. // library documentation</a> for more information. See
  826. // <a href="https://cloud.google.com/pubsub/quotas">Quotas and
  827. // limits</a>
  828. // for more information about message limits.
  829. type PubsubMessage struct {
  830. // Attributes: Optional attributes for this message.
  831. Attributes map[string]string `json:"attributes,omitempty"`
  832. // Data: The message data field. If this field is empty, the message
  833. // must contain
  834. // at least one attribute.
  835. Data string `json:"data,omitempty"`
  836. // MessageId: ID of this message, assigned by the server when the
  837. // message is published.
  838. // Guaranteed to be unique within the topic. This value may be read by
  839. // a
  840. // subscriber that receives a `PubsubMessage` via a `Pull` call or a
  841. // push
  842. // delivery. It must not be populated by the publisher in a `Publish`
  843. // call.
  844. MessageId string `json:"messageId,omitempty"`
  845. // PublishTime: The time at which the message was published, populated
  846. // by the server when
  847. // it receives the `Publish` call. It must not be populated by
  848. // the
  849. // publisher in a `Publish` call.
  850. PublishTime string `json:"publishTime,omitempty"`
  851. // ForceSendFields is a list of field names (e.g. "Attributes") to
  852. // unconditionally include in API requests. By default, fields with
  853. // empty values are omitted from API requests. However, any non-pointer,
  854. // non-interface field appearing in ForceSendFields will be sent to the
  855. // server regardless of whether the field is empty or not. This may be
  856. // used to include empty fields in Patch requests.
  857. ForceSendFields []string `json:"-"`
  858. // NullFields is a list of field names (e.g. "Attributes") to include in
  859. // API requests with the JSON null value. By default, fields with empty
  860. // values are omitted from API requests. However, any field with an
  861. // empty value appearing in NullFields will be sent to the server as
  862. // null. It is an error if a field in this list has a non-empty value.
  863. // This may be used to include null fields in Patch requests.
  864. NullFields []string `json:"-"`
  865. }
  866. func (s *PubsubMessage) MarshalJSON() ([]byte, error) {
  867. type NoMethod PubsubMessage
  868. raw := NoMethod(*s)
  869. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  870. }
  871. // PullRequest: Request for the `Pull` method.
  872. type PullRequest struct {
  873. // MaxMessages: The maximum number of messages returned for this
  874. // request. The Pub/Sub
  875. // system may return fewer than the number specified.
  876. MaxMessages int64 `json:"maxMessages,omitempty"`
  877. // ReturnImmediately: If this field set to true, the system will respond
  878. // immediately even if
  879. // it there are no messages available to return in the `Pull`
  880. // response.
  881. // Otherwise, the system may wait (for a bounded amount of time) until
  882. // at
  883. // least one message is available, rather than returning no messages.
  884. ReturnImmediately bool `json:"returnImmediately,omitempty"`
  885. // ForceSendFields is a list of field names (e.g. "MaxMessages") to
  886. // unconditionally include in API requests. By default, fields with
  887. // empty values are omitted from API requests. However, any non-pointer,
  888. // non-interface field appearing in ForceSendFields will be sent to the
  889. // server regardless of whether the field is empty or not. This may be
  890. // used to include empty fields in Patch requests.
  891. ForceSendFields []string `json:"-"`
  892. // NullFields is a list of field names (e.g. "MaxMessages") to include
  893. // in API requests with the JSON null value. By default, fields with
  894. // empty values are omitted from API requests. However, any field with
  895. // an empty value appearing in NullFields will be sent to the server as
  896. // null. It is an error if a field in this list has a non-empty value.
  897. // This may be used to include null fields in Patch requests.
  898. NullFields []string `json:"-"`
  899. }
  900. func (s *PullRequest) MarshalJSON() ([]byte, error) {
  901. type NoMethod PullRequest
  902. raw := NoMethod(*s)
  903. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  904. }
  905. // PullResponse: Response for the `Pull` method.
  906. type PullResponse struct {
  907. // ReceivedMessages: Received Pub/Sub messages. The list will be empty
  908. // if there are no more
  909. // messages available in the backlog. For JSON, the response can be
  910. // entirely
  911. // empty. The Pub/Sub system may return fewer than the `maxMessages`
  912. // requested
  913. // even if there are more messages available in the backlog.
  914. ReceivedMessages []*ReceivedMessage `json:"receivedMessages,omitempty"`
  915. // ServerResponse contains the HTTP response code and headers from the
  916. // server.
  917. googleapi.ServerResponse `json:"-"`
  918. // ForceSendFields is a list of field names (e.g. "ReceivedMessages") to
  919. // unconditionally include in API requests. By default, fields with
  920. // empty values are omitted from API requests. However, any non-pointer,
  921. // non-interface field appearing in ForceSendFields will be sent to the
  922. // server regardless of whether the field is empty or not. This may be
  923. // used to include empty fields in Patch requests.
  924. ForceSendFields []string `json:"-"`
  925. // NullFields is a list of field names (e.g. "ReceivedMessages") to
  926. // include in API requests with the JSON null value. By default, fields
  927. // with empty values are omitted from API requests. However, any field
  928. // with an empty value appearing in NullFields will be sent to the
  929. // server as null. It is an error if a field in this list has a
  930. // non-empty value. This may be used to include null fields in Patch
  931. // requests.
  932. NullFields []string `json:"-"`
  933. }
  934. func (s *PullResponse) MarshalJSON() ([]byte, error) {
  935. type NoMethod PullResponse
  936. raw := NoMethod(*s)
  937. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  938. }
  939. // PushConfig: Configuration for a push delivery endpoint.
  940. type PushConfig struct {
  941. // Attributes: Endpoint configuration attributes.
  942. //
  943. // Every endpoint has a set of API supported attributes that can be used
  944. // to
  945. // control different aspects of the message delivery.
  946. //
  947. // The currently supported attribute is `x-goog-version`, which you
  948. // can
  949. // use to change the format of the pushed message. This
  950. // attribute
  951. // indicates the version of the data expected by the endpoint.
  952. // This
  953. // controls the shape of the pushed message (i.e., its fields and
  954. // metadata).
  955. // The endpoint version is based on the version of the Pub/Sub API.
  956. //
  957. // If not present during the `CreateSubscription` call, it will default
  958. // to
  959. // the version of the API used to make such call. If not present during
  960. // a
  961. // `ModifyPushConfig` call, its value will not be changed.
  962. // `GetSubscription`
  963. // calls will always return a valid version, even if the subscription
  964. // was
  965. // created without this attribute.
  966. //
  967. // The possible values for this attribute are:
  968. //
  969. // * `v1beta1`: uses the push format defined in the v1beta1 Pub/Sub
  970. // API.
  971. // * `v1` or `v1beta2`: uses the push format defined in the v1 Pub/Sub
  972. // API.
  973. Attributes map[string]string `json:"attributes,omitempty"`
  974. // PushEndpoint: A URL locating the endpoint to which messages should be
  975. // pushed.
  976. // For example, a Webhook endpoint might use "https://example.com/push".
  977. PushEndpoint string `json:"pushEndpoint,omitempty"`
  978. // ForceSendFields is a list of field names (e.g. "Attributes") to
  979. // unconditionally include in API requests. By default, fields with
  980. // empty values are omitted from API requests. However, any non-pointer,
  981. // non-interface field appearing in ForceSendFields will be sent to the
  982. // server regardless of whether the field is empty or not. This may be
  983. // used to include empty fields in Patch requests.
  984. ForceSendFields []string `json:"-"`
  985. // NullFields is a list of field names (e.g. "Attributes") to include in
  986. // API requests with the JSON null value. By default, fields with empty
  987. // values are omitted from API requests. However, any field with an
  988. // empty value appearing in NullFields will be sent to the server as
  989. // null. It is an error if a field in this list has a non-empty value.
  990. // This may be used to include null fields in Patch requests.
  991. NullFields []string `json:"-"`
  992. }
  993. func (s *PushConfig) MarshalJSON() ([]byte, error) {
  994. type NoMethod PushConfig
  995. raw := NoMethod(*s)
  996. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  997. }
  998. // ReceivedMessage: A message and its corresponding acknowledgment ID.
  999. type ReceivedMessage struct {
  1000. // AckId: This ID can be used to acknowledge the received message.
  1001. AckId string `json:"ackId,omitempty"`
  1002. // Message: The message.
  1003. Message *PubsubMessage `json:"message,omitempty"`
  1004. // ForceSendFields is a list of field names (e.g. "AckId") to
  1005. // unconditionally include in API requests. By default, fields with
  1006. // empty values are omitted from API requests. However, any non-pointer,
  1007. // non-interface field appearing in ForceSendFields will be sent to the
  1008. // server regardless of whether the field is empty or not. This may be
  1009. // used to include empty fields in Patch requests.
  1010. ForceSendFields []string `json:"-"`
  1011. // NullFields is a list of field names (e.g. "AckId") to include in API
  1012. // requests with the JSON null value. By default, fields with empty
  1013. // values are omitted from API requests. However, any field with an
  1014. // empty value appearing in NullFields will be sent to the server as
  1015. // null. It is an error if a field in this list has a non-empty value.
  1016. // This may be used to include null fields in Patch requests.
  1017. NullFields []string `json:"-"`
  1018. }
  1019. func (s *ReceivedMessage) MarshalJSON() ([]byte, error) {
  1020. type NoMethod ReceivedMessage
  1021. raw := NoMethod(*s)
  1022. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1023. }
  1024. // SeekRequest: Request for the `Seek` method. <br><br>
  1025. // <b>BETA:</b> This feature is part of a beta release. This API might
  1026. // be
  1027. // changed in backward-incompatible ways and is not recommended for
  1028. // production
  1029. // use. It is not subject to any SLA or deprecation policy.
  1030. type SeekRequest struct {
  1031. // Snapshot: The snapshot to seek to. The snapshot's topic must be the
  1032. // same as that of
  1033. // the provided subscription.
  1034. // Format is `projects/{project}/snapshots/{snap}`.
  1035. Snapshot string `json:"snapshot,omitempty"`
  1036. // Time: The time to seek to.
  1037. // Messages retained in the subscription that were published before
  1038. // this
  1039. // time are marked as acknowledged, and messages retained in
  1040. // the
  1041. // subscription that were published after this time are marked
  1042. // as
  1043. // unacknowledged. Note that this operation affects only those
  1044. // messages
  1045. // retained in the subscription (configured by the combination
  1046. // of
  1047. // `message_retention_duration` and `retain_acked_messages`). For
  1048. // example,
  1049. // if `time` corresponds to a point before the message retention
  1050. // window (or to a point before the system's notion of the
  1051. // subscription
  1052. // creation time), only retained messages will be marked as
  1053. // unacknowledged,
  1054. // and already-expunged messages will not be restored.
  1055. Time string `json:"time,omitempty"`
  1056. // ForceSendFields is a list of field names (e.g. "Snapshot") to
  1057. // unconditionally include in API requests. By default, fields with
  1058. // empty values are omitted from API requests. However, any non-pointer,
  1059. // non-interface field appearing in ForceSendFields will be sent to the
  1060. // server regardless of whether the field is empty or not. This may be
  1061. // used to include empty fields in Patch requests.
  1062. ForceSendFields []string `json:"-"`
  1063. // NullFields is a list of field names (e.g. "Snapshot") to include in
  1064. // API requests with the JSON null value. By default, fields with empty
  1065. // values are omitted from API requests. However, any field with an
  1066. // empty value appearing in NullFields will be sent to the server as
  1067. // null. It is an error if a field in this list has a non-empty value.
  1068. // This may be used to include null fields in Patch requests.
  1069. NullFields []string `json:"-"`
  1070. }
  1071. func (s *SeekRequest) MarshalJSON() ([]byte, error) {
  1072. type NoMethod SeekRequest
  1073. raw := NoMethod(*s)
  1074. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1075. }
  1076. // SeekResponse: Response for the `Seek` method (this response is
  1077. // empty).
  1078. type SeekResponse struct {
  1079. // ServerResponse contains the HTTP response code and headers from the
  1080. // server.
  1081. googleapi.ServerResponse `json:"-"`
  1082. }
  1083. // SetIamPolicyRequest: Request message for `SetIamPolicy` method.
  1084. type SetIamPolicyRequest struct {
  1085. // Policy: REQUIRED: The complete policy to be applied to the
  1086. // `resource`. The size of
  1087. // the policy is limited to a few 10s of KB. An empty policy is a
  1088. // valid policy but certain Cloud Platform services (such as
  1089. // Projects)
  1090. // might reject them.
  1091. Policy *Policy `json:"policy,omitempty"`
  1092. // ForceSendFields is a list of field names (e.g. "Policy") to
  1093. // unconditionally include in API requests. By default, fields with
  1094. // empty values are omitted from API requests. However, any non-pointer,
  1095. // non-interface field appearing in ForceSendFields will be sent to the
  1096. // server regardless of whether the field is empty or not. This may be
  1097. // used to include empty fields in Patch requests.
  1098. ForceSendFields []string `json:"-"`
  1099. // NullFields is a list of field names (e.g. "Policy") to include in API
  1100. // requests with the JSON null value. By default, fields with empty
  1101. // values are omitted from API requests. However, any field with an
  1102. // empty value appearing in NullFields will be sent to the server as
  1103. // null. It is an error if a field in this list has a non-empty value.
  1104. // This may be used to include null fields in Patch requests.
  1105. NullFields []string `json:"-"`
  1106. }
  1107. func (s *SetIamPolicyRequest) MarshalJSON() ([]byte, error) {
  1108. type NoMethod SetIamPolicyRequest
  1109. raw := NoMethod(*s)
  1110. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1111. }
  1112. // Snapshot: A snapshot resource. Snapshots are used in
  1113. // <a
  1114. // href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
  1115. // o
  1116. // perations, which allow
  1117. // you to manage message acknowledgments in bulk. That is, you can set
  1118. // the
  1119. // acknowledgment state of messages in an existing subscription to the
  1120. // state
  1121. // captured by a snapshot.<br><br>
  1122. // <b>BETA:</b> This feature is part of a beta release. This API might
  1123. // be
  1124. // changed in backward-incompatible ways and is not recommended for
  1125. // production
  1126. // use. It is not subject to any SLA or deprecation policy.
  1127. type Snapshot struct {
  1128. // ExpireTime: The snapshot is guaranteed to exist up until this time.
  1129. // A newly-created snapshot expires no later than 7 days from the time
  1130. // of its
  1131. // creation. Its exact lifetime is determined at creation by the
  1132. // existing
  1133. // backlog in the source subscription. Specifically, the lifetime of
  1134. // the
  1135. // snapshot is `7 days - (age of oldest unacked message in the
  1136. // subscription)`.
  1137. // For example, consider a subscription whose oldest unacked message is
  1138. // 3 days
  1139. // old. If a snapshot is created from this subscription, the snapshot --
  1140. // which
  1141. // will always capture this 3-day-old backlog as long as the
  1142. // snapshot
  1143. // exists -- will expire in 4 days. The service will refuse to create
  1144. // a
  1145. // snapshot that would expire in less than 1 hour after creation.
  1146. ExpireTime string `json:"expireTime,omitempty"`
  1147. // Labels: See <a href="https://cloud.google.com/pubsub/docs/labels">
  1148. // Creating and
  1149. // managing labels</a>.
  1150. Labels map[string]string `json:"labels,omitempty"`
  1151. // Name: The name of the snapshot.
  1152. Name string `json:"name,omitempty"`
  1153. // Topic: The name of the topic from which this snapshot is retaining
  1154. // messages.
  1155. Topic string `json:"topic,omitempty"`
  1156. // ServerResponse contains the HTTP response code and headers from the
  1157. // server.
  1158. googleapi.ServerResponse `json:"-"`
  1159. // ForceSendFields is a list of field names (e.g. "ExpireTime") to
  1160. // unconditionally include in API requests. By default, fields with
  1161. // empty values are omitted from API requests. However, any non-pointer,
  1162. // non-interface field appearing in ForceSendFields will be sent to the
  1163. // server regardless of whether the field is empty or not. This may be
  1164. // used to include empty fields in Patch requests.
  1165. ForceSendFields []string `json:"-"`
  1166. // NullFields is a list of field names (e.g. "ExpireTime") to include in
  1167. // API requests with the JSON null value. By default, fields with empty
  1168. // values are omitted from API requests. However, any field with an
  1169. // empty value appearing in NullFields will be sent to the server as
  1170. // null. It is an error if a field in this list has a non-empty value.
  1171. // This may be used to include null fields in Patch requests.
  1172. NullFields []string `json:"-"`
  1173. }
  1174. func (s *Snapshot) MarshalJSON() ([]byte, error) {
  1175. type NoMethod Snapshot
  1176. raw := NoMethod(*s)
  1177. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1178. }
  1179. // Subscription: A subscription resource.
  1180. type Subscription struct {
  1181. // AckDeadlineSeconds: The approximate amount of time (on a best-effort
  1182. // basis) Pub/Sub waits for
  1183. // the subscriber to acknowledge receipt before resending the message.
  1184. // In the
  1185. // interval after the message is delivered and before it is
  1186. // acknowledged, it
  1187. // is considered to be <i>outstanding</i>. During that time period,
  1188. // the
  1189. // message will not be redelivered (on a best-effort basis).
  1190. //
  1191. // For pull subscriptions, this value is used as the initial value for
  1192. // the ack
  1193. // deadline. To override this value for a given message,
  1194. // call
  1195. // `ModifyAckDeadline` with the corresponding `ack_id` if
  1196. // using
  1197. // non-streaming pull or send the `ack_id` in
  1198. // a
  1199. // `StreamingModifyAckDeadlineRequest` if using streaming pull.
  1200. // The minimum custom deadline you can specify is 10 seconds.
  1201. // The maximum custom deadline you can specify is 600 seconds (10
  1202. // minutes).
  1203. // If this parameter is 0, a default value of 10 seconds is used.
  1204. //
  1205. // For push delivery, this value is also used to set the request timeout
  1206. // for
  1207. // the call to the push endpoint.
  1208. //
  1209. // If the subscriber never acknowledges the message, the Pub/Sub
  1210. // system will eventually redeliver the message.
  1211. AckDeadlineSeconds int64 `json:"ackDeadlineSeconds,omitempty"`
  1212. // ExpirationPolicy: A policy that specifies the conditions for this
  1213. // subscription's expiration.
  1214. // A subscription is considered active as long as any connected
  1215. // subscriber is
  1216. // successfully consuming messages from the subscription or is
  1217. // issuing
  1218. // operations on the subscription. If `expiration_policy` is not set,
  1219. // a
  1220. // *default policy* with `ttl` of 31 days will be used. The minimum
  1221. // allowed
  1222. // value for `expiration_policy.ttl` is 1 day.
  1223. // <b>BETA:</b> This feature is part of a beta release. This API might
  1224. // be
  1225. // changed in backward-incompatible ways and is not recommended for
  1226. // production
  1227. // use. It is not subject to any SLA or deprecation policy.
  1228. ExpirationPolicy *ExpirationPolicy `json:"expirationPolicy,omitempty"`
  1229. // Labels: See <a href="https://cloud.google.com/pubsub/docs/labels">
  1230. // Creating and
  1231. // managing labels</a>.
  1232. Labels map[string]string `json:"labels,omitempty"`
  1233. // MessageRetentionDuration: How long to retain unacknowledged messages
  1234. // in the subscription's backlog,
  1235. // from the moment a message is published.
  1236. // If `retain_acked_messages` is true, then this also configures the
  1237. // retention
  1238. // of acknowledged messages, and thus configures how far back in time a
  1239. // `Seek`
  1240. // can be done. Defaults to 7 days. Cannot be more than 7 days or less
  1241. // than 10
  1242. // minutes.<br><br>
  1243. // <b>BETA:</b> This feature is part of a beta release. This API might
  1244. // be
  1245. // changed in backward-incompatible ways and is not recommended for
  1246. // production
  1247. // use. It is not subject to any SLA or deprecation policy.
  1248. MessageRetentionDuration string `json:"messageRetentionDuration,omitempty"`
  1249. // Name: The name of the subscription. It must have the
  1250. // format
  1251. // "projects/{project}/subscriptions/{subscription}". `{subscription}`
  1252. // must
  1253. // start with a letter, and contain only letters (`[A-Za-z]`),
  1254. // numbers
  1255. // (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes
  1256. // (`~`),
  1257. // plus (`+`) or percent signs (`%`). It must be between 3 and 255
  1258. // characters
  1259. // in length, and it must not start with "goog".
  1260. Name string `json:"name,omitempty"`
  1261. // PushConfig: If push delivery is used with this subscription, this
  1262. // field is
  1263. // used to configure it. An empty `pushConfig` signifies that the
  1264. // subscriber
  1265. // will pull and ack messages using API methods.
  1266. PushConfig *PushConfig `json:"pushConfig,omitempty"`
  1267. // RetainAckedMessages: Indicates whether to retain acknowledged
  1268. // messages. If true, then
  1269. // messages are not expunged from the subscription's backlog, even if
  1270. // they are
  1271. // acknowledged, until they fall out of the
  1272. // `message_retention_duration`
  1273. // window. This must be true if you would like to
  1274. // <a
  1275. // href="https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_t
  1276. // ime">
  1277. // Seek to a timestamp</a>.
  1278. // <br><br>
  1279. // <b>BETA:</b> This feature is part of a beta release. This API might
  1280. // be
  1281. // changed in backward-incompatible ways and is not recommended for
  1282. // production
  1283. // use. It is not subject to any SLA or deprecation policy.
  1284. RetainAckedMessages bool `json:"retainAckedMessages,omitempty"`
  1285. // Topic: The name of the topic from which this subscription is
  1286. // receiving messages.
  1287. // Format is `projects/{project}/topics/{topic}`.
  1288. // The value of this field will be `_deleted-topic_` if the topic has
  1289. // been
  1290. // deleted.
  1291. Topic string `json:"topic,omitempty"`
  1292. // ServerResponse contains the HTTP response code and headers from the
  1293. // server.
  1294. googleapi.ServerResponse `json:"-"`
  1295. // ForceSendFields is a list of field names (e.g. "AckDeadlineSeconds")
  1296. // to unconditionally include in API requests. By default, fields with
  1297. // empty values are omitted from API requests. However, any non-pointer,
  1298. // non-interface field appearing in ForceSendFields will be sent to the
  1299. // server regardless of whether the field is empty or not. This may be
  1300. // used to include empty fields in Patch requests.
  1301. ForceSendFields []string `json:"-"`
  1302. // NullFields is a list of field names (e.g. "AckDeadlineSeconds") to
  1303. // include in API requests with the JSON null value. By default, fields
  1304. // with empty values are omitted from API requests. However, any field
  1305. // with an empty value appearing in NullFields will be sent to the
  1306. // server as null. It is an error if a field in this list has a
  1307. // non-empty value. This may be used to include null fields in Patch
  1308. // requests.
  1309. NullFields []string `json:"-"`
  1310. }
  1311. func (s *Subscription) MarshalJSON() ([]byte, error) {
  1312. type NoMethod Subscription
  1313. raw := NoMethod(*s)
  1314. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1315. }
  1316. // TestIamPermissionsRequest: Request message for `TestIamPermissions`
  1317. // method.
  1318. type TestIamPermissionsRequest struct {
  1319. // Permissions: The set of permissions to check for the `resource`.
  1320. // Permissions with
  1321. // wildcards (such as '*' or 'storage.*') are not allowed. For
  1322. // more
  1323. // information see
  1324. // [IAM
  1325. // Overview](https://cloud.google.com/iam/docs/overview#permissions).
  1326. Permissions []string `json:"permissions,omitempty"`
  1327. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1328. // unconditionally include in API requests. By default, fields with
  1329. // empty values are omitted from API requests. However, any non-pointer,
  1330. // non-interface field appearing in ForceSendFields will be sent to the
  1331. // server regardless of whether the field is empty or not. This may be
  1332. // used to include empty fields in Patch requests.
  1333. ForceSendFields []string `json:"-"`
  1334. // NullFields is a list of field names (e.g. "Permissions") to include
  1335. // in API requests with the JSON null value. By default, fields with
  1336. // empty values are omitted from API requests. However, any field with
  1337. // an empty value appearing in NullFields will be sent to the server as
  1338. // null. It is an error if a field in this list has a non-empty value.
  1339. // This may be used to include null fields in Patch requests.
  1340. NullFields []string `json:"-"`
  1341. }
  1342. func (s *TestIamPermissionsRequest) MarshalJSON() ([]byte, error) {
  1343. type NoMethod TestIamPermissionsRequest
  1344. raw := NoMethod(*s)
  1345. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1346. }
  1347. // TestIamPermissionsResponse: Response message for `TestIamPermissions`
  1348. // method.
  1349. type TestIamPermissionsResponse struct {
  1350. // Permissions: A subset of `TestPermissionsRequest.permissions` that
  1351. // the caller is
  1352. // allowed.
  1353. Permissions []string `json:"permissions,omitempty"`
  1354. // ServerResponse contains the HTTP response code and headers from the
  1355. // server.
  1356. googleapi.ServerResponse `json:"-"`
  1357. // ForceSendFields is a list of field names (e.g. "Permissions") to
  1358. // unconditionally include in API requests. By default, fields with
  1359. // empty values are omitted from API requests. However, any non-pointer,
  1360. // non-interface field appearing in ForceSendFields will be sent to the
  1361. // server regardless of whether the field is empty or not. This may be
  1362. // used to include empty fields in Patch requests.
  1363. ForceSendFields []string `json:"-"`
  1364. // NullFields is a list of field names (e.g. "Permissions") to include
  1365. // in API requests with the JSON null value. By default, fields with
  1366. // empty values are omitted from API requests. However, any field with
  1367. // an empty value appearing in NullFields will be sent to the server as
  1368. // null. It is an error if a field in this list has a non-empty value.
  1369. // This may be used to include null fields in Patch requests.
  1370. NullFields []string `json:"-"`
  1371. }
  1372. func (s *TestIamPermissionsResponse) MarshalJSON() ([]byte, error) {
  1373. type NoMethod TestIamPermissionsResponse
  1374. raw := NoMethod(*s)
  1375. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1376. }
  1377. // Topic: A topic resource.
  1378. type Topic struct {
  1379. // Labels: See <a href="https://cloud.google.com/pubsub/docs/labels">
  1380. // Creating and
  1381. // managing labels</a>.
  1382. Labels map[string]string `json:"labels,omitempty"`
  1383. // Name: The name of the topic. It must have the
  1384. // format
  1385. // "projects/{project}/topics/{topic}". `{topic}` must start with a
  1386. // letter,
  1387. // and contain only letters (`[A-Za-z]`), numbers (`[0-9]`), dashes
  1388. // (`-`),
  1389. // underscores (`_`), periods (`.`), tildes (`~`), plus (`+`) or
  1390. // percent
  1391. // signs (`%`). It must be between 3 and 255 characters in length, and
  1392. // it
  1393. // must not start with "goog".
  1394. Name string `json:"name,omitempty"`
  1395. // ServerResponse contains the HTTP response code and headers from the
  1396. // server.
  1397. googleapi.ServerResponse `json:"-"`
  1398. // ForceSendFields is a list of field names (e.g. "Labels") to
  1399. // unconditionally include in API requests. By default, fields with
  1400. // empty values are omitted from API requests. However, any non-pointer,
  1401. // non-interface field appearing in ForceSendFields will be sent to the
  1402. // server regardless of whether the field is empty or not. This may be
  1403. // used to include empty fields in Patch requests.
  1404. ForceSendFields []string `json:"-"`
  1405. // NullFields is a list of field names (e.g. "Labels") to include in API
  1406. // requests with the JSON null value. By default, fields with empty
  1407. // values are omitted from API requests. However, any field with an
  1408. // empty value appearing in NullFields will be sent to the server as
  1409. // null. It is an error if a field in this list has a non-empty value.
  1410. // This may be used to include null fields in Patch requests.
  1411. NullFields []string `json:"-"`
  1412. }
  1413. func (s *Topic) MarshalJSON() ([]byte, error) {
  1414. type NoMethod Topic
  1415. raw := NoMethod(*s)
  1416. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1417. }
  1418. // UpdateSnapshotRequest: Request for the UpdateSnapshot
  1419. // method.<br><br>
  1420. // <b>BETA:</b> This feature is part of a beta release. This API might
  1421. // be
  1422. // changed in backward-incompatible ways and is not recommended for
  1423. // production
  1424. // use. It is not subject to any SLA or deprecation policy.
  1425. type UpdateSnapshotRequest struct {
  1426. // Snapshot: The updated snapshot object.
  1427. Snapshot *Snapshot `json:"snapshot,omitempty"`
  1428. // UpdateMask: Indicates which fields in the provided snapshot to
  1429. // update.
  1430. // Must be specified and non-empty.
  1431. UpdateMask string `json:"updateMask,omitempty"`
  1432. // ForceSendFields is a list of field names (e.g. "Snapshot") to
  1433. // unconditionally include in API requests. By default, fields with
  1434. // empty values are omitted from API requests. However, any non-pointer,
  1435. // non-interface field appearing in ForceSendFields will be sent to the
  1436. // server regardless of whether the field is empty or not. This may be
  1437. // used to include empty fields in Patch requests.
  1438. ForceSendFields []string `json:"-"`
  1439. // NullFields is a list of field names (e.g. "Snapshot") to include in
  1440. // API requests with the JSON null value. By default, fields with empty
  1441. // values are omitted from API requests. However, any field with an
  1442. // empty value appearing in NullFields will be sent to the server as
  1443. // null. It is an error if a field in this list has a non-empty value.
  1444. // This may be used to include null fields in Patch requests.
  1445. NullFields []string `json:"-"`
  1446. }
  1447. func (s *UpdateSnapshotRequest) MarshalJSON() ([]byte, error) {
  1448. type NoMethod UpdateSnapshotRequest
  1449. raw := NoMethod(*s)
  1450. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1451. }
  1452. // UpdateSubscriptionRequest: Request for the UpdateSubscription method.
  1453. type UpdateSubscriptionRequest struct {
  1454. // Subscription: The updated subscription object.
  1455. Subscription *Subscription `json:"subscription,omitempty"`
  1456. // UpdateMask: Indicates which fields in the provided subscription to
  1457. // update.
  1458. // Must be specified and non-empty.
  1459. UpdateMask string `json:"updateMask,omitempty"`
  1460. // ForceSendFields is a list of field names (e.g. "Subscription") to
  1461. // unconditionally include in API requests. By default, fields with
  1462. // empty values are omitted from API requests. However, any non-pointer,
  1463. // non-interface field appearing in ForceSendFields will be sent to the
  1464. // server regardless of whether the field is empty or not. This may be
  1465. // used to include empty fields in Patch requests.
  1466. ForceSendFields []string `json:"-"`
  1467. // NullFields is a list of field names (e.g. "Subscription") to include
  1468. // in API requests with the JSON null value. By default, fields with
  1469. // empty values are omitted from API requests. However, any field with
  1470. // an empty value appearing in NullFields will be sent to the server as
  1471. // null. It is an error if a field in this list has a non-empty value.
  1472. // This may be used to include null fields in Patch requests.
  1473. NullFields []string `json:"-"`
  1474. }
  1475. func (s *UpdateSubscriptionRequest) MarshalJSON() ([]byte, error) {
  1476. type NoMethod UpdateSubscriptionRequest
  1477. raw := NoMethod(*s)
  1478. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1479. }
  1480. // UpdateTopicRequest: Request for the UpdateTopic method.
  1481. type UpdateTopicRequest struct {
  1482. // Topic: The updated topic object.
  1483. Topic *Topic `json:"topic,omitempty"`
  1484. // UpdateMask: Indicates which fields in the provided topic to update.
  1485. // Must be specified
  1486. // and non-empty. Note that if `update_mask`
  1487. // contains
  1488. // "message_storage_policy" then the new value will be determined based
  1489. // on the
  1490. // policy configured at the project or organization level.
  1491. // The
  1492. // `message_storage_policy` must not be set in the `topic` provided
  1493. // above.
  1494. UpdateMask string `json:"updateMask,omitempty"`
  1495. // ForceSendFields is a list of field names (e.g. "Topic") to
  1496. // unconditionally include in API requests. By default, fields with
  1497. // empty values are omitted from API requests. However, any non-pointer,
  1498. // non-interface field appearing in ForceSendFields will be sent to the
  1499. // server regardless of whether the field is empty or not. This may be
  1500. // used to include empty fields in Patch requests.
  1501. ForceSendFields []string `json:"-"`
  1502. // NullFields is a list of field names (e.g. "Topic") to include in API
  1503. // requests with the JSON null value. By default, fields with empty
  1504. // values are omitted from API requests. However, any field with an
  1505. // empty value appearing in NullFields will be sent to the server as
  1506. // null. It is an error if a field in this list has a non-empty value.
  1507. // This may be used to include null fields in Patch requests.
  1508. NullFields []string `json:"-"`
  1509. }
  1510. func (s *UpdateTopicRequest) MarshalJSON() ([]byte, error) {
  1511. type NoMethod UpdateTopicRequest
  1512. raw := NoMethod(*s)
  1513. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1514. }
  1515. // method id "pubsub.projects.snapshots.create":
  1516. type ProjectsSnapshotsCreateCall struct {
  1517. s *Service
  1518. name string
  1519. createsnapshotrequest *CreateSnapshotRequest
  1520. urlParams_ gensupport.URLParams
  1521. ctx_ context.Context
  1522. header_ http.Header
  1523. }
  1524. // Create: Creates a snapshot from the requested subscription. Snapshots
  1525. // are used in
  1526. // <a
  1527. // href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
  1528. // o
  1529. // perations, which allow
  1530. // you to manage message acknowledgments in bulk. That is, you can set
  1531. // the
  1532. // acknowledgment state of messages in an existing subscription to the
  1533. // state
  1534. // captured by a snapshot.
  1535. // <br><br>
  1536. // <b>BETA:</b> This feature is part of a beta release. This API might
  1537. // be
  1538. // changed in backward-incompatible ways and is not recommended for
  1539. // production
  1540. // use. It is not subject to any SLA or deprecation policy.<br><br>
  1541. // If the snapshot already exists, returns `ALREADY_EXISTS`.
  1542. // If the requested subscription doesn't exist, returns `NOT_FOUND`.
  1543. // If the backlog in the subscription is too old -- and the resulting
  1544. // snapshot
  1545. // would expire in less than 1 hour -- then `FAILED_PRECONDITION` is
  1546. // returned.
  1547. // See also the `Snapshot.expire_time` field. If the name is not
  1548. // provided in
  1549. // the request, the server will assign a random
  1550. // name for this snapshot on the same project as the subscription,
  1551. // conforming
  1552. // to the
  1553. // [resource name
  1554. // format](https://cloud.google.com/pubsub/docs/admin#resource_names).
  1555. // Th
  1556. // e generated name is populated in the returned Snapshot object. Note
  1557. // that
  1558. // for REST API requests, you must specify a name in the request.
  1559. func (r *ProjectsSnapshotsService) Create(name string, createsnapshotrequest *CreateSnapshotRequest) *ProjectsSnapshotsCreateCall {
  1560. c := &ProjectsSnapshotsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1561. c.name = name
  1562. c.createsnapshotrequest = createsnapshotrequest
  1563. return c
  1564. }
  1565. // Fields allows partial responses to be retrieved. See
  1566. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1567. // for more information.
  1568. func (c *ProjectsSnapshotsCreateCall) Fields(s ...googleapi.Field) *ProjectsSnapshotsCreateCall {
  1569. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1570. return c
  1571. }
  1572. // Context sets the context to be used in this call's Do method. Any
  1573. // pending HTTP request will be aborted if the provided context is
  1574. // canceled.
  1575. func (c *ProjectsSnapshotsCreateCall) Context(ctx context.Context) *ProjectsSnapshotsCreateCall {
  1576. c.ctx_ = ctx
  1577. return c
  1578. }
  1579. // Header returns an http.Header that can be modified by the caller to
  1580. // add HTTP headers to the request.
  1581. func (c *ProjectsSnapshotsCreateCall) Header() http.Header {
  1582. if c.header_ == nil {
  1583. c.header_ = make(http.Header)
  1584. }
  1585. return c.header_
  1586. }
  1587. func (c *ProjectsSnapshotsCreateCall) doRequest(alt string) (*http.Response, error) {
  1588. reqHeaders := make(http.Header)
  1589. for k, v := range c.header_ {
  1590. reqHeaders[k] = v
  1591. }
  1592. reqHeaders.Set("User-Agent", c.s.userAgent())
  1593. var body io.Reader = nil
  1594. body, err := googleapi.WithoutDataWrapper.JSONReader(c.createsnapshotrequest)
  1595. if err != nil {
  1596. return nil, err
  1597. }
  1598. reqHeaders.Set("Content-Type", "application/json")
  1599. c.urlParams_.Set("alt", alt)
  1600. c.urlParams_.Set("prettyPrint", "false")
  1601. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  1602. urls += "?" + c.urlParams_.Encode()
  1603. req, err := http.NewRequest("PUT", urls, body)
  1604. if err != nil {
  1605. return nil, err
  1606. }
  1607. req.Header = reqHeaders
  1608. googleapi.Expand(req.URL, map[string]string{
  1609. "name": c.name,
  1610. })
  1611. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1612. }
  1613. // Do executes the "pubsub.projects.snapshots.create" call.
  1614. // Exactly one of *Snapshot or error will be non-nil. Any non-2xx status
  1615. // code is an error. Response headers are in either
  1616. // *Snapshot.ServerResponse.Header or (if a response was returned at
  1617. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1618. // to check whether the returned error was because
  1619. // http.StatusNotModified was returned.
  1620. func (c *ProjectsSnapshotsCreateCall) Do(opts ...googleapi.CallOption) (*Snapshot, error) {
  1621. gensupport.SetOptions(c.urlParams_, opts...)
  1622. res, err := c.doRequest("json")
  1623. if res != nil && res.StatusCode == http.StatusNotModified {
  1624. if res.Body != nil {
  1625. res.Body.Close()
  1626. }
  1627. return nil, &googleapi.Error{
  1628. Code: res.StatusCode,
  1629. Header: res.Header,
  1630. }
  1631. }
  1632. if err != nil {
  1633. return nil, err
  1634. }
  1635. defer googleapi.CloseBody(res)
  1636. if err := googleapi.CheckResponse(res); err != nil {
  1637. return nil, err
  1638. }
  1639. ret := &Snapshot{
  1640. ServerResponse: googleapi.ServerResponse{
  1641. Header: res.Header,
  1642. HTTPStatusCode: res.StatusCode,
  1643. },
  1644. }
  1645. target := &ret
  1646. if err := gensupport.DecodeResponse(target, res); err != nil {
  1647. return nil, err
  1648. }
  1649. return ret, nil
  1650. // {
  1651. // "description": "Creates a snapshot from the requested subscription. Snapshots are used in\n\u003ca href=\"https://cloud.google.com/pubsub/docs/replay-overview\"\u003eSeek\u003c/a\u003e\noperations, which allow\nyou to manage message acknowledgments in bulk. That is, you can set the\nacknowledgment state of messages in an existing subscription to the state\ncaptured by a snapshot.\n\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eBETA:\u003c/b\u003e This feature is part of a beta release. This API might be\nchanged in backward-incompatible ways and is not recommended for production\nuse. It is not subject to any SLA or deprecation policy.\u003cbr\u003e\u003cbr\u003e\nIf the snapshot already exists, returns `ALREADY_EXISTS`.\nIf the requested subscription doesn't exist, returns `NOT_FOUND`.\nIf the backlog in the subscription is too old -- and the resulting snapshot\nwould expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.\nSee also the `Snapshot.expire_time` field. If the name is not provided in\nthe request, the server will assign a random\nname for this snapshot on the same project as the subscription, conforming\nto the\n[resource name format](https://cloud.google.com/pubsub/docs/admin#resource_names).\nThe generated name is populated in the returned Snapshot object. Note that\nfor REST API requests, you must specify a name in the request.",
  1652. // "flatPath": "v1/projects/{projectsId}/snapshots/{snapshotsId}",
  1653. // "httpMethod": "PUT",
  1654. // "id": "pubsub.projects.snapshots.create",
  1655. // "parameterOrder": [
  1656. // "name"
  1657. // ],
  1658. // "parameters": {
  1659. // "name": {
  1660. // "description": "Optional user-provided name for this snapshot.\nIf the name is not provided in the request, the server will assign a random\nname for this snapshot on the same project as the subscription.\nNote that for REST API requests, you must specify a name. See the\n\u003ca href=\"https://cloud.google.com/pubsub/docs/admin#resource_names\"\u003e\nresource name rules\u003c/a\u003e.\nFormat is `projects/{project}/snapshots/{snap}`.",
  1661. // "location": "path",
  1662. // "pattern": "^projects/[^/]+/snapshots/[^/]+$",
  1663. // "required": true,
  1664. // "type": "string"
  1665. // }
  1666. // },
  1667. // "path": "v1/{+name}",
  1668. // "request": {
  1669. // "$ref": "CreateSnapshotRequest"
  1670. // },
  1671. // "response": {
  1672. // "$ref": "Snapshot"
  1673. // },
  1674. // "scopes": [
  1675. // "https://www.googleapis.com/auth/cloud-platform",
  1676. // "https://www.googleapis.com/auth/pubsub"
  1677. // ]
  1678. // }
  1679. }
  1680. // method id "pubsub.projects.snapshots.delete":
  1681. type ProjectsSnapshotsDeleteCall struct {
  1682. s *Service
  1683. snapshot string
  1684. urlParams_ gensupport.URLParams
  1685. ctx_ context.Context
  1686. header_ http.Header
  1687. }
  1688. // Delete: Removes an existing snapshot. Snapshots are used in
  1689. // <a
  1690. // href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
  1691. // o
  1692. // perations, which allow
  1693. // you to manage message acknowledgments in bulk. That is, you can set
  1694. // the
  1695. // acknowledgment state of messages in an existing subscription to the
  1696. // state
  1697. // captured by a snapshot.<br><br>
  1698. // <b>BETA:</b> This feature is part of a beta release. This API might
  1699. // be
  1700. // changed in backward-incompatible ways and is not recommended for
  1701. // production
  1702. // use. It is not subject to any SLA or deprecation policy.
  1703. // When the snapshot is deleted, all messages retained in the
  1704. // snapshot
  1705. // are immediately dropped. After a snapshot is deleted, a new one may
  1706. // be
  1707. // created with the same name, but the new one has no association with
  1708. // the old
  1709. // snapshot or its subscription, unless the same subscription is
  1710. // specified.
  1711. func (r *ProjectsSnapshotsService) Delete(snapshot string) *ProjectsSnapshotsDeleteCall {
  1712. c := &ProjectsSnapshotsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1713. c.snapshot = snapshot
  1714. return c
  1715. }
  1716. // Fields allows partial responses to be retrieved. See
  1717. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1718. // for more information.
  1719. func (c *ProjectsSnapshotsDeleteCall) Fields(s ...googleapi.Field) *ProjectsSnapshotsDeleteCall {
  1720. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1721. return c
  1722. }
  1723. // Context sets the context to be used in this call's Do method. Any
  1724. // pending HTTP request will be aborted if the provided context is
  1725. // canceled.
  1726. func (c *ProjectsSnapshotsDeleteCall) Context(ctx context.Context) *ProjectsSnapshotsDeleteCall {
  1727. c.ctx_ = ctx
  1728. return c
  1729. }
  1730. // Header returns an http.Header that can be modified by the caller to
  1731. // add HTTP headers to the request.
  1732. func (c *ProjectsSnapshotsDeleteCall) Header() http.Header {
  1733. if c.header_ == nil {
  1734. c.header_ = make(http.Header)
  1735. }
  1736. return c.header_
  1737. }
  1738. func (c *ProjectsSnapshotsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1739. reqHeaders := make(http.Header)
  1740. for k, v := range c.header_ {
  1741. reqHeaders[k] = v
  1742. }
  1743. reqHeaders.Set("User-Agent", c.s.userAgent())
  1744. var body io.Reader = nil
  1745. c.urlParams_.Set("alt", alt)
  1746. c.urlParams_.Set("prettyPrint", "false")
  1747. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+snapshot}")
  1748. urls += "?" + c.urlParams_.Encode()
  1749. req, err := http.NewRequest("DELETE", urls, body)
  1750. if err != nil {
  1751. return nil, err
  1752. }
  1753. req.Header = reqHeaders
  1754. googleapi.Expand(req.URL, map[string]string{
  1755. "snapshot": c.snapshot,
  1756. })
  1757. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1758. }
  1759. // Do executes the "pubsub.projects.snapshots.delete" call.
  1760. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1761. // code is an error. Response headers are in either
  1762. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1763. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1764. // check whether the returned error was because http.StatusNotModified
  1765. // was returned.
  1766. func (c *ProjectsSnapshotsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1767. gensupport.SetOptions(c.urlParams_, opts...)
  1768. res, err := c.doRequest("json")
  1769. if res != nil && res.StatusCode == http.StatusNotModified {
  1770. if res.Body != nil {
  1771. res.Body.Close()
  1772. }
  1773. return nil, &googleapi.Error{
  1774. Code: res.StatusCode,
  1775. Header: res.Header,
  1776. }
  1777. }
  1778. if err != nil {
  1779. return nil, err
  1780. }
  1781. defer googleapi.CloseBody(res)
  1782. if err := googleapi.CheckResponse(res); err != nil {
  1783. return nil, err
  1784. }
  1785. ret := &Empty{
  1786. ServerResponse: googleapi.ServerResponse{
  1787. Header: res.Header,
  1788. HTTPStatusCode: res.StatusCode,
  1789. },
  1790. }
  1791. target := &ret
  1792. if err := gensupport.DecodeResponse(target, res); err != nil {
  1793. return nil, err
  1794. }
  1795. return ret, nil
  1796. // {
  1797. // "description": "Removes an existing snapshot. Snapshots are used in\n\u003ca href=\"https://cloud.google.com/pubsub/docs/replay-overview\"\u003eSeek\u003c/a\u003e\noperations, which allow\nyou to manage message acknowledgments in bulk. That is, you can set the\nacknowledgment state of messages in an existing subscription to the state\ncaptured by a snapshot.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eBETA:\u003c/b\u003e This feature is part of a beta release. This API might be\nchanged in backward-incompatible ways and is not recommended for production\nuse. It is not subject to any SLA or deprecation policy.\nWhen the snapshot is deleted, all messages retained in the snapshot\nare immediately dropped. After a snapshot is deleted, a new one may be\ncreated with the same name, but the new one has no association with the old\nsnapshot or its subscription, unless the same subscription is specified.",
  1798. // "flatPath": "v1/projects/{projectsId}/snapshots/{snapshotsId}",
  1799. // "httpMethod": "DELETE",
  1800. // "id": "pubsub.projects.snapshots.delete",
  1801. // "parameterOrder": [
  1802. // "snapshot"
  1803. // ],
  1804. // "parameters": {
  1805. // "snapshot": {
  1806. // "description": "The name of the snapshot to delete.\nFormat is `projects/{project}/snapshots/{snap}`.",
  1807. // "location": "path",
  1808. // "pattern": "^projects/[^/]+/snapshots/[^/]+$",
  1809. // "required": true,
  1810. // "type": "string"
  1811. // }
  1812. // },
  1813. // "path": "v1/{+snapshot}",
  1814. // "response": {
  1815. // "$ref": "Empty"
  1816. // },
  1817. // "scopes": [
  1818. // "https://www.googleapis.com/auth/cloud-platform",
  1819. // "https://www.googleapis.com/auth/pubsub"
  1820. // ]
  1821. // }
  1822. }
  1823. // method id "pubsub.projects.snapshots.get":
  1824. type ProjectsSnapshotsGetCall struct {
  1825. s *Service
  1826. snapshot string
  1827. urlParams_ gensupport.URLParams
  1828. ifNoneMatch_ string
  1829. ctx_ context.Context
  1830. header_ http.Header
  1831. }
  1832. // Get: Gets the configuration details of a snapshot. Snapshots are used
  1833. // in
  1834. // <a
  1835. // href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
  1836. // o
  1837. // perations, which allow you to manage message acknowledgments in bulk.
  1838. // That
  1839. // is, you can set the acknowledgment state of messages in an
  1840. // existing
  1841. // subscription to the state captured by a
  1842. // snapshot.<br><br>
  1843. // <b>BETA:</b> This feature is part of a beta release. This API might
  1844. // be
  1845. // changed in backward-incompatible ways and is not recommended for
  1846. // production
  1847. // use. It is not subject to any SLA or deprecation policy.
  1848. func (r *ProjectsSnapshotsService) Get(snapshot string) *ProjectsSnapshotsGetCall {
  1849. c := &ProjectsSnapshotsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1850. c.snapshot = snapshot
  1851. return c
  1852. }
  1853. // Fields allows partial responses to be retrieved. See
  1854. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1855. // for more information.
  1856. func (c *ProjectsSnapshotsGetCall) Fields(s ...googleapi.Field) *ProjectsSnapshotsGetCall {
  1857. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1858. return c
  1859. }
  1860. // IfNoneMatch sets the optional parameter which makes the operation
  1861. // fail if the object's ETag matches the given value. This is useful for
  1862. // getting updates only after the object has changed since the last
  1863. // request. Use googleapi.IsNotModified to check whether the response
  1864. // error from Do is the result of In-None-Match.
  1865. func (c *ProjectsSnapshotsGetCall) IfNoneMatch(entityTag string) *ProjectsSnapshotsGetCall {
  1866. c.ifNoneMatch_ = entityTag
  1867. return c
  1868. }
  1869. // Context sets the context to be used in this call's Do method. Any
  1870. // pending HTTP request will be aborted if the provided context is
  1871. // canceled.
  1872. func (c *ProjectsSnapshotsGetCall) Context(ctx context.Context) *ProjectsSnapshotsGetCall {
  1873. c.ctx_ = ctx
  1874. return c
  1875. }
  1876. // Header returns an http.Header that can be modified by the caller to
  1877. // add HTTP headers to the request.
  1878. func (c *ProjectsSnapshotsGetCall) Header() http.Header {
  1879. if c.header_ == nil {
  1880. c.header_ = make(http.Header)
  1881. }
  1882. return c.header_
  1883. }
  1884. func (c *ProjectsSnapshotsGetCall) doRequest(alt string) (*http.Response, error) {
  1885. reqHeaders := make(http.Header)
  1886. for k, v := range c.header_ {
  1887. reqHeaders[k] = v
  1888. }
  1889. reqHeaders.Set("User-Agent", c.s.userAgent())
  1890. if c.ifNoneMatch_ != "" {
  1891. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1892. }
  1893. var body io.Reader = nil
  1894. c.urlParams_.Set("alt", alt)
  1895. c.urlParams_.Set("prettyPrint", "false")
  1896. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+snapshot}")
  1897. urls += "?" + c.urlParams_.Encode()
  1898. req, err := http.NewRequest("GET", urls, body)
  1899. if err != nil {
  1900. return nil, err
  1901. }
  1902. req.Header = reqHeaders
  1903. googleapi.Expand(req.URL, map[string]string{
  1904. "snapshot": c.snapshot,
  1905. })
  1906. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1907. }
  1908. // Do executes the "pubsub.projects.snapshots.get" call.
  1909. // Exactly one of *Snapshot or error will be non-nil. Any non-2xx status
  1910. // code is an error. Response headers are in either
  1911. // *Snapshot.ServerResponse.Header or (if a response was returned at
  1912. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1913. // to check whether the returned error was because
  1914. // http.StatusNotModified was returned.
  1915. func (c *ProjectsSnapshotsGetCall) Do(opts ...googleapi.CallOption) (*Snapshot, error) {
  1916. gensupport.SetOptions(c.urlParams_, opts...)
  1917. res, err := c.doRequest("json")
  1918. if res != nil && res.StatusCode == http.StatusNotModified {
  1919. if res.Body != nil {
  1920. res.Body.Close()
  1921. }
  1922. return nil, &googleapi.Error{
  1923. Code: res.StatusCode,
  1924. Header: res.Header,
  1925. }
  1926. }
  1927. if err != nil {
  1928. return nil, err
  1929. }
  1930. defer googleapi.CloseBody(res)
  1931. if err := googleapi.CheckResponse(res); err != nil {
  1932. return nil, err
  1933. }
  1934. ret := &Snapshot{
  1935. ServerResponse: googleapi.ServerResponse{
  1936. Header: res.Header,
  1937. HTTPStatusCode: res.StatusCode,
  1938. },
  1939. }
  1940. target := &ret
  1941. if err := gensupport.DecodeResponse(target, res); err != nil {
  1942. return nil, err
  1943. }
  1944. return ret, nil
  1945. // {
  1946. // "description": "Gets the configuration details of a snapshot. Snapshots are used in\n\u003ca href=\"https://cloud.google.com/pubsub/docs/replay-overview\"\u003eSeek\u003c/a\u003e\noperations, which allow you to manage message acknowledgments in bulk. That\nis, you can set the acknowledgment state of messages in an existing\nsubscription to the state captured by a snapshot.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eBETA:\u003c/b\u003e This feature is part of a beta release. This API might be\nchanged in backward-incompatible ways and is not recommended for production\nuse. It is not subject to any SLA or deprecation policy.",
  1947. // "flatPath": "v1/projects/{projectsId}/snapshots/{snapshotsId}",
  1948. // "httpMethod": "GET",
  1949. // "id": "pubsub.projects.snapshots.get",
  1950. // "parameterOrder": [
  1951. // "snapshot"
  1952. // ],
  1953. // "parameters": {
  1954. // "snapshot": {
  1955. // "description": "The name of the snapshot to get.\nFormat is `projects/{project}/snapshots/{snap}`.",
  1956. // "location": "path",
  1957. // "pattern": "^projects/[^/]+/snapshots/[^/]+$",
  1958. // "required": true,
  1959. // "type": "string"
  1960. // }
  1961. // },
  1962. // "path": "v1/{+snapshot}",
  1963. // "response": {
  1964. // "$ref": "Snapshot"
  1965. // },
  1966. // "scopes": [
  1967. // "https://www.googleapis.com/auth/cloud-platform",
  1968. // "https://www.googleapis.com/auth/pubsub"
  1969. // ]
  1970. // }
  1971. }
  1972. // method id "pubsub.projects.snapshots.getIamPolicy":
  1973. type ProjectsSnapshotsGetIamPolicyCall struct {
  1974. s *Service
  1975. resource string
  1976. urlParams_ gensupport.URLParams
  1977. ifNoneMatch_ string
  1978. ctx_ context.Context
  1979. header_ http.Header
  1980. }
  1981. // GetIamPolicy: Gets the access control policy for a resource.
  1982. // Returns an empty policy if the resource exists and does not have a
  1983. // policy
  1984. // set.
  1985. func (r *ProjectsSnapshotsService) GetIamPolicy(resource string) *ProjectsSnapshotsGetIamPolicyCall {
  1986. c := &ProjectsSnapshotsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1987. c.resource = resource
  1988. return c
  1989. }
  1990. // Fields allows partial responses to be retrieved. See
  1991. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1992. // for more information.
  1993. func (c *ProjectsSnapshotsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSnapshotsGetIamPolicyCall {
  1994. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1995. return c
  1996. }
  1997. // IfNoneMatch sets the optional parameter which makes the operation
  1998. // fail if the object's ETag matches the given value. This is useful for
  1999. // getting updates only after the object has changed since the last
  2000. // request. Use googleapi.IsNotModified to check whether the response
  2001. // error from Do is the result of In-None-Match.
  2002. func (c *ProjectsSnapshotsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsSnapshotsGetIamPolicyCall {
  2003. c.ifNoneMatch_ = entityTag
  2004. return c
  2005. }
  2006. // Context sets the context to be used in this call's Do method. Any
  2007. // pending HTTP request will be aborted if the provided context is
  2008. // canceled.
  2009. func (c *ProjectsSnapshotsGetIamPolicyCall) Context(ctx context.Context) *ProjectsSnapshotsGetIamPolicyCall {
  2010. c.ctx_ = ctx
  2011. return c
  2012. }
  2013. // Header returns an http.Header that can be modified by the caller to
  2014. // add HTTP headers to the request.
  2015. func (c *ProjectsSnapshotsGetIamPolicyCall) Header() http.Header {
  2016. if c.header_ == nil {
  2017. c.header_ = make(http.Header)
  2018. }
  2019. return c.header_
  2020. }
  2021. func (c *ProjectsSnapshotsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2022. reqHeaders := make(http.Header)
  2023. for k, v := range c.header_ {
  2024. reqHeaders[k] = v
  2025. }
  2026. reqHeaders.Set("User-Agent", c.s.userAgent())
  2027. if c.ifNoneMatch_ != "" {
  2028. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2029. }
  2030. var body io.Reader = nil
  2031. c.urlParams_.Set("alt", alt)
  2032. c.urlParams_.Set("prettyPrint", "false")
  2033. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  2034. urls += "?" + c.urlParams_.Encode()
  2035. req, err := http.NewRequest("GET", urls, body)
  2036. if err != nil {
  2037. return nil, err
  2038. }
  2039. req.Header = reqHeaders
  2040. googleapi.Expand(req.URL, map[string]string{
  2041. "resource": c.resource,
  2042. })
  2043. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2044. }
  2045. // Do executes the "pubsub.projects.snapshots.getIamPolicy" call.
  2046. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2047. // code is an error. Response headers are in either
  2048. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2049. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2050. // check whether the returned error was because http.StatusNotModified
  2051. // was returned.
  2052. func (c *ProjectsSnapshotsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2053. gensupport.SetOptions(c.urlParams_, opts...)
  2054. res, err := c.doRequest("json")
  2055. if res != nil && res.StatusCode == http.StatusNotModified {
  2056. if res.Body != nil {
  2057. res.Body.Close()
  2058. }
  2059. return nil, &googleapi.Error{
  2060. Code: res.StatusCode,
  2061. Header: res.Header,
  2062. }
  2063. }
  2064. if err != nil {
  2065. return nil, err
  2066. }
  2067. defer googleapi.CloseBody(res)
  2068. if err := googleapi.CheckResponse(res); err != nil {
  2069. return nil, err
  2070. }
  2071. ret := &Policy{
  2072. ServerResponse: googleapi.ServerResponse{
  2073. Header: res.Header,
  2074. HTTPStatusCode: res.StatusCode,
  2075. },
  2076. }
  2077. target := &ret
  2078. if err := gensupport.DecodeResponse(target, res); err != nil {
  2079. return nil, err
  2080. }
  2081. return ret, nil
  2082. // {
  2083. // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
  2084. // "flatPath": "v1/projects/{projectsId}/snapshots/{snapshotsId}:getIamPolicy",
  2085. // "httpMethod": "GET",
  2086. // "id": "pubsub.projects.snapshots.getIamPolicy",
  2087. // "parameterOrder": [
  2088. // "resource"
  2089. // ],
  2090. // "parameters": {
  2091. // "resource": {
  2092. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2093. // "location": "path",
  2094. // "pattern": "^projects/[^/]+/snapshots/[^/]+$",
  2095. // "required": true,
  2096. // "type": "string"
  2097. // }
  2098. // },
  2099. // "path": "v1/{+resource}:getIamPolicy",
  2100. // "response": {
  2101. // "$ref": "Policy"
  2102. // },
  2103. // "scopes": [
  2104. // "https://www.googleapis.com/auth/cloud-platform",
  2105. // "https://www.googleapis.com/auth/pubsub"
  2106. // ]
  2107. // }
  2108. }
  2109. // method id "pubsub.projects.snapshots.list":
  2110. type ProjectsSnapshotsListCall struct {
  2111. s *Service
  2112. project string
  2113. urlParams_ gensupport.URLParams
  2114. ifNoneMatch_ string
  2115. ctx_ context.Context
  2116. header_ http.Header
  2117. }
  2118. // List: Lists the existing snapshots. Snapshots are used in
  2119. // <a
  2120. // href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
  2121. // o
  2122. // perations, which allow
  2123. // you to manage message acknowledgments in bulk. That is, you can set
  2124. // the
  2125. // acknowledgment state of messages in an existing subscription to the
  2126. // state
  2127. // captured by a snapshot.<br><br>
  2128. // <b>BETA:</b> This feature is part of a beta release. This API might
  2129. // be
  2130. // changed in backward-incompatible ways and is not recommended for
  2131. // production
  2132. // use. It is not subject to any SLA or deprecation policy.
  2133. func (r *ProjectsSnapshotsService) List(project string) *ProjectsSnapshotsListCall {
  2134. c := &ProjectsSnapshotsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2135. c.project = project
  2136. return c
  2137. }
  2138. // PageSize sets the optional parameter "pageSize": Maximum number of
  2139. // snapshots to return.
  2140. func (c *ProjectsSnapshotsListCall) PageSize(pageSize int64) *ProjectsSnapshotsListCall {
  2141. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2142. return c
  2143. }
  2144. // PageToken sets the optional parameter "pageToken": The value returned
  2145. // by the last `ListSnapshotsResponse`; indicates that this
  2146. // is a continuation of a prior `ListSnapshots` call, and that the
  2147. // system
  2148. // should return the next page of data.
  2149. func (c *ProjectsSnapshotsListCall) PageToken(pageToken string) *ProjectsSnapshotsListCall {
  2150. c.urlParams_.Set("pageToken", pageToken)
  2151. return c
  2152. }
  2153. // Fields allows partial responses to be retrieved. See
  2154. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2155. // for more information.
  2156. func (c *ProjectsSnapshotsListCall) Fields(s ...googleapi.Field) *ProjectsSnapshotsListCall {
  2157. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2158. return c
  2159. }
  2160. // IfNoneMatch sets the optional parameter which makes the operation
  2161. // fail if the object's ETag matches the given value. This is useful for
  2162. // getting updates only after the object has changed since the last
  2163. // request. Use googleapi.IsNotModified to check whether the response
  2164. // error from Do is the result of In-None-Match.
  2165. func (c *ProjectsSnapshotsListCall) IfNoneMatch(entityTag string) *ProjectsSnapshotsListCall {
  2166. c.ifNoneMatch_ = entityTag
  2167. return c
  2168. }
  2169. // Context sets the context to be used in this call's Do method. Any
  2170. // pending HTTP request will be aborted if the provided context is
  2171. // canceled.
  2172. func (c *ProjectsSnapshotsListCall) Context(ctx context.Context) *ProjectsSnapshotsListCall {
  2173. c.ctx_ = ctx
  2174. return c
  2175. }
  2176. // Header returns an http.Header that can be modified by the caller to
  2177. // add HTTP headers to the request.
  2178. func (c *ProjectsSnapshotsListCall) Header() http.Header {
  2179. if c.header_ == nil {
  2180. c.header_ = make(http.Header)
  2181. }
  2182. return c.header_
  2183. }
  2184. func (c *ProjectsSnapshotsListCall) doRequest(alt string) (*http.Response, error) {
  2185. reqHeaders := make(http.Header)
  2186. for k, v := range c.header_ {
  2187. reqHeaders[k] = v
  2188. }
  2189. reqHeaders.Set("User-Agent", c.s.userAgent())
  2190. if c.ifNoneMatch_ != "" {
  2191. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2192. }
  2193. var body io.Reader = nil
  2194. c.urlParams_.Set("alt", alt)
  2195. c.urlParams_.Set("prettyPrint", "false")
  2196. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+project}/snapshots")
  2197. urls += "?" + c.urlParams_.Encode()
  2198. req, err := http.NewRequest("GET", urls, body)
  2199. if err != nil {
  2200. return nil, err
  2201. }
  2202. req.Header = reqHeaders
  2203. googleapi.Expand(req.URL, map[string]string{
  2204. "project": c.project,
  2205. })
  2206. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2207. }
  2208. // Do executes the "pubsub.projects.snapshots.list" call.
  2209. // Exactly one of *ListSnapshotsResponse or error will be non-nil. Any
  2210. // non-2xx status code is an error. Response headers are in either
  2211. // *ListSnapshotsResponse.ServerResponse.Header or (if a response was
  2212. // returned at all) in error.(*googleapi.Error).Header. Use
  2213. // googleapi.IsNotModified to check whether the returned error was
  2214. // because http.StatusNotModified was returned.
  2215. func (c *ProjectsSnapshotsListCall) Do(opts ...googleapi.CallOption) (*ListSnapshotsResponse, error) {
  2216. gensupport.SetOptions(c.urlParams_, opts...)
  2217. res, err := c.doRequest("json")
  2218. if res != nil && res.StatusCode == http.StatusNotModified {
  2219. if res.Body != nil {
  2220. res.Body.Close()
  2221. }
  2222. return nil, &googleapi.Error{
  2223. Code: res.StatusCode,
  2224. Header: res.Header,
  2225. }
  2226. }
  2227. if err != nil {
  2228. return nil, err
  2229. }
  2230. defer googleapi.CloseBody(res)
  2231. if err := googleapi.CheckResponse(res); err != nil {
  2232. return nil, err
  2233. }
  2234. ret := &ListSnapshotsResponse{
  2235. ServerResponse: googleapi.ServerResponse{
  2236. Header: res.Header,
  2237. HTTPStatusCode: res.StatusCode,
  2238. },
  2239. }
  2240. target := &ret
  2241. if err := gensupport.DecodeResponse(target, res); err != nil {
  2242. return nil, err
  2243. }
  2244. return ret, nil
  2245. // {
  2246. // "description": "Lists the existing snapshots. Snapshots are used in\n\u003ca href=\"https://cloud.google.com/pubsub/docs/replay-overview\"\u003eSeek\u003c/a\u003e\noperations, which allow\nyou to manage message acknowledgments in bulk. That is, you can set the\nacknowledgment state of messages in an existing subscription to the state\ncaptured by a snapshot.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eBETA:\u003c/b\u003e This feature is part of a beta release. This API might be\nchanged in backward-incompatible ways and is not recommended for production\nuse. It is not subject to any SLA or deprecation policy.",
  2247. // "flatPath": "v1/projects/{projectsId}/snapshots",
  2248. // "httpMethod": "GET",
  2249. // "id": "pubsub.projects.snapshots.list",
  2250. // "parameterOrder": [
  2251. // "project"
  2252. // ],
  2253. // "parameters": {
  2254. // "pageSize": {
  2255. // "description": "Maximum number of snapshots to return.",
  2256. // "format": "int32",
  2257. // "location": "query",
  2258. // "type": "integer"
  2259. // },
  2260. // "pageToken": {
  2261. // "description": "The value returned by the last `ListSnapshotsResponse`; indicates that this\nis a continuation of a prior `ListSnapshots` call, and that the system\nshould return the next page of data.",
  2262. // "location": "query",
  2263. // "type": "string"
  2264. // },
  2265. // "project": {
  2266. // "description": "The name of the project in which to list snapshots.\nFormat is `projects/{project-id}`.",
  2267. // "location": "path",
  2268. // "pattern": "^projects/[^/]+$",
  2269. // "required": true,
  2270. // "type": "string"
  2271. // }
  2272. // },
  2273. // "path": "v1/{+project}/snapshots",
  2274. // "response": {
  2275. // "$ref": "ListSnapshotsResponse"
  2276. // },
  2277. // "scopes": [
  2278. // "https://www.googleapis.com/auth/cloud-platform",
  2279. // "https://www.googleapis.com/auth/pubsub"
  2280. // ]
  2281. // }
  2282. }
  2283. // Pages invokes f for each page of results.
  2284. // A non-nil error returned from f will halt the iteration.
  2285. // The provided context supersedes any context provided to the Context method.
  2286. func (c *ProjectsSnapshotsListCall) Pages(ctx context.Context, f func(*ListSnapshotsResponse) error) error {
  2287. c.ctx_ = ctx
  2288. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2289. for {
  2290. x, err := c.Do()
  2291. if err != nil {
  2292. return err
  2293. }
  2294. if err := f(x); err != nil {
  2295. return err
  2296. }
  2297. if x.NextPageToken == "" {
  2298. return nil
  2299. }
  2300. c.PageToken(x.NextPageToken)
  2301. }
  2302. }
  2303. // method id "pubsub.projects.snapshots.patch":
  2304. type ProjectsSnapshotsPatchCall struct {
  2305. s *Service
  2306. name string
  2307. updatesnapshotrequest *UpdateSnapshotRequest
  2308. urlParams_ gensupport.URLParams
  2309. ctx_ context.Context
  2310. header_ http.Header
  2311. }
  2312. // Patch: Updates an existing snapshot. Snapshots are used in
  2313. // <a
  2314. // href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
  2315. // o
  2316. // perations, which allow
  2317. // you to manage message acknowledgments in bulk. That is, you can set
  2318. // the
  2319. // acknowledgment state of messages in an existing subscription to the
  2320. // state
  2321. // captured by a snapshot.<br><br>
  2322. // <b>BETA:</b> This feature is part of a beta release. This API might
  2323. // be
  2324. // changed in backward-incompatible ways and is not recommended for
  2325. // production
  2326. // use. It is not subject to any SLA or deprecation policy.
  2327. // Note that certain properties of a snapshot are not modifiable.
  2328. func (r *ProjectsSnapshotsService) Patch(name string, updatesnapshotrequest *UpdateSnapshotRequest) *ProjectsSnapshotsPatchCall {
  2329. c := &ProjectsSnapshotsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2330. c.name = name
  2331. c.updatesnapshotrequest = updatesnapshotrequest
  2332. return c
  2333. }
  2334. // Fields allows partial responses to be retrieved. See
  2335. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2336. // for more information.
  2337. func (c *ProjectsSnapshotsPatchCall) Fields(s ...googleapi.Field) *ProjectsSnapshotsPatchCall {
  2338. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2339. return c
  2340. }
  2341. // Context sets the context to be used in this call's Do method. Any
  2342. // pending HTTP request will be aborted if the provided context is
  2343. // canceled.
  2344. func (c *ProjectsSnapshotsPatchCall) Context(ctx context.Context) *ProjectsSnapshotsPatchCall {
  2345. c.ctx_ = ctx
  2346. return c
  2347. }
  2348. // Header returns an http.Header that can be modified by the caller to
  2349. // add HTTP headers to the request.
  2350. func (c *ProjectsSnapshotsPatchCall) Header() http.Header {
  2351. if c.header_ == nil {
  2352. c.header_ = make(http.Header)
  2353. }
  2354. return c.header_
  2355. }
  2356. func (c *ProjectsSnapshotsPatchCall) doRequest(alt string) (*http.Response, error) {
  2357. reqHeaders := make(http.Header)
  2358. for k, v := range c.header_ {
  2359. reqHeaders[k] = v
  2360. }
  2361. reqHeaders.Set("User-Agent", c.s.userAgent())
  2362. var body io.Reader = nil
  2363. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatesnapshotrequest)
  2364. if err != nil {
  2365. return nil, err
  2366. }
  2367. reqHeaders.Set("Content-Type", "application/json")
  2368. c.urlParams_.Set("alt", alt)
  2369. c.urlParams_.Set("prettyPrint", "false")
  2370. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2371. urls += "?" + c.urlParams_.Encode()
  2372. req, err := http.NewRequest("PATCH", urls, body)
  2373. if err != nil {
  2374. return nil, err
  2375. }
  2376. req.Header = reqHeaders
  2377. googleapi.Expand(req.URL, map[string]string{
  2378. "name": c.name,
  2379. })
  2380. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2381. }
  2382. // Do executes the "pubsub.projects.snapshots.patch" call.
  2383. // Exactly one of *Snapshot or error will be non-nil. Any non-2xx status
  2384. // code is an error. Response headers are in either
  2385. // *Snapshot.ServerResponse.Header or (if a response was returned at
  2386. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2387. // to check whether the returned error was because
  2388. // http.StatusNotModified was returned.
  2389. func (c *ProjectsSnapshotsPatchCall) Do(opts ...googleapi.CallOption) (*Snapshot, error) {
  2390. gensupport.SetOptions(c.urlParams_, opts...)
  2391. res, err := c.doRequest("json")
  2392. if res != nil && res.StatusCode == http.StatusNotModified {
  2393. if res.Body != nil {
  2394. res.Body.Close()
  2395. }
  2396. return nil, &googleapi.Error{
  2397. Code: res.StatusCode,
  2398. Header: res.Header,
  2399. }
  2400. }
  2401. if err != nil {
  2402. return nil, err
  2403. }
  2404. defer googleapi.CloseBody(res)
  2405. if err := googleapi.CheckResponse(res); err != nil {
  2406. return nil, err
  2407. }
  2408. ret := &Snapshot{
  2409. ServerResponse: googleapi.ServerResponse{
  2410. Header: res.Header,
  2411. HTTPStatusCode: res.StatusCode,
  2412. },
  2413. }
  2414. target := &ret
  2415. if err := gensupport.DecodeResponse(target, res); err != nil {
  2416. return nil, err
  2417. }
  2418. return ret, nil
  2419. // {
  2420. // "description": "Updates an existing snapshot. Snapshots are used in\n\u003ca href=\"https://cloud.google.com/pubsub/docs/replay-overview\"\u003eSeek\u003c/a\u003e\noperations, which allow\nyou to manage message acknowledgments in bulk. That is, you can set the\nacknowledgment state of messages in an existing subscription to the state\ncaptured by a snapshot.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eBETA:\u003c/b\u003e This feature is part of a beta release. This API might be\nchanged in backward-incompatible ways and is not recommended for production\nuse. It is not subject to any SLA or deprecation policy.\nNote that certain properties of a snapshot are not modifiable.",
  2421. // "flatPath": "v1/projects/{projectsId}/snapshots/{snapshotsId}",
  2422. // "httpMethod": "PATCH",
  2423. // "id": "pubsub.projects.snapshots.patch",
  2424. // "parameterOrder": [
  2425. // "name"
  2426. // ],
  2427. // "parameters": {
  2428. // "name": {
  2429. // "description": "The name of the snapshot.",
  2430. // "location": "path",
  2431. // "pattern": "^projects/[^/]+/snapshots/[^/]+$",
  2432. // "required": true,
  2433. // "type": "string"
  2434. // }
  2435. // },
  2436. // "path": "v1/{+name}",
  2437. // "request": {
  2438. // "$ref": "UpdateSnapshotRequest"
  2439. // },
  2440. // "response": {
  2441. // "$ref": "Snapshot"
  2442. // },
  2443. // "scopes": [
  2444. // "https://www.googleapis.com/auth/cloud-platform",
  2445. // "https://www.googleapis.com/auth/pubsub"
  2446. // ]
  2447. // }
  2448. }
  2449. // method id "pubsub.projects.snapshots.setIamPolicy":
  2450. type ProjectsSnapshotsSetIamPolicyCall struct {
  2451. s *Service
  2452. resource string
  2453. setiampolicyrequest *SetIamPolicyRequest
  2454. urlParams_ gensupport.URLParams
  2455. ctx_ context.Context
  2456. header_ http.Header
  2457. }
  2458. // SetIamPolicy: Sets the access control policy on the specified
  2459. // resource. Replaces any
  2460. // existing policy.
  2461. func (r *ProjectsSnapshotsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSnapshotsSetIamPolicyCall {
  2462. c := &ProjectsSnapshotsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2463. c.resource = resource
  2464. c.setiampolicyrequest = setiampolicyrequest
  2465. return c
  2466. }
  2467. // Fields allows partial responses to be retrieved. See
  2468. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2469. // for more information.
  2470. func (c *ProjectsSnapshotsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSnapshotsSetIamPolicyCall {
  2471. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2472. return c
  2473. }
  2474. // Context sets the context to be used in this call's Do method. Any
  2475. // pending HTTP request will be aborted if the provided context is
  2476. // canceled.
  2477. func (c *ProjectsSnapshotsSetIamPolicyCall) Context(ctx context.Context) *ProjectsSnapshotsSetIamPolicyCall {
  2478. c.ctx_ = ctx
  2479. return c
  2480. }
  2481. // Header returns an http.Header that can be modified by the caller to
  2482. // add HTTP headers to the request.
  2483. func (c *ProjectsSnapshotsSetIamPolicyCall) Header() http.Header {
  2484. if c.header_ == nil {
  2485. c.header_ = make(http.Header)
  2486. }
  2487. return c.header_
  2488. }
  2489. func (c *ProjectsSnapshotsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  2490. reqHeaders := make(http.Header)
  2491. for k, v := range c.header_ {
  2492. reqHeaders[k] = v
  2493. }
  2494. reqHeaders.Set("User-Agent", c.s.userAgent())
  2495. var body io.Reader = nil
  2496. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  2497. if err != nil {
  2498. return nil, err
  2499. }
  2500. reqHeaders.Set("Content-Type", "application/json")
  2501. c.urlParams_.Set("alt", alt)
  2502. c.urlParams_.Set("prettyPrint", "false")
  2503. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  2504. urls += "?" + c.urlParams_.Encode()
  2505. req, err := http.NewRequest("POST", urls, body)
  2506. if err != nil {
  2507. return nil, err
  2508. }
  2509. req.Header = reqHeaders
  2510. googleapi.Expand(req.URL, map[string]string{
  2511. "resource": c.resource,
  2512. })
  2513. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2514. }
  2515. // Do executes the "pubsub.projects.snapshots.setIamPolicy" call.
  2516. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  2517. // code is an error. Response headers are in either
  2518. // *Policy.ServerResponse.Header or (if a response was returned at all)
  2519. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2520. // check whether the returned error was because http.StatusNotModified
  2521. // was returned.
  2522. func (c *ProjectsSnapshotsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  2523. gensupport.SetOptions(c.urlParams_, opts...)
  2524. res, err := c.doRequest("json")
  2525. if res != nil && res.StatusCode == http.StatusNotModified {
  2526. if res.Body != nil {
  2527. res.Body.Close()
  2528. }
  2529. return nil, &googleapi.Error{
  2530. Code: res.StatusCode,
  2531. Header: res.Header,
  2532. }
  2533. }
  2534. if err != nil {
  2535. return nil, err
  2536. }
  2537. defer googleapi.CloseBody(res)
  2538. if err := googleapi.CheckResponse(res); err != nil {
  2539. return nil, err
  2540. }
  2541. ret := &Policy{
  2542. ServerResponse: googleapi.ServerResponse{
  2543. Header: res.Header,
  2544. HTTPStatusCode: res.StatusCode,
  2545. },
  2546. }
  2547. target := &ret
  2548. if err := gensupport.DecodeResponse(target, res); err != nil {
  2549. return nil, err
  2550. }
  2551. return ret, nil
  2552. // {
  2553. // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
  2554. // "flatPath": "v1/projects/{projectsId}/snapshots/{snapshotsId}:setIamPolicy",
  2555. // "httpMethod": "POST",
  2556. // "id": "pubsub.projects.snapshots.setIamPolicy",
  2557. // "parameterOrder": [
  2558. // "resource"
  2559. // ],
  2560. // "parameters": {
  2561. // "resource": {
  2562. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  2563. // "location": "path",
  2564. // "pattern": "^projects/[^/]+/snapshots/[^/]+$",
  2565. // "required": true,
  2566. // "type": "string"
  2567. // }
  2568. // },
  2569. // "path": "v1/{+resource}:setIamPolicy",
  2570. // "request": {
  2571. // "$ref": "SetIamPolicyRequest"
  2572. // },
  2573. // "response": {
  2574. // "$ref": "Policy"
  2575. // },
  2576. // "scopes": [
  2577. // "https://www.googleapis.com/auth/cloud-platform",
  2578. // "https://www.googleapis.com/auth/pubsub"
  2579. // ]
  2580. // }
  2581. }
  2582. // method id "pubsub.projects.snapshots.testIamPermissions":
  2583. type ProjectsSnapshotsTestIamPermissionsCall struct {
  2584. s *Service
  2585. resource string
  2586. testiampermissionsrequest *TestIamPermissionsRequest
  2587. urlParams_ gensupport.URLParams
  2588. ctx_ context.Context
  2589. header_ http.Header
  2590. }
  2591. // TestIamPermissions: Returns permissions that a caller has on the
  2592. // specified resource.
  2593. // If the resource does not exist, this will return an empty set
  2594. // of
  2595. // permissions, not a NOT_FOUND error.
  2596. //
  2597. // Note: This operation is designed to be used for building
  2598. // permission-aware
  2599. // UIs and command-line tools, not for authorization checking. This
  2600. // operation
  2601. // may "fail open" without warning.
  2602. func (r *ProjectsSnapshotsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsSnapshotsTestIamPermissionsCall {
  2603. c := &ProjectsSnapshotsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2604. c.resource = resource
  2605. c.testiampermissionsrequest = testiampermissionsrequest
  2606. return c
  2607. }
  2608. // Fields allows partial responses to be retrieved. See
  2609. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2610. // for more information.
  2611. func (c *ProjectsSnapshotsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsSnapshotsTestIamPermissionsCall {
  2612. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2613. return c
  2614. }
  2615. // Context sets the context to be used in this call's Do method. Any
  2616. // pending HTTP request will be aborted if the provided context is
  2617. // canceled.
  2618. func (c *ProjectsSnapshotsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsSnapshotsTestIamPermissionsCall {
  2619. c.ctx_ = ctx
  2620. return c
  2621. }
  2622. // Header returns an http.Header that can be modified by the caller to
  2623. // add HTTP headers to the request.
  2624. func (c *ProjectsSnapshotsTestIamPermissionsCall) Header() http.Header {
  2625. if c.header_ == nil {
  2626. c.header_ = make(http.Header)
  2627. }
  2628. return c.header_
  2629. }
  2630. func (c *ProjectsSnapshotsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  2631. reqHeaders := make(http.Header)
  2632. for k, v := range c.header_ {
  2633. reqHeaders[k] = v
  2634. }
  2635. reqHeaders.Set("User-Agent", c.s.userAgent())
  2636. var body io.Reader = nil
  2637. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  2638. if err != nil {
  2639. return nil, err
  2640. }
  2641. reqHeaders.Set("Content-Type", "application/json")
  2642. c.urlParams_.Set("alt", alt)
  2643. c.urlParams_.Set("prettyPrint", "false")
  2644. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  2645. urls += "?" + c.urlParams_.Encode()
  2646. req, err := http.NewRequest("POST", urls, body)
  2647. if err != nil {
  2648. return nil, err
  2649. }
  2650. req.Header = reqHeaders
  2651. googleapi.Expand(req.URL, map[string]string{
  2652. "resource": c.resource,
  2653. })
  2654. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2655. }
  2656. // Do executes the "pubsub.projects.snapshots.testIamPermissions" call.
  2657. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  2658. // Any non-2xx status code is an error. Response headers are in either
  2659. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  2660. // was returned at all) in error.(*googleapi.Error).Header. Use
  2661. // googleapi.IsNotModified to check whether the returned error was
  2662. // because http.StatusNotModified was returned.
  2663. func (c *ProjectsSnapshotsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  2664. gensupport.SetOptions(c.urlParams_, opts...)
  2665. res, err := c.doRequest("json")
  2666. if res != nil && res.StatusCode == http.StatusNotModified {
  2667. if res.Body != nil {
  2668. res.Body.Close()
  2669. }
  2670. return nil, &googleapi.Error{
  2671. Code: res.StatusCode,
  2672. Header: res.Header,
  2673. }
  2674. }
  2675. if err != nil {
  2676. return nil, err
  2677. }
  2678. defer googleapi.CloseBody(res)
  2679. if err := googleapi.CheckResponse(res); err != nil {
  2680. return nil, err
  2681. }
  2682. ret := &TestIamPermissionsResponse{
  2683. ServerResponse: googleapi.ServerResponse{
  2684. Header: res.Header,
  2685. HTTPStatusCode: res.StatusCode,
  2686. },
  2687. }
  2688. target := &ret
  2689. if err := gensupport.DecodeResponse(target, res); err != nil {
  2690. return nil, err
  2691. }
  2692. return ret, nil
  2693. // {
  2694. // "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.",
  2695. // "flatPath": "v1/projects/{projectsId}/snapshots/{snapshotsId}:testIamPermissions",
  2696. // "httpMethod": "POST",
  2697. // "id": "pubsub.projects.snapshots.testIamPermissions",
  2698. // "parameterOrder": [
  2699. // "resource"
  2700. // ],
  2701. // "parameters": {
  2702. // "resource": {
  2703. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  2704. // "location": "path",
  2705. // "pattern": "^projects/[^/]+/snapshots/[^/]+$",
  2706. // "required": true,
  2707. // "type": "string"
  2708. // }
  2709. // },
  2710. // "path": "v1/{+resource}:testIamPermissions",
  2711. // "request": {
  2712. // "$ref": "TestIamPermissionsRequest"
  2713. // },
  2714. // "response": {
  2715. // "$ref": "TestIamPermissionsResponse"
  2716. // },
  2717. // "scopes": [
  2718. // "https://www.googleapis.com/auth/cloud-platform",
  2719. // "https://www.googleapis.com/auth/pubsub"
  2720. // ]
  2721. // }
  2722. }
  2723. // method id "pubsub.projects.subscriptions.acknowledge":
  2724. type ProjectsSubscriptionsAcknowledgeCall struct {
  2725. s *Service
  2726. subscription string
  2727. acknowledgerequest *AcknowledgeRequest
  2728. urlParams_ gensupport.URLParams
  2729. ctx_ context.Context
  2730. header_ http.Header
  2731. }
  2732. // Acknowledge: Acknowledges the messages associated with the `ack_ids`
  2733. // in the
  2734. // `AcknowledgeRequest`. The Pub/Sub system can remove the relevant
  2735. // messages
  2736. // from the subscription.
  2737. //
  2738. // Acknowledging a message whose ack deadline has expired may
  2739. // succeed,
  2740. // but such a message may be redelivered later. Acknowledging a message
  2741. // more
  2742. // than once will not result in an error.
  2743. func (r *ProjectsSubscriptionsService) Acknowledge(subscription string, acknowledgerequest *AcknowledgeRequest) *ProjectsSubscriptionsAcknowledgeCall {
  2744. c := &ProjectsSubscriptionsAcknowledgeCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2745. c.subscription = subscription
  2746. c.acknowledgerequest = acknowledgerequest
  2747. return c
  2748. }
  2749. // Fields allows partial responses to be retrieved. See
  2750. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2751. // for more information.
  2752. func (c *ProjectsSubscriptionsAcknowledgeCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsAcknowledgeCall {
  2753. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2754. return c
  2755. }
  2756. // Context sets the context to be used in this call's Do method. Any
  2757. // pending HTTP request will be aborted if the provided context is
  2758. // canceled.
  2759. func (c *ProjectsSubscriptionsAcknowledgeCall) Context(ctx context.Context) *ProjectsSubscriptionsAcknowledgeCall {
  2760. c.ctx_ = ctx
  2761. return c
  2762. }
  2763. // Header returns an http.Header that can be modified by the caller to
  2764. // add HTTP headers to the request.
  2765. func (c *ProjectsSubscriptionsAcknowledgeCall) Header() http.Header {
  2766. if c.header_ == nil {
  2767. c.header_ = make(http.Header)
  2768. }
  2769. return c.header_
  2770. }
  2771. func (c *ProjectsSubscriptionsAcknowledgeCall) doRequest(alt string) (*http.Response, error) {
  2772. reqHeaders := make(http.Header)
  2773. for k, v := range c.header_ {
  2774. reqHeaders[k] = v
  2775. }
  2776. reqHeaders.Set("User-Agent", c.s.userAgent())
  2777. var body io.Reader = nil
  2778. body, err := googleapi.WithoutDataWrapper.JSONReader(c.acknowledgerequest)
  2779. if err != nil {
  2780. return nil, err
  2781. }
  2782. reqHeaders.Set("Content-Type", "application/json")
  2783. c.urlParams_.Set("alt", alt)
  2784. c.urlParams_.Set("prettyPrint", "false")
  2785. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}:acknowledge")
  2786. urls += "?" + c.urlParams_.Encode()
  2787. req, err := http.NewRequest("POST", urls, body)
  2788. if err != nil {
  2789. return nil, err
  2790. }
  2791. req.Header = reqHeaders
  2792. googleapi.Expand(req.URL, map[string]string{
  2793. "subscription": c.subscription,
  2794. })
  2795. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2796. }
  2797. // Do executes the "pubsub.projects.subscriptions.acknowledge" call.
  2798. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  2799. // code is an error. Response headers are in either
  2800. // *Empty.ServerResponse.Header or (if a response was returned at all)
  2801. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2802. // check whether the returned error was because http.StatusNotModified
  2803. // was returned.
  2804. func (c *ProjectsSubscriptionsAcknowledgeCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  2805. gensupport.SetOptions(c.urlParams_, opts...)
  2806. res, err := c.doRequest("json")
  2807. if res != nil && res.StatusCode == http.StatusNotModified {
  2808. if res.Body != nil {
  2809. res.Body.Close()
  2810. }
  2811. return nil, &googleapi.Error{
  2812. Code: res.StatusCode,
  2813. Header: res.Header,
  2814. }
  2815. }
  2816. if err != nil {
  2817. return nil, err
  2818. }
  2819. defer googleapi.CloseBody(res)
  2820. if err := googleapi.CheckResponse(res); err != nil {
  2821. return nil, err
  2822. }
  2823. ret := &Empty{
  2824. ServerResponse: googleapi.ServerResponse{
  2825. Header: res.Header,
  2826. HTTPStatusCode: res.StatusCode,
  2827. },
  2828. }
  2829. target := &ret
  2830. if err := gensupport.DecodeResponse(target, res); err != nil {
  2831. return nil, err
  2832. }
  2833. return ret, nil
  2834. // {
  2835. // "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.",
  2836. // "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:acknowledge",
  2837. // "httpMethod": "POST",
  2838. // "id": "pubsub.projects.subscriptions.acknowledge",
  2839. // "parameterOrder": [
  2840. // "subscription"
  2841. // ],
  2842. // "parameters": {
  2843. // "subscription": {
  2844. // "description": "The subscription whose message is being acknowledged.\nFormat is `projects/{project}/subscriptions/{sub}`.",
  2845. // "location": "path",
  2846. // "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
  2847. // "required": true,
  2848. // "type": "string"
  2849. // }
  2850. // },
  2851. // "path": "v1/{+subscription}:acknowledge",
  2852. // "request": {
  2853. // "$ref": "AcknowledgeRequest"
  2854. // },
  2855. // "response": {
  2856. // "$ref": "Empty"
  2857. // },
  2858. // "scopes": [
  2859. // "https://www.googleapis.com/auth/cloud-platform",
  2860. // "https://www.googleapis.com/auth/pubsub"
  2861. // ]
  2862. // }
  2863. }
  2864. // method id "pubsub.projects.subscriptions.create":
  2865. type ProjectsSubscriptionsCreateCall struct {
  2866. s *Service
  2867. name string
  2868. subscription *Subscription
  2869. urlParams_ gensupport.URLParams
  2870. ctx_ context.Context
  2871. header_ http.Header
  2872. }
  2873. // Create: Creates a subscription to a given topic. See the
  2874. // <a
  2875. // href="https://cloud.google.com/pubsub/docs/admin#resource_names">
  2876. // reso
  2877. // urce name rules</a>.
  2878. // If the subscription already exists, returns `ALREADY_EXISTS`.
  2879. // If the corresponding topic doesn't exist, returns `NOT_FOUND`.
  2880. //
  2881. // If the name is not provided in the request, the server will assign a
  2882. // random
  2883. // name for this subscription on the same project as the topic,
  2884. // conforming
  2885. // to the
  2886. // [resource name
  2887. // format](https://cloud.google.com/pubsub/docs/admin#resource_names).
  2888. // Th
  2889. // e generated name is populated in the returned Subscription
  2890. // object.
  2891. // Note that for REST API requests, you must specify a name in the
  2892. // request.
  2893. func (r *ProjectsSubscriptionsService) Create(name string, subscription *Subscription) *ProjectsSubscriptionsCreateCall {
  2894. c := &ProjectsSubscriptionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2895. c.name = name
  2896. c.subscription = subscription
  2897. return c
  2898. }
  2899. // Fields allows partial responses to be retrieved. See
  2900. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2901. // for more information.
  2902. func (c *ProjectsSubscriptionsCreateCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsCreateCall {
  2903. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2904. return c
  2905. }
  2906. // Context sets the context to be used in this call's Do method. Any
  2907. // pending HTTP request will be aborted if the provided context is
  2908. // canceled.
  2909. func (c *ProjectsSubscriptionsCreateCall) Context(ctx context.Context) *ProjectsSubscriptionsCreateCall {
  2910. c.ctx_ = ctx
  2911. return c
  2912. }
  2913. // Header returns an http.Header that can be modified by the caller to
  2914. // add HTTP headers to the request.
  2915. func (c *ProjectsSubscriptionsCreateCall) Header() http.Header {
  2916. if c.header_ == nil {
  2917. c.header_ = make(http.Header)
  2918. }
  2919. return c.header_
  2920. }
  2921. func (c *ProjectsSubscriptionsCreateCall) doRequest(alt string) (*http.Response, error) {
  2922. reqHeaders := make(http.Header)
  2923. for k, v := range c.header_ {
  2924. reqHeaders[k] = v
  2925. }
  2926. reqHeaders.Set("User-Agent", c.s.userAgent())
  2927. var body io.Reader = nil
  2928. body, err := googleapi.WithoutDataWrapper.JSONReader(c.subscription)
  2929. if err != nil {
  2930. return nil, err
  2931. }
  2932. reqHeaders.Set("Content-Type", "application/json")
  2933. c.urlParams_.Set("alt", alt)
  2934. c.urlParams_.Set("prettyPrint", "false")
  2935. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  2936. urls += "?" + c.urlParams_.Encode()
  2937. req, err := http.NewRequest("PUT", urls, body)
  2938. if err != nil {
  2939. return nil, err
  2940. }
  2941. req.Header = reqHeaders
  2942. googleapi.Expand(req.URL, map[string]string{
  2943. "name": c.name,
  2944. })
  2945. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2946. }
  2947. // Do executes the "pubsub.projects.subscriptions.create" call.
  2948. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  2949. // status code is an error. Response headers are in either
  2950. // *Subscription.ServerResponse.Header or (if a response was returned at
  2951. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2952. // to check whether the returned error was because
  2953. // http.StatusNotModified was returned.
  2954. func (c *ProjectsSubscriptionsCreateCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  2955. gensupport.SetOptions(c.urlParams_, opts...)
  2956. res, err := c.doRequest("json")
  2957. if res != nil && res.StatusCode == http.StatusNotModified {
  2958. if res.Body != nil {
  2959. res.Body.Close()
  2960. }
  2961. return nil, &googleapi.Error{
  2962. Code: res.StatusCode,
  2963. Header: res.Header,
  2964. }
  2965. }
  2966. if err != nil {
  2967. return nil, err
  2968. }
  2969. defer googleapi.CloseBody(res)
  2970. if err := googleapi.CheckResponse(res); err != nil {
  2971. return nil, err
  2972. }
  2973. ret := &Subscription{
  2974. ServerResponse: googleapi.ServerResponse{
  2975. Header: res.Header,
  2976. HTTPStatusCode: res.StatusCode,
  2977. },
  2978. }
  2979. target := &ret
  2980. if err := gensupport.DecodeResponse(target, res); err != nil {
  2981. return nil, err
  2982. }
  2983. return ret, nil
  2984. // {
  2985. // "description": "Creates a subscription to a given topic. See the\n\u003ca href=\"https://cloud.google.com/pubsub/docs/admin#resource_names\"\u003e\nresource name rules\u003c/a\u003e.\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, conforming\nto the\n[resource name format](https://cloud.google.com/pubsub/docs/admin#resource_names).\nThe generated name is populated in the returned Subscription object.\nNote that for REST API requests, you must specify a name in the request.",
  2986. // "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}",
  2987. // "httpMethod": "PUT",
  2988. // "id": "pubsub.projects.subscriptions.create",
  2989. // "parameterOrder": [
  2990. // "name"
  2991. // ],
  2992. // "parameters": {
  2993. // "name": {
  2994. // "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\"`.",
  2995. // "location": "path",
  2996. // "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
  2997. // "required": true,
  2998. // "type": "string"
  2999. // }
  3000. // },
  3001. // "path": "v1/{+name}",
  3002. // "request": {
  3003. // "$ref": "Subscription"
  3004. // },
  3005. // "response": {
  3006. // "$ref": "Subscription"
  3007. // },
  3008. // "scopes": [
  3009. // "https://www.googleapis.com/auth/cloud-platform",
  3010. // "https://www.googleapis.com/auth/pubsub"
  3011. // ]
  3012. // }
  3013. }
  3014. // method id "pubsub.projects.subscriptions.delete":
  3015. type ProjectsSubscriptionsDeleteCall struct {
  3016. s *Service
  3017. subscription string
  3018. urlParams_ gensupport.URLParams
  3019. ctx_ context.Context
  3020. header_ http.Header
  3021. }
  3022. // Delete: Deletes an existing subscription. All messages retained in
  3023. // the subscription
  3024. // are immediately dropped. Calls to `Pull` after deletion will
  3025. // return
  3026. // `NOT_FOUND`. After a subscription is deleted, a new one may be
  3027. // created with
  3028. // the same name, but the new one has no association with the
  3029. // old
  3030. // subscription or its topic unless the same topic is specified.
  3031. func (r *ProjectsSubscriptionsService) Delete(subscription string) *ProjectsSubscriptionsDeleteCall {
  3032. c := &ProjectsSubscriptionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3033. c.subscription = subscription
  3034. return c
  3035. }
  3036. // Fields allows partial responses to be retrieved. See
  3037. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3038. // for more information.
  3039. func (c *ProjectsSubscriptionsDeleteCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsDeleteCall {
  3040. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3041. return c
  3042. }
  3043. // Context sets the context to be used in this call's Do method. Any
  3044. // pending HTTP request will be aborted if the provided context is
  3045. // canceled.
  3046. func (c *ProjectsSubscriptionsDeleteCall) Context(ctx context.Context) *ProjectsSubscriptionsDeleteCall {
  3047. c.ctx_ = ctx
  3048. return c
  3049. }
  3050. // Header returns an http.Header that can be modified by the caller to
  3051. // add HTTP headers to the request.
  3052. func (c *ProjectsSubscriptionsDeleteCall) Header() http.Header {
  3053. if c.header_ == nil {
  3054. c.header_ = make(http.Header)
  3055. }
  3056. return c.header_
  3057. }
  3058. func (c *ProjectsSubscriptionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3059. reqHeaders := make(http.Header)
  3060. for k, v := range c.header_ {
  3061. reqHeaders[k] = v
  3062. }
  3063. reqHeaders.Set("User-Agent", c.s.userAgent())
  3064. var body io.Reader = nil
  3065. c.urlParams_.Set("alt", alt)
  3066. c.urlParams_.Set("prettyPrint", "false")
  3067. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}")
  3068. urls += "?" + c.urlParams_.Encode()
  3069. req, err := http.NewRequest("DELETE", urls, body)
  3070. if err != nil {
  3071. return nil, err
  3072. }
  3073. req.Header = reqHeaders
  3074. googleapi.Expand(req.URL, map[string]string{
  3075. "subscription": c.subscription,
  3076. })
  3077. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3078. }
  3079. // Do executes the "pubsub.projects.subscriptions.delete" call.
  3080. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3081. // code is an error. Response headers are in either
  3082. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3083. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3084. // check whether the returned error was because http.StatusNotModified
  3085. // was returned.
  3086. func (c *ProjectsSubscriptionsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3087. gensupport.SetOptions(c.urlParams_, opts...)
  3088. res, err := c.doRequest("json")
  3089. if res != nil && res.StatusCode == http.StatusNotModified {
  3090. if res.Body != nil {
  3091. res.Body.Close()
  3092. }
  3093. return nil, &googleapi.Error{
  3094. Code: res.StatusCode,
  3095. Header: res.Header,
  3096. }
  3097. }
  3098. if err != nil {
  3099. return nil, err
  3100. }
  3101. defer googleapi.CloseBody(res)
  3102. if err := googleapi.CheckResponse(res); err != nil {
  3103. return nil, err
  3104. }
  3105. ret := &Empty{
  3106. ServerResponse: googleapi.ServerResponse{
  3107. Header: res.Header,
  3108. HTTPStatusCode: res.StatusCode,
  3109. },
  3110. }
  3111. target := &ret
  3112. if err := gensupport.DecodeResponse(target, res); err != nil {
  3113. return nil, err
  3114. }
  3115. return ret, nil
  3116. // {
  3117. // "description": "Deletes an existing subscription. All messages retained 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.",
  3118. // "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}",
  3119. // "httpMethod": "DELETE",
  3120. // "id": "pubsub.projects.subscriptions.delete",
  3121. // "parameterOrder": [
  3122. // "subscription"
  3123. // ],
  3124. // "parameters": {
  3125. // "subscription": {
  3126. // "description": "The subscription to delete.\nFormat is `projects/{project}/subscriptions/{sub}`.",
  3127. // "location": "path",
  3128. // "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
  3129. // "required": true,
  3130. // "type": "string"
  3131. // }
  3132. // },
  3133. // "path": "v1/{+subscription}",
  3134. // "response": {
  3135. // "$ref": "Empty"
  3136. // },
  3137. // "scopes": [
  3138. // "https://www.googleapis.com/auth/cloud-platform",
  3139. // "https://www.googleapis.com/auth/pubsub"
  3140. // ]
  3141. // }
  3142. }
  3143. // method id "pubsub.projects.subscriptions.get":
  3144. type ProjectsSubscriptionsGetCall struct {
  3145. s *Service
  3146. subscription string
  3147. urlParams_ gensupport.URLParams
  3148. ifNoneMatch_ string
  3149. ctx_ context.Context
  3150. header_ http.Header
  3151. }
  3152. // Get: Gets the configuration details of a subscription.
  3153. func (r *ProjectsSubscriptionsService) Get(subscription string) *ProjectsSubscriptionsGetCall {
  3154. c := &ProjectsSubscriptionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3155. c.subscription = subscription
  3156. return c
  3157. }
  3158. // Fields allows partial responses to be retrieved. See
  3159. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3160. // for more information.
  3161. func (c *ProjectsSubscriptionsGetCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsGetCall {
  3162. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3163. return c
  3164. }
  3165. // IfNoneMatch sets the optional parameter which makes the operation
  3166. // fail if the object's ETag matches the given value. This is useful for
  3167. // getting updates only after the object has changed since the last
  3168. // request. Use googleapi.IsNotModified to check whether the response
  3169. // error from Do is the result of In-None-Match.
  3170. func (c *ProjectsSubscriptionsGetCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsGetCall {
  3171. c.ifNoneMatch_ = entityTag
  3172. return c
  3173. }
  3174. // Context sets the context to be used in this call's Do method. Any
  3175. // pending HTTP request will be aborted if the provided context is
  3176. // canceled.
  3177. func (c *ProjectsSubscriptionsGetCall) Context(ctx context.Context) *ProjectsSubscriptionsGetCall {
  3178. c.ctx_ = ctx
  3179. return c
  3180. }
  3181. // Header returns an http.Header that can be modified by the caller to
  3182. // add HTTP headers to the request.
  3183. func (c *ProjectsSubscriptionsGetCall) Header() http.Header {
  3184. if c.header_ == nil {
  3185. c.header_ = make(http.Header)
  3186. }
  3187. return c.header_
  3188. }
  3189. func (c *ProjectsSubscriptionsGetCall) doRequest(alt string) (*http.Response, error) {
  3190. reqHeaders := make(http.Header)
  3191. for k, v := range c.header_ {
  3192. reqHeaders[k] = v
  3193. }
  3194. reqHeaders.Set("User-Agent", c.s.userAgent())
  3195. if c.ifNoneMatch_ != "" {
  3196. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3197. }
  3198. var body io.Reader = nil
  3199. c.urlParams_.Set("alt", alt)
  3200. c.urlParams_.Set("prettyPrint", "false")
  3201. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}")
  3202. urls += "?" + c.urlParams_.Encode()
  3203. req, err := http.NewRequest("GET", urls, body)
  3204. if err != nil {
  3205. return nil, err
  3206. }
  3207. req.Header = reqHeaders
  3208. googleapi.Expand(req.URL, map[string]string{
  3209. "subscription": c.subscription,
  3210. })
  3211. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3212. }
  3213. // Do executes the "pubsub.projects.subscriptions.get" call.
  3214. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  3215. // status code is an error. Response headers are in either
  3216. // *Subscription.ServerResponse.Header or (if a response was returned at
  3217. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3218. // to check whether the returned error was because
  3219. // http.StatusNotModified was returned.
  3220. func (c *ProjectsSubscriptionsGetCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  3221. gensupport.SetOptions(c.urlParams_, opts...)
  3222. res, err := c.doRequest("json")
  3223. if res != nil && res.StatusCode == http.StatusNotModified {
  3224. if res.Body != nil {
  3225. res.Body.Close()
  3226. }
  3227. return nil, &googleapi.Error{
  3228. Code: res.StatusCode,
  3229. Header: res.Header,
  3230. }
  3231. }
  3232. if err != nil {
  3233. return nil, err
  3234. }
  3235. defer googleapi.CloseBody(res)
  3236. if err := googleapi.CheckResponse(res); err != nil {
  3237. return nil, err
  3238. }
  3239. ret := &Subscription{
  3240. ServerResponse: googleapi.ServerResponse{
  3241. Header: res.Header,
  3242. HTTPStatusCode: res.StatusCode,
  3243. },
  3244. }
  3245. target := &ret
  3246. if err := gensupport.DecodeResponse(target, res); err != nil {
  3247. return nil, err
  3248. }
  3249. return ret, nil
  3250. // {
  3251. // "description": "Gets the configuration details of a subscription.",
  3252. // "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}",
  3253. // "httpMethod": "GET",
  3254. // "id": "pubsub.projects.subscriptions.get",
  3255. // "parameterOrder": [
  3256. // "subscription"
  3257. // ],
  3258. // "parameters": {
  3259. // "subscription": {
  3260. // "description": "The name of the subscription to get.\nFormat is `projects/{project}/subscriptions/{sub}`.",
  3261. // "location": "path",
  3262. // "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
  3263. // "required": true,
  3264. // "type": "string"
  3265. // }
  3266. // },
  3267. // "path": "v1/{+subscription}",
  3268. // "response": {
  3269. // "$ref": "Subscription"
  3270. // },
  3271. // "scopes": [
  3272. // "https://www.googleapis.com/auth/cloud-platform",
  3273. // "https://www.googleapis.com/auth/pubsub"
  3274. // ]
  3275. // }
  3276. }
  3277. // method id "pubsub.projects.subscriptions.getIamPolicy":
  3278. type ProjectsSubscriptionsGetIamPolicyCall struct {
  3279. s *Service
  3280. resource string
  3281. urlParams_ gensupport.URLParams
  3282. ifNoneMatch_ string
  3283. ctx_ context.Context
  3284. header_ http.Header
  3285. }
  3286. // GetIamPolicy: Gets the access control policy for a resource.
  3287. // Returns an empty policy if the resource exists and does not have a
  3288. // policy
  3289. // set.
  3290. func (r *ProjectsSubscriptionsService) GetIamPolicy(resource string) *ProjectsSubscriptionsGetIamPolicyCall {
  3291. c := &ProjectsSubscriptionsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3292. c.resource = resource
  3293. return c
  3294. }
  3295. // Fields allows partial responses to be retrieved. See
  3296. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3297. // for more information.
  3298. func (c *ProjectsSubscriptionsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsGetIamPolicyCall {
  3299. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3300. return c
  3301. }
  3302. // IfNoneMatch sets the optional parameter which makes the operation
  3303. // fail if the object's ETag matches the given value. This is useful for
  3304. // getting updates only after the object has changed since the last
  3305. // request. Use googleapi.IsNotModified to check whether the response
  3306. // error from Do is the result of In-None-Match.
  3307. func (c *ProjectsSubscriptionsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsGetIamPolicyCall {
  3308. c.ifNoneMatch_ = entityTag
  3309. return c
  3310. }
  3311. // Context sets the context to be used in this call's Do method. Any
  3312. // pending HTTP request will be aborted if the provided context is
  3313. // canceled.
  3314. func (c *ProjectsSubscriptionsGetIamPolicyCall) Context(ctx context.Context) *ProjectsSubscriptionsGetIamPolicyCall {
  3315. c.ctx_ = ctx
  3316. return c
  3317. }
  3318. // Header returns an http.Header that can be modified by the caller to
  3319. // add HTTP headers to the request.
  3320. func (c *ProjectsSubscriptionsGetIamPolicyCall) Header() http.Header {
  3321. if c.header_ == nil {
  3322. c.header_ = make(http.Header)
  3323. }
  3324. return c.header_
  3325. }
  3326. func (c *ProjectsSubscriptionsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  3327. reqHeaders := make(http.Header)
  3328. for k, v := range c.header_ {
  3329. reqHeaders[k] = v
  3330. }
  3331. reqHeaders.Set("User-Agent", c.s.userAgent())
  3332. if c.ifNoneMatch_ != "" {
  3333. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3334. }
  3335. var body io.Reader = nil
  3336. c.urlParams_.Set("alt", alt)
  3337. c.urlParams_.Set("prettyPrint", "false")
  3338. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  3339. urls += "?" + c.urlParams_.Encode()
  3340. req, err := http.NewRequest("GET", urls, body)
  3341. if err != nil {
  3342. return nil, err
  3343. }
  3344. req.Header = reqHeaders
  3345. googleapi.Expand(req.URL, map[string]string{
  3346. "resource": c.resource,
  3347. })
  3348. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3349. }
  3350. // Do executes the "pubsub.projects.subscriptions.getIamPolicy" call.
  3351. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  3352. // code is an error. Response headers are in either
  3353. // *Policy.ServerResponse.Header or (if a response was returned at all)
  3354. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3355. // check whether the returned error was because http.StatusNotModified
  3356. // was returned.
  3357. func (c *ProjectsSubscriptionsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  3358. gensupport.SetOptions(c.urlParams_, opts...)
  3359. res, err := c.doRequest("json")
  3360. if res != nil && res.StatusCode == http.StatusNotModified {
  3361. if res.Body != nil {
  3362. res.Body.Close()
  3363. }
  3364. return nil, &googleapi.Error{
  3365. Code: res.StatusCode,
  3366. Header: res.Header,
  3367. }
  3368. }
  3369. if err != nil {
  3370. return nil, err
  3371. }
  3372. defer googleapi.CloseBody(res)
  3373. if err := googleapi.CheckResponse(res); err != nil {
  3374. return nil, err
  3375. }
  3376. ret := &Policy{
  3377. ServerResponse: googleapi.ServerResponse{
  3378. Header: res.Header,
  3379. HTTPStatusCode: res.StatusCode,
  3380. },
  3381. }
  3382. target := &ret
  3383. if err := gensupport.DecodeResponse(target, res); err != nil {
  3384. return nil, err
  3385. }
  3386. return ret, nil
  3387. // {
  3388. // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
  3389. // "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:getIamPolicy",
  3390. // "httpMethod": "GET",
  3391. // "id": "pubsub.projects.subscriptions.getIamPolicy",
  3392. // "parameterOrder": [
  3393. // "resource"
  3394. // ],
  3395. // "parameters": {
  3396. // "resource": {
  3397. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  3398. // "location": "path",
  3399. // "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
  3400. // "required": true,
  3401. // "type": "string"
  3402. // }
  3403. // },
  3404. // "path": "v1/{+resource}:getIamPolicy",
  3405. // "response": {
  3406. // "$ref": "Policy"
  3407. // },
  3408. // "scopes": [
  3409. // "https://www.googleapis.com/auth/cloud-platform",
  3410. // "https://www.googleapis.com/auth/pubsub"
  3411. // ]
  3412. // }
  3413. }
  3414. // method id "pubsub.projects.subscriptions.list":
  3415. type ProjectsSubscriptionsListCall struct {
  3416. s *Service
  3417. project string
  3418. urlParams_ gensupport.URLParams
  3419. ifNoneMatch_ string
  3420. ctx_ context.Context
  3421. header_ http.Header
  3422. }
  3423. // List: Lists matching subscriptions.
  3424. func (r *ProjectsSubscriptionsService) List(project string) *ProjectsSubscriptionsListCall {
  3425. c := &ProjectsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3426. c.project = project
  3427. return c
  3428. }
  3429. // PageSize sets the optional parameter "pageSize": Maximum number of
  3430. // subscriptions to return.
  3431. func (c *ProjectsSubscriptionsListCall) PageSize(pageSize int64) *ProjectsSubscriptionsListCall {
  3432. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3433. return c
  3434. }
  3435. // PageToken sets the optional parameter "pageToken": The value returned
  3436. // by the last `ListSubscriptionsResponse`; indicates that
  3437. // this is a continuation of a prior `ListSubscriptions` call, and that
  3438. // the
  3439. // system should return the next page of data.
  3440. func (c *ProjectsSubscriptionsListCall) PageToken(pageToken string) *ProjectsSubscriptionsListCall {
  3441. c.urlParams_.Set("pageToken", pageToken)
  3442. return c
  3443. }
  3444. // Fields allows partial responses to be retrieved. See
  3445. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3446. // for more information.
  3447. func (c *ProjectsSubscriptionsListCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsListCall {
  3448. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3449. return c
  3450. }
  3451. // IfNoneMatch sets the optional parameter which makes the operation
  3452. // fail if the object's ETag matches the given value. This is useful for
  3453. // getting updates only after the object has changed since the last
  3454. // request. Use googleapi.IsNotModified to check whether the response
  3455. // error from Do is the result of In-None-Match.
  3456. func (c *ProjectsSubscriptionsListCall) IfNoneMatch(entityTag string) *ProjectsSubscriptionsListCall {
  3457. c.ifNoneMatch_ = entityTag
  3458. return c
  3459. }
  3460. // Context sets the context to be used in this call's Do method. Any
  3461. // pending HTTP request will be aborted if the provided context is
  3462. // canceled.
  3463. func (c *ProjectsSubscriptionsListCall) Context(ctx context.Context) *ProjectsSubscriptionsListCall {
  3464. c.ctx_ = ctx
  3465. return c
  3466. }
  3467. // Header returns an http.Header that can be modified by the caller to
  3468. // add HTTP headers to the request.
  3469. func (c *ProjectsSubscriptionsListCall) Header() http.Header {
  3470. if c.header_ == nil {
  3471. c.header_ = make(http.Header)
  3472. }
  3473. return c.header_
  3474. }
  3475. func (c *ProjectsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
  3476. reqHeaders := make(http.Header)
  3477. for k, v := range c.header_ {
  3478. reqHeaders[k] = v
  3479. }
  3480. reqHeaders.Set("User-Agent", c.s.userAgent())
  3481. if c.ifNoneMatch_ != "" {
  3482. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3483. }
  3484. var body io.Reader = nil
  3485. c.urlParams_.Set("alt", alt)
  3486. c.urlParams_.Set("prettyPrint", "false")
  3487. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+project}/subscriptions")
  3488. urls += "?" + c.urlParams_.Encode()
  3489. req, err := http.NewRequest("GET", urls, body)
  3490. if err != nil {
  3491. return nil, err
  3492. }
  3493. req.Header = reqHeaders
  3494. googleapi.Expand(req.URL, map[string]string{
  3495. "project": c.project,
  3496. })
  3497. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3498. }
  3499. // Do executes the "pubsub.projects.subscriptions.list" call.
  3500. // Exactly one of *ListSubscriptionsResponse or error will be non-nil.
  3501. // Any non-2xx status code is an error. Response headers are in either
  3502. // *ListSubscriptionsResponse.ServerResponse.Header or (if a response
  3503. // was returned at all) in error.(*googleapi.Error).Header. Use
  3504. // googleapi.IsNotModified to check whether the returned error was
  3505. // because http.StatusNotModified was returned.
  3506. func (c *ProjectsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListSubscriptionsResponse, error) {
  3507. gensupport.SetOptions(c.urlParams_, opts...)
  3508. res, err := c.doRequest("json")
  3509. if res != nil && res.StatusCode == http.StatusNotModified {
  3510. if res.Body != nil {
  3511. res.Body.Close()
  3512. }
  3513. return nil, &googleapi.Error{
  3514. Code: res.StatusCode,
  3515. Header: res.Header,
  3516. }
  3517. }
  3518. if err != nil {
  3519. return nil, err
  3520. }
  3521. defer googleapi.CloseBody(res)
  3522. if err := googleapi.CheckResponse(res); err != nil {
  3523. return nil, err
  3524. }
  3525. ret := &ListSubscriptionsResponse{
  3526. ServerResponse: googleapi.ServerResponse{
  3527. Header: res.Header,
  3528. HTTPStatusCode: res.StatusCode,
  3529. },
  3530. }
  3531. target := &ret
  3532. if err := gensupport.DecodeResponse(target, res); err != nil {
  3533. return nil, err
  3534. }
  3535. return ret, nil
  3536. // {
  3537. // "description": "Lists matching subscriptions.",
  3538. // "flatPath": "v1/projects/{projectsId}/subscriptions",
  3539. // "httpMethod": "GET",
  3540. // "id": "pubsub.projects.subscriptions.list",
  3541. // "parameterOrder": [
  3542. // "project"
  3543. // ],
  3544. // "parameters": {
  3545. // "pageSize": {
  3546. // "description": "Maximum number of subscriptions to return.",
  3547. // "format": "int32",
  3548. // "location": "query",
  3549. // "type": "integer"
  3550. // },
  3551. // "pageToken": {
  3552. // "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.",
  3553. // "location": "query",
  3554. // "type": "string"
  3555. // },
  3556. // "project": {
  3557. // "description": "The name of the project in which to list subscriptions.\nFormat is `projects/{project-id}`.",
  3558. // "location": "path",
  3559. // "pattern": "^projects/[^/]+$",
  3560. // "required": true,
  3561. // "type": "string"
  3562. // }
  3563. // },
  3564. // "path": "v1/{+project}/subscriptions",
  3565. // "response": {
  3566. // "$ref": "ListSubscriptionsResponse"
  3567. // },
  3568. // "scopes": [
  3569. // "https://www.googleapis.com/auth/cloud-platform",
  3570. // "https://www.googleapis.com/auth/pubsub"
  3571. // ]
  3572. // }
  3573. }
  3574. // Pages invokes f for each page of results.
  3575. // A non-nil error returned from f will halt the iteration.
  3576. // The provided context supersedes any context provided to the Context method.
  3577. func (c *ProjectsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListSubscriptionsResponse) error) error {
  3578. c.ctx_ = ctx
  3579. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3580. for {
  3581. x, err := c.Do()
  3582. if err != nil {
  3583. return err
  3584. }
  3585. if err := f(x); err != nil {
  3586. return err
  3587. }
  3588. if x.NextPageToken == "" {
  3589. return nil
  3590. }
  3591. c.PageToken(x.NextPageToken)
  3592. }
  3593. }
  3594. // method id "pubsub.projects.subscriptions.modifyAckDeadline":
  3595. type ProjectsSubscriptionsModifyAckDeadlineCall struct {
  3596. s *Service
  3597. subscription string
  3598. modifyackdeadlinerequest *ModifyAckDeadlineRequest
  3599. urlParams_ gensupport.URLParams
  3600. ctx_ context.Context
  3601. header_ http.Header
  3602. }
  3603. // ModifyAckDeadline: Modifies the ack deadline for a specific message.
  3604. // This method is useful
  3605. // to indicate that more time is needed to process a message by
  3606. // the
  3607. // subscriber, or to make the message available for redelivery if
  3608. // the
  3609. // processing was interrupted. Note that this does not modify
  3610. // the
  3611. // subscription-level `ackDeadlineSeconds` used for subsequent messages.
  3612. func (r *ProjectsSubscriptionsService) ModifyAckDeadline(subscription string, modifyackdeadlinerequest *ModifyAckDeadlineRequest) *ProjectsSubscriptionsModifyAckDeadlineCall {
  3613. c := &ProjectsSubscriptionsModifyAckDeadlineCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3614. c.subscription = subscription
  3615. c.modifyackdeadlinerequest = modifyackdeadlinerequest
  3616. return c
  3617. }
  3618. // Fields allows partial responses to be retrieved. See
  3619. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3620. // for more information.
  3621. func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsModifyAckDeadlineCall {
  3622. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3623. return c
  3624. }
  3625. // Context sets the context to be used in this call's Do method. Any
  3626. // pending HTTP request will be aborted if the provided context is
  3627. // canceled.
  3628. func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Context(ctx context.Context) *ProjectsSubscriptionsModifyAckDeadlineCall {
  3629. c.ctx_ = ctx
  3630. return c
  3631. }
  3632. // Header returns an http.Header that can be modified by the caller to
  3633. // add HTTP headers to the request.
  3634. func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Header() http.Header {
  3635. if c.header_ == nil {
  3636. c.header_ = make(http.Header)
  3637. }
  3638. return c.header_
  3639. }
  3640. func (c *ProjectsSubscriptionsModifyAckDeadlineCall) doRequest(alt string) (*http.Response, error) {
  3641. reqHeaders := make(http.Header)
  3642. for k, v := range c.header_ {
  3643. reqHeaders[k] = v
  3644. }
  3645. reqHeaders.Set("User-Agent", c.s.userAgent())
  3646. var body io.Reader = nil
  3647. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifyackdeadlinerequest)
  3648. if err != nil {
  3649. return nil, err
  3650. }
  3651. reqHeaders.Set("Content-Type", "application/json")
  3652. c.urlParams_.Set("alt", alt)
  3653. c.urlParams_.Set("prettyPrint", "false")
  3654. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}:modifyAckDeadline")
  3655. urls += "?" + c.urlParams_.Encode()
  3656. req, err := http.NewRequest("POST", urls, body)
  3657. if err != nil {
  3658. return nil, err
  3659. }
  3660. req.Header = reqHeaders
  3661. googleapi.Expand(req.URL, map[string]string{
  3662. "subscription": c.subscription,
  3663. })
  3664. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3665. }
  3666. // Do executes the "pubsub.projects.subscriptions.modifyAckDeadline" call.
  3667. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3668. // code is an error. Response headers are in either
  3669. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3670. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3671. // check whether the returned error was because http.StatusNotModified
  3672. // was returned.
  3673. func (c *ProjectsSubscriptionsModifyAckDeadlineCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3674. gensupport.SetOptions(c.urlParams_, opts...)
  3675. res, err := c.doRequest("json")
  3676. if res != nil && res.StatusCode == http.StatusNotModified {
  3677. if res.Body != nil {
  3678. res.Body.Close()
  3679. }
  3680. return nil, &googleapi.Error{
  3681. Code: res.StatusCode,
  3682. Header: res.Header,
  3683. }
  3684. }
  3685. if err != nil {
  3686. return nil, err
  3687. }
  3688. defer googleapi.CloseBody(res)
  3689. if err := googleapi.CheckResponse(res); err != nil {
  3690. return nil, err
  3691. }
  3692. ret := &Empty{
  3693. ServerResponse: googleapi.ServerResponse{
  3694. Header: res.Header,
  3695. HTTPStatusCode: res.StatusCode,
  3696. },
  3697. }
  3698. target := &ret
  3699. if err := gensupport.DecodeResponse(target, res); err != nil {
  3700. return nil, err
  3701. }
  3702. return ret, nil
  3703. // {
  3704. // "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.",
  3705. // "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:modifyAckDeadline",
  3706. // "httpMethod": "POST",
  3707. // "id": "pubsub.projects.subscriptions.modifyAckDeadline",
  3708. // "parameterOrder": [
  3709. // "subscription"
  3710. // ],
  3711. // "parameters": {
  3712. // "subscription": {
  3713. // "description": "The name of the subscription.\nFormat is `projects/{project}/subscriptions/{sub}`.",
  3714. // "location": "path",
  3715. // "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
  3716. // "required": true,
  3717. // "type": "string"
  3718. // }
  3719. // },
  3720. // "path": "v1/{+subscription}:modifyAckDeadline",
  3721. // "request": {
  3722. // "$ref": "ModifyAckDeadlineRequest"
  3723. // },
  3724. // "response": {
  3725. // "$ref": "Empty"
  3726. // },
  3727. // "scopes": [
  3728. // "https://www.googleapis.com/auth/cloud-platform",
  3729. // "https://www.googleapis.com/auth/pubsub"
  3730. // ]
  3731. // }
  3732. }
  3733. // method id "pubsub.projects.subscriptions.modifyPushConfig":
  3734. type ProjectsSubscriptionsModifyPushConfigCall struct {
  3735. s *Service
  3736. subscription string
  3737. modifypushconfigrequest *ModifyPushConfigRequest
  3738. urlParams_ gensupport.URLParams
  3739. ctx_ context.Context
  3740. header_ http.Header
  3741. }
  3742. // ModifyPushConfig: Modifies the `PushConfig` for a specified
  3743. // subscription.
  3744. //
  3745. // This may be used to change a push subscription to a pull one
  3746. // (signified by
  3747. // an empty `PushConfig`) or vice versa, or change the endpoint URL and
  3748. // other
  3749. // attributes of a push subscription. Messages will accumulate for
  3750. // delivery
  3751. // continuously through the call regardless of changes to the
  3752. // `PushConfig`.
  3753. func (r *ProjectsSubscriptionsService) ModifyPushConfig(subscription string, modifypushconfigrequest *ModifyPushConfigRequest) *ProjectsSubscriptionsModifyPushConfigCall {
  3754. c := &ProjectsSubscriptionsModifyPushConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3755. c.subscription = subscription
  3756. c.modifypushconfigrequest = modifypushconfigrequest
  3757. return c
  3758. }
  3759. // Fields allows partial responses to be retrieved. See
  3760. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3761. // for more information.
  3762. func (c *ProjectsSubscriptionsModifyPushConfigCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsModifyPushConfigCall {
  3763. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3764. return c
  3765. }
  3766. // Context sets the context to be used in this call's Do method. Any
  3767. // pending HTTP request will be aborted if the provided context is
  3768. // canceled.
  3769. func (c *ProjectsSubscriptionsModifyPushConfigCall) Context(ctx context.Context) *ProjectsSubscriptionsModifyPushConfigCall {
  3770. c.ctx_ = ctx
  3771. return c
  3772. }
  3773. // Header returns an http.Header that can be modified by the caller to
  3774. // add HTTP headers to the request.
  3775. func (c *ProjectsSubscriptionsModifyPushConfigCall) Header() http.Header {
  3776. if c.header_ == nil {
  3777. c.header_ = make(http.Header)
  3778. }
  3779. return c.header_
  3780. }
  3781. func (c *ProjectsSubscriptionsModifyPushConfigCall) doRequest(alt string) (*http.Response, error) {
  3782. reqHeaders := make(http.Header)
  3783. for k, v := range c.header_ {
  3784. reqHeaders[k] = v
  3785. }
  3786. reqHeaders.Set("User-Agent", c.s.userAgent())
  3787. var body io.Reader = nil
  3788. body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifypushconfigrequest)
  3789. if err != nil {
  3790. return nil, err
  3791. }
  3792. reqHeaders.Set("Content-Type", "application/json")
  3793. c.urlParams_.Set("alt", alt)
  3794. c.urlParams_.Set("prettyPrint", "false")
  3795. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}:modifyPushConfig")
  3796. urls += "?" + c.urlParams_.Encode()
  3797. req, err := http.NewRequest("POST", urls, body)
  3798. if err != nil {
  3799. return nil, err
  3800. }
  3801. req.Header = reqHeaders
  3802. googleapi.Expand(req.URL, map[string]string{
  3803. "subscription": c.subscription,
  3804. })
  3805. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3806. }
  3807. // Do executes the "pubsub.projects.subscriptions.modifyPushConfig" call.
  3808. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3809. // code is an error. Response headers are in either
  3810. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3811. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3812. // check whether the returned error was because http.StatusNotModified
  3813. // was returned.
  3814. func (c *ProjectsSubscriptionsModifyPushConfigCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3815. gensupport.SetOptions(c.urlParams_, opts...)
  3816. res, err := c.doRequest("json")
  3817. if res != nil && res.StatusCode == http.StatusNotModified {
  3818. if res.Body != nil {
  3819. res.Body.Close()
  3820. }
  3821. return nil, &googleapi.Error{
  3822. Code: res.StatusCode,
  3823. Header: res.Header,
  3824. }
  3825. }
  3826. if err != nil {
  3827. return nil, err
  3828. }
  3829. defer googleapi.CloseBody(res)
  3830. if err := googleapi.CheckResponse(res); err != nil {
  3831. return nil, err
  3832. }
  3833. ret := &Empty{
  3834. ServerResponse: googleapi.ServerResponse{
  3835. Header: res.Header,
  3836. HTTPStatusCode: res.StatusCode,
  3837. },
  3838. }
  3839. target := &ret
  3840. if err := gensupport.DecodeResponse(target, res); err != nil {
  3841. return nil, err
  3842. }
  3843. return ret, nil
  3844. // {
  3845. // "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`.",
  3846. // "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:modifyPushConfig",
  3847. // "httpMethod": "POST",
  3848. // "id": "pubsub.projects.subscriptions.modifyPushConfig",
  3849. // "parameterOrder": [
  3850. // "subscription"
  3851. // ],
  3852. // "parameters": {
  3853. // "subscription": {
  3854. // "description": "The name of the subscription.\nFormat is `projects/{project}/subscriptions/{sub}`.",
  3855. // "location": "path",
  3856. // "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
  3857. // "required": true,
  3858. // "type": "string"
  3859. // }
  3860. // },
  3861. // "path": "v1/{+subscription}:modifyPushConfig",
  3862. // "request": {
  3863. // "$ref": "ModifyPushConfigRequest"
  3864. // },
  3865. // "response": {
  3866. // "$ref": "Empty"
  3867. // },
  3868. // "scopes": [
  3869. // "https://www.googleapis.com/auth/cloud-platform",
  3870. // "https://www.googleapis.com/auth/pubsub"
  3871. // ]
  3872. // }
  3873. }
  3874. // method id "pubsub.projects.subscriptions.patch":
  3875. type ProjectsSubscriptionsPatchCall struct {
  3876. s *Service
  3877. name string
  3878. updatesubscriptionrequest *UpdateSubscriptionRequest
  3879. urlParams_ gensupport.URLParams
  3880. ctx_ context.Context
  3881. header_ http.Header
  3882. }
  3883. // Patch: Updates an existing subscription. Note that certain properties
  3884. // of a
  3885. // subscription, such as its topic, are not modifiable.
  3886. func (r *ProjectsSubscriptionsService) Patch(name string, updatesubscriptionrequest *UpdateSubscriptionRequest) *ProjectsSubscriptionsPatchCall {
  3887. c := &ProjectsSubscriptionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3888. c.name = name
  3889. c.updatesubscriptionrequest = updatesubscriptionrequest
  3890. return c
  3891. }
  3892. // Fields allows partial responses to be retrieved. See
  3893. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3894. // for more information.
  3895. func (c *ProjectsSubscriptionsPatchCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsPatchCall {
  3896. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3897. return c
  3898. }
  3899. // Context sets the context to be used in this call's Do method. Any
  3900. // pending HTTP request will be aborted if the provided context is
  3901. // canceled.
  3902. func (c *ProjectsSubscriptionsPatchCall) Context(ctx context.Context) *ProjectsSubscriptionsPatchCall {
  3903. c.ctx_ = ctx
  3904. return c
  3905. }
  3906. // Header returns an http.Header that can be modified by the caller to
  3907. // add HTTP headers to the request.
  3908. func (c *ProjectsSubscriptionsPatchCall) Header() http.Header {
  3909. if c.header_ == nil {
  3910. c.header_ = make(http.Header)
  3911. }
  3912. return c.header_
  3913. }
  3914. func (c *ProjectsSubscriptionsPatchCall) doRequest(alt string) (*http.Response, error) {
  3915. reqHeaders := make(http.Header)
  3916. for k, v := range c.header_ {
  3917. reqHeaders[k] = v
  3918. }
  3919. reqHeaders.Set("User-Agent", c.s.userAgent())
  3920. var body io.Reader = nil
  3921. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatesubscriptionrequest)
  3922. if err != nil {
  3923. return nil, err
  3924. }
  3925. reqHeaders.Set("Content-Type", "application/json")
  3926. c.urlParams_.Set("alt", alt)
  3927. c.urlParams_.Set("prettyPrint", "false")
  3928. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  3929. urls += "?" + c.urlParams_.Encode()
  3930. req, err := http.NewRequest("PATCH", urls, body)
  3931. if err != nil {
  3932. return nil, err
  3933. }
  3934. req.Header = reqHeaders
  3935. googleapi.Expand(req.URL, map[string]string{
  3936. "name": c.name,
  3937. })
  3938. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3939. }
  3940. // Do executes the "pubsub.projects.subscriptions.patch" call.
  3941. // Exactly one of *Subscription or error will be non-nil. Any non-2xx
  3942. // status code is an error. Response headers are in either
  3943. // *Subscription.ServerResponse.Header or (if a response was returned at
  3944. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3945. // to check whether the returned error was because
  3946. // http.StatusNotModified was returned.
  3947. func (c *ProjectsSubscriptionsPatchCall) Do(opts ...googleapi.CallOption) (*Subscription, error) {
  3948. gensupport.SetOptions(c.urlParams_, opts...)
  3949. res, err := c.doRequest("json")
  3950. if res != nil && res.StatusCode == http.StatusNotModified {
  3951. if res.Body != nil {
  3952. res.Body.Close()
  3953. }
  3954. return nil, &googleapi.Error{
  3955. Code: res.StatusCode,
  3956. Header: res.Header,
  3957. }
  3958. }
  3959. if err != nil {
  3960. return nil, err
  3961. }
  3962. defer googleapi.CloseBody(res)
  3963. if err := googleapi.CheckResponse(res); err != nil {
  3964. return nil, err
  3965. }
  3966. ret := &Subscription{
  3967. ServerResponse: googleapi.ServerResponse{
  3968. Header: res.Header,
  3969. HTTPStatusCode: res.StatusCode,
  3970. },
  3971. }
  3972. target := &ret
  3973. if err := gensupport.DecodeResponse(target, res); err != nil {
  3974. return nil, err
  3975. }
  3976. return ret, nil
  3977. // {
  3978. // "description": "Updates an existing subscription. Note that certain properties of a\nsubscription, such as its topic, are not modifiable.",
  3979. // "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}",
  3980. // "httpMethod": "PATCH",
  3981. // "id": "pubsub.projects.subscriptions.patch",
  3982. // "parameterOrder": [
  3983. // "name"
  3984. // ],
  3985. // "parameters": {
  3986. // "name": {
  3987. // "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\"`.",
  3988. // "location": "path",
  3989. // "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
  3990. // "required": true,
  3991. // "type": "string"
  3992. // }
  3993. // },
  3994. // "path": "v1/{+name}",
  3995. // "request": {
  3996. // "$ref": "UpdateSubscriptionRequest"
  3997. // },
  3998. // "response": {
  3999. // "$ref": "Subscription"
  4000. // },
  4001. // "scopes": [
  4002. // "https://www.googleapis.com/auth/cloud-platform",
  4003. // "https://www.googleapis.com/auth/pubsub"
  4004. // ]
  4005. // }
  4006. }
  4007. // method id "pubsub.projects.subscriptions.pull":
  4008. type ProjectsSubscriptionsPullCall struct {
  4009. s *Service
  4010. subscription string
  4011. pullrequest *PullRequest
  4012. urlParams_ gensupport.URLParams
  4013. ctx_ context.Context
  4014. header_ http.Header
  4015. }
  4016. // Pull: Pulls messages from the server. The server may return
  4017. // `UNAVAILABLE` if
  4018. // there are too many concurrent pull requests pending for the
  4019. // given
  4020. // subscription.
  4021. func (r *ProjectsSubscriptionsService) Pull(subscription string, pullrequest *PullRequest) *ProjectsSubscriptionsPullCall {
  4022. c := &ProjectsSubscriptionsPullCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4023. c.subscription = subscription
  4024. c.pullrequest = pullrequest
  4025. return c
  4026. }
  4027. // Fields allows partial responses to be retrieved. See
  4028. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4029. // for more information.
  4030. func (c *ProjectsSubscriptionsPullCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsPullCall {
  4031. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4032. return c
  4033. }
  4034. // Context sets the context to be used in this call's Do method. Any
  4035. // pending HTTP request will be aborted if the provided context is
  4036. // canceled.
  4037. func (c *ProjectsSubscriptionsPullCall) Context(ctx context.Context) *ProjectsSubscriptionsPullCall {
  4038. c.ctx_ = ctx
  4039. return c
  4040. }
  4041. // Header returns an http.Header that can be modified by the caller to
  4042. // add HTTP headers to the request.
  4043. func (c *ProjectsSubscriptionsPullCall) Header() http.Header {
  4044. if c.header_ == nil {
  4045. c.header_ = make(http.Header)
  4046. }
  4047. return c.header_
  4048. }
  4049. func (c *ProjectsSubscriptionsPullCall) doRequest(alt string) (*http.Response, error) {
  4050. reqHeaders := make(http.Header)
  4051. for k, v := range c.header_ {
  4052. reqHeaders[k] = v
  4053. }
  4054. reqHeaders.Set("User-Agent", c.s.userAgent())
  4055. var body io.Reader = nil
  4056. body, err := googleapi.WithoutDataWrapper.JSONReader(c.pullrequest)
  4057. if err != nil {
  4058. return nil, err
  4059. }
  4060. reqHeaders.Set("Content-Type", "application/json")
  4061. c.urlParams_.Set("alt", alt)
  4062. c.urlParams_.Set("prettyPrint", "false")
  4063. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}:pull")
  4064. urls += "?" + c.urlParams_.Encode()
  4065. req, err := http.NewRequest("POST", urls, body)
  4066. if err != nil {
  4067. return nil, err
  4068. }
  4069. req.Header = reqHeaders
  4070. googleapi.Expand(req.URL, map[string]string{
  4071. "subscription": c.subscription,
  4072. })
  4073. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4074. }
  4075. // Do executes the "pubsub.projects.subscriptions.pull" call.
  4076. // Exactly one of *PullResponse or error will be non-nil. Any non-2xx
  4077. // status code is an error. Response headers are in either
  4078. // *PullResponse.ServerResponse.Header or (if a response was returned at
  4079. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4080. // to check whether the returned error was because
  4081. // http.StatusNotModified was returned.
  4082. func (c *ProjectsSubscriptionsPullCall) Do(opts ...googleapi.CallOption) (*PullResponse, error) {
  4083. gensupport.SetOptions(c.urlParams_, opts...)
  4084. res, err := c.doRequest("json")
  4085. if res != nil && res.StatusCode == http.StatusNotModified {
  4086. if res.Body != nil {
  4087. res.Body.Close()
  4088. }
  4089. return nil, &googleapi.Error{
  4090. Code: res.StatusCode,
  4091. Header: res.Header,
  4092. }
  4093. }
  4094. if err != nil {
  4095. return nil, err
  4096. }
  4097. defer googleapi.CloseBody(res)
  4098. if err := googleapi.CheckResponse(res); err != nil {
  4099. return nil, err
  4100. }
  4101. ret := &PullResponse{
  4102. ServerResponse: googleapi.ServerResponse{
  4103. Header: res.Header,
  4104. HTTPStatusCode: res.StatusCode,
  4105. },
  4106. }
  4107. target := &ret
  4108. if err := gensupport.DecodeResponse(target, res); err != nil {
  4109. return nil, err
  4110. }
  4111. return ret, nil
  4112. // {
  4113. // "description": "Pulls messages from the server. The server may return `UNAVAILABLE` if\nthere are too many concurrent pull requests pending for the given\nsubscription.",
  4114. // "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:pull",
  4115. // "httpMethod": "POST",
  4116. // "id": "pubsub.projects.subscriptions.pull",
  4117. // "parameterOrder": [
  4118. // "subscription"
  4119. // ],
  4120. // "parameters": {
  4121. // "subscription": {
  4122. // "description": "The subscription from which messages should be pulled.\nFormat is `projects/{project}/subscriptions/{sub}`.",
  4123. // "location": "path",
  4124. // "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
  4125. // "required": true,
  4126. // "type": "string"
  4127. // }
  4128. // },
  4129. // "path": "v1/{+subscription}:pull",
  4130. // "request": {
  4131. // "$ref": "PullRequest"
  4132. // },
  4133. // "response": {
  4134. // "$ref": "PullResponse"
  4135. // },
  4136. // "scopes": [
  4137. // "https://www.googleapis.com/auth/cloud-platform",
  4138. // "https://www.googleapis.com/auth/pubsub"
  4139. // ]
  4140. // }
  4141. }
  4142. // method id "pubsub.projects.subscriptions.seek":
  4143. type ProjectsSubscriptionsSeekCall struct {
  4144. s *Service
  4145. subscription string
  4146. seekrequest *SeekRequest
  4147. urlParams_ gensupport.URLParams
  4148. ctx_ context.Context
  4149. header_ http.Header
  4150. }
  4151. // Seek: Seeks an existing subscription to a point in time or to a given
  4152. // snapshot,
  4153. // whichever is provided in the request. Snapshots are used in
  4154. // <a
  4155. // href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
  4156. // o
  4157. // perations, which allow
  4158. // you to manage message acknowledgments in bulk. That is, you can set
  4159. // the
  4160. // acknowledgment state of messages in an existing subscription to the
  4161. // state
  4162. // captured by a snapshot. Note that both the subscription and the
  4163. // snapshot
  4164. // must be on the same topic.<br><br>
  4165. // <b>BETA:</b> This feature is part of a beta release. This API might
  4166. // be
  4167. // changed in backward-incompatible ways and is not recommended for
  4168. // production
  4169. // use. It is not subject to any SLA or deprecation policy.
  4170. func (r *ProjectsSubscriptionsService) Seek(subscription string, seekrequest *SeekRequest) *ProjectsSubscriptionsSeekCall {
  4171. c := &ProjectsSubscriptionsSeekCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4172. c.subscription = subscription
  4173. c.seekrequest = seekrequest
  4174. return c
  4175. }
  4176. // Fields allows partial responses to be retrieved. See
  4177. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4178. // for more information.
  4179. func (c *ProjectsSubscriptionsSeekCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsSeekCall {
  4180. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4181. return c
  4182. }
  4183. // Context sets the context to be used in this call's Do method. Any
  4184. // pending HTTP request will be aborted if the provided context is
  4185. // canceled.
  4186. func (c *ProjectsSubscriptionsSeekCall) Context(ctx context.Context) *ProjectsSubscriptionsSeekCall {
  4187. c.ctx_ = ctx
  4188. return c
  4189. }
  4190. // Header returns an http.Header that can be modified by the caller to
  4191. // add HTTP headers to the request.
  4192. func (c *ProjectsSubscriptionsSeekCall) Header() http.Header {
  4193. if c.header_ == nil {
  4194. c.header_ = make(http.Header)
  4195. }
  4196. return c.header_
  4197. }
  4198. func (c *ProjectsSubscriptionsSeekCall) doRequest(alt string) (*http.Response, error) {
  4199. reqHeaders := make(http.Header)
  4200. for k, v := range c.header_ {
  4201. reqHeaders[k] = v
  4202. }
  4203. reqHeaders.Set("User-Agent", c.s.userAgent())
  4204. var body io.Reader = nil
  4205. body, err := googleapi.WithoutDataWrapper.JSONReader(c.seekrequest)
  4206. if err != nil {
  4207. return nil, err
  4208. }
  4209. reqHeaders.Set("Content-Type", "application/json")
  4210. c.urlParams_.Set("alt", alt)
  4211. c.urlParams_.Set("prettyPrint", "false")
  4212. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+subscription}:seek")
  4213. urls += "?" + c.urlParams_.Encode()
  4214. req, err := http.NewRequest("POST", urls, body)
  4215. if err != nil {
  4216. return nil, err
  4217. }
  4218. req.Header = reqHeaders
  4219. googleapi.Expand(req.URL, map[string]string{
  4220. "subscription": c.subscription,
  4221. })
  4222. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4223. }
  4224. // Do executes the "pubsub.projects.subscriptions.seek" call.
  4225. // Exactly one of *SeekResponse or error will be non-nil. Any non-2xx
  4226. // status code is an error. Response headers are in either
  4227. // *SeekResponse.ServerResponse.Header or (if a response was returned at
  4228. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4229. // to check whether the returned error was because
  4230. // http.StatusNotModified was returned.
  4231. func (c *ProjectsSubscriptionsSeekCall) Do(opts ...googleapi.CallOption) (*SeekResponse, error) {
  4232. gensupport.SetOptions(c.urlParams_, opts...)
  4233. res, err := c.doRequest("json")
  4234. if res != nil && res.StatusCode == http.StatusNotModified {
  4235. if res.Body != nil {
  4236. res.Body.Close()
  4237. }
  4238. return nil, &googleapi.Error{
  4239. Code: res.StatusCode,
  4240. Header: res.Header,
  4241. }
  4242. }
  4243. if err != nil {
  4244. return nil, err
  4245. }
  4246. defer googleapi.CloseBody(res)
  4247. if err := googleapi.CheckResponse(res); err != nil {
  4248. return nil, err
  4249. }
  4250. ret := &SeekResponse{
  4251. ServerResponse: googleapi.ServerResponse{
  4252. Header: res.Header,
  4253. HTTPStatusCode: res.StatusCode,
  4254. },
  4255. }
  4256. target := &ret
  4257. if err := gensupport.DecodeResponse(target, res); err != nil {
  4258. return nil, err
  4259. }
  4260. return ret, nil
  4261. // {
  4262. // "description": "Seeks an existing subscription to a point in time or to a given snapshot,\nwhichever is provided in the request. Snapshots are used in\n\u003ca href=\"https://cloud.google.com/pubsub/docs/replay-overview\"\u003eSeek\u003c/a\u003e\noperations, which allow\nyou to manage message acknowledgments in bulk. That is, you can set the\nacknowledgment state of messages in an existing subscription to the state\ncaptured by a snapshot. Note that both the subscription and the snapshot\nmust be on the same topic.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eBETA:\u003c/b\u003e This feature is part of a beta release. This API might be\nchanged in backward-incompatible ways and is not recommended for production\nuse. It is not subject to any SLA or deprecation policy.",
  4263. // "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:seek",
  4264. // "httpMethod": "POST",
  4265. // "id": "pubsub.projects.subscriptions.seek",
  4266. // "parameterOrder": [
  4267. // "subscription"
  4268. // ],
  4269. // "parameters": {
  4270. // "subscription": {
  4271. // "description": "The subscription to affect.",
  4272. // "location": "path",
  4273. // "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
  4274. // "required": true,
  4275. // "type": "string"
  4276. // }
  4277. // },
  4278. // "path": "v1/{+subscription}:seek",
  4279. // "request": {
  4280. // "$ref": "SeekRequest"
  4281. // },
  4282. // "response": {
  4283. // "$ref": "SeekResponse"
  4284. // },
  4285. // "scopes": [
  4286. // "https://www.googleapis.com/auth/cloud-platform",
  4287. // "https://www.googleapis.com/auth/pubsub"
  4288. // ]
  4289. // }
  4290. }
  4291. // method id "pubsub.projects.subscriptions.setIamPolicy":
  4292. type ProjectsSubscriptionsSetIamPolicyCall struct {
  4293. s *Service
  4294. resource string
  4295. setiampolicyrequest *SetIamPolicyRequest
  4296. urlParams_ gensupport.URLParams
  4297. ctx_ context.Context
  4298. header_ http.Header
  4299. }
  4300. // SetIamPolicy: Sets the access control policy on the specified
  4301. // resource. Replaces any
  4302. // existing policy.
  4303. func (r *ProjectsSubscriptionsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsSubscriptionsSetIamPolicyCall {
  4304. c := &ProjectsSubscriptionsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4305. c.resource = resource
  4306. c.setiampolicyrequest = setiampolicyrequest
  4307. return c
  4308. }
  4309. // Fields allows partial responses to be retrieved. See
  4310. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4311. // for more information.
  4312. func (c *ProjectsSubscriptionsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsSetIamPolicyCall {
  4313. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4314. return c
  4315. }
  4316. // Context sets the context to be used in this call's Do method. Any
  4317. // pending HTTP request will be aborted if the provided context is
  4318. // canceled.
  4319. func (c *ProjectsSubscriptionsSetIamPolicyCall) Context(ctx context.Context) *ProjectsSubscriptionsSetIamPolicyCall {
  4320. c.ctx_ = ctx
  4321. return c
  4322. }
  4323. // Header returns an http.Header that can be modified by the caller to
  4324. // add HTTP headers to the request.
  4325. func (c *ProjectsSubscriptionsSetIamPolicyCall) Header() http.Header {
  4326. if c.header_ == nil {
  4327. c.header_ = make(http.Header)
  4328. }
  4329. return c.header_
  4330. }
  4331. func (c *ProjectsSubscriptionsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  4332. reqHeaders := make(http.Header)
  4333. for k, v := range c.header_ {
  4334. reqHeaders[k] = v
  4335. }
  4336. reqHeaders.Set("User-Agent", c.s.userAgent())
  4337. var body io.Reader = nil
  4338. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  4339. if err != nil {
  4340. return nil, err
  4341. }
  4342. reqHeaders.Set("Content-Type", "application/json")
  4343. c.urlParams_.Set("alt", alt)
  4344. c.urlParams_.Set("prettyPrint", "false")
  4345. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  4346. urls += "?" + c.urlParams_.Encode()
  4347. req, err := http.NewRequest("POST", urls, body)
  4348. if err != nil {
  4349. return nil, err
  4350. }
  4351. req.Header = reqHeaders
  4352. googleapi.Expand(req.URL, map[string]string{
  4353. "resource": c.resource,
  4354. })
  4355. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4356. }
  4357. // Do executes the "pubsub.projects.subscriptions.setIamPolicy" call.
  4358. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  4359. // code is an error. Response headers are in either
  4360. // *Policy.ServerResponse.Header or (if a response was returned at all)
  4361. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4362. // check whether the returned error was because http.StatusNotModified
  4363. // was returned.
  4364. func (c *ProjectsSubscriptionsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  4365. gensupport.SetOptions(c.urlParams_, opts...)
  4366. res, err := c.doRequest("json")
  4367. if res != nil && res.StatusCode == http.StatusNotModified {
  4368. if res.Body != nil {
  4369. res.Body.Close()
  4370. }
  4371. return nil, &googleapi.Error{
  4372. Code: res.StatusCode,
  4373. Header: res.Header,
  4374. }
  4375. }
  4376. if err != nil {
  4377. return nil, err
  4378. }
  4379. defer googleapi.CloseBody(res)
  4380. if err := googleapi.CheckResponse(res); err != nil {
  4381. return nil, err
  4382. }
  4383. ret := &Policy{
  4384. ServerResponse: googleapi.ServerResponse{
  4385. Header: res.Header,
  4386. HTTPStatusCode: res.StatusCode,
  4387. },
  4388. }
  4389. target := &ret
  4390. if err := gensupport.DecodeResponse(target, res); err != nil {
  4391. return nil, err
  4392. }
  4393. return ret, nil
  4394. // {
  4395. // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
  4396. // "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:setIamPolicy",
  4397. // "httpMethod": "POST",
  4398. // "id": "pubsub.projects.subscriptions.setIamPolicy",
  4399. // "parameterOrder": [
  4400. // "resource"
  4401. // ],
  4402. // "parameters": {
  4403. // "resource": {
  4404. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  4405. // "location": "path",
  4406. // "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
  4407. // "required": true,
  4408. // "type": "string"
  4409. // }
  4410. // },
  4411. // "path": "v1/{+resource}:setIamPolicy",
  4412. // "request": {
  4413. // "$ref": "SetIamPolicyRequest"
  4414. // },
  4415. // "response": {
  4416. // "$ref": "Policy"
  4417. // },
  4418. // "scopes": [
  4419. // "https://www.googleapis.com/auth/cloud-platform",
  4420. // "https://www.googleapis.com/auth/pubsub"
  4421. // ]
  4422. // }
  4423. }
  4424. // method id "pubsub.projects.subscriptions.testIamPermissions":
  4425. type ProjectsSubscriptionsTestIamPermissionsCall struct {
  4426. s *Service
  4427. resource string
  4428. testiampermissionsrequest *TestIamPermissionsRequest
  4429. urlParams_ gensupport.URLParams
  4430. ctx_ context.Context
  4431. header_ http.Header
  4432. }
  4433. // TestIamPermissions: Returns permissions that a caller has on the
  4434. // specified resource.
  4435. // If the resource does not exist, this will return an empty set
  4436. // of
  4437. // permissions, not a NOT_FOUND error.
  4438. //
  4439. // Note: This operation is designed to be used for building
  4440. // permission-aware
  4441. // UIs and command-line tools, not for authorization checking. This
  4442. // operation
  4443. // may "fail open" without warning.
  4444. func (r *ProjectsSubscriptionsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsSubscriptionsTestIamPermissionsCall {
  4445. c := &ProjectsSubscriptionsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4446. c.resource = resource
  4447. c.testiampermissionsrequest = testiampermissionsrequest
  4448. return c
  4449. }
  4450. // Fields allows partial responses to be retrieved. See
  4451. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4452. // for more information.
  4453. func (c *ProjectsSubscriptionsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsSubscriptionsTestIamPermissionsCall {
  4454. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4455. return c
  4456. }
  4457. // Context sets the context to be used in this call's Do method. Any
  4458. // pending HTTP request will be aborted if the provided context is
  4459. // canceled.
  4460. func (c *ProjectsSubscriptionsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsSubscriptionsTestIamPermissionsCall {
  4461. c.ctx_ = ctx
  4462. return c
  4463. }
  4464. // Header returns an http.Header that can be modified by the caller to
  4465. // add HTTP headers to the request.
  4466. func (c *ProjectsSubscriptionsTestIamPermissionsCall) Header() http.Header {
  4467. if c.header_ == nil {
  4468. c.header_ = make(http.Header)
  4469. }
  4470. return c.header_
  4471. }
  4472. func (c *ProjectsSubscriptionsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  4473. reqHeaders := make(http.Header)
  4474. for k, v := range c.header_ {
  4475. reqHeaders[k] = v
  4476. }
  4477. reqHeaders.Set("User-Agent", c.s.userAgent())
  4478. var body io.Reader = nil
  4479. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  4480. if err != nil {
  4481. return nil, err
  4482. }
  4483. reqHeaders.Set("Content-Type", "application/json")
  4484. c.urlParams_.Set("alt", alt)
  4485. c.urlParams_.Set("prettyPrint", "false")
  4486. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  4487. urls += "?" + c.urlParams_.Encode()
  4488. req, err := http.NewRequest("POST", urls, body)
  4489. if err != nil {
  4490. return nil, err
  4491. }
  4492. req.Header = reqHeaders
  4493. googleapi.Expand(req.URL, map[string]string{
  4494. "resource": c.resource,
  4495. })
  4496. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4497. }
  4498. // Do executes the "pubsub.projects.subscriptions.testIamPermissions" call.
  4499. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  4500. // Any non-2xx status code is an error. Response headers are in either
  4501. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  4502. // was returned at all) in error.(*googleapi.Error).Header. Use
  4503. // googleapi.IsNotModified to check whether the returned error was
  4504. // because http.StatusNotModified was returned.
  4505. func (c *ProjectsSubscriptionsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  4506. gensupport.SetOptions(c.urlParams_, opts...)
  4507. res, err := c.doRequest("json")
  4508. if res != nil && res.StatusCode == http.StatusNotModified {
  4509. if res.Body != nil {
  4510. res.Body.Close()
  4511. }
  4512. return nil, &googleapi.Error{
  4513. Code: res.StatusCode,
  4514. Header: res.Header,
  4515. }
  4516. }
  4517. if err != nil {
  4518. return nil, err
  4519. }
  4520. defer googleapi.CloseBody(res)
  4521. if err := googleapi.CheckResponse(res); err != nil {
  4522. return nil, err
  4523. }
  4524. ret := &TestIamPermissionsResponse{
  4525. ServerResponse: googleapi.ServerResponse{
  4526. Header: res.Header,
  4527. HTTPStatusCode: res.StatusCode,
  4528. },
  4529. }
  4530. target := &ret
  4531. if err := gensupport.DecodeResponse(target, res); err != nil {
  4532. return nil, err
  4533. }
  4534. return ret, nil
  4535. // {
  4536. // "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.",
  4537. // "flatPath": "v1/projects/{projectsId}/subscriptions/{subscriptionsId}:testIamPermissions",
  4538. // "httpMethod": "POST",
  4539. // "id": "pubsub.projects.subscriptions.testIamPermissions",
  4540. // "parameterOrder": [
  4541. // "resource"
  4542. // ],
  4543. // "parameters": {
  4544. // "resource": {
  4545. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  4546. // "location": "path",
  4547. // "pattern": "^projects/[^/]+/subscriptions/[^/]+$",
  4548. // "required": true,
  4549. // "type": "string"
  4550. // }
  4551. // },
  4552. // "path": "v1/{+resource}:testIamPermissions",
  4553. // "request": {
  4554. // "$ref": "TestIamPermissionsRequest"
  4555. // },
  4556. // "response": {
  4557. // "$ref": "TestIamPermissionsResponse"
  4558. // },
  4559. // "scopes": [
  4560. // "https://www.googleapis.com/auth/cloud-platform",
  4561. // "https://www.googleapis.com/auth/pubsub"
  4562. // ]
  4563. // }
  4564. }
  4565. // method id "pubsub.projects.topics.create":
  4566. type ProjectsTopicsCreateCall struct {
  4567. s *Service
  4568. name string
  4569. topic *Topic
  4570. urlParams_ gensupport.URLParams
  4571. ctx_ context.Context
  4572. header_ http.Header
  4573. }
  4574. // Create: Creates the given topic with the given name. See the
  4575. // <a
  4576. // href="https://cloud.google.com/pubsub/docs/admin#resource_names">
  4577. // reso
  4578. // urce name rules</a>.
  4579. func (r *ProjectsTopicsService) Create(name string, topic *Topic) *ProjectsTopicsCreateCall {
  4580. c := &ProjectsTopicsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4581. c.name = name
  4582. c.topic = topic
  4583. return c
  4584. }
  4585. // Fields allows partial responses to be retrieved. See
  4586. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4587. // for more information.
  4588. func (c *ProjectsTopicsCreateCall) Fields(s ...googleapi.Field) *ProjectsTopicsCreateCall {
  4589. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4590. return c
  4591. }
  4592. // Context sets the context to be used in this call's Do method. Any
  4593. // pending HTTP request will be aborted if the provided context is
  4594. // canceled.
  4595. func (c *ProjectsTopicsCreateCall) Context(ctx context.Context) *ProjectsTopicsCreateCall {
  4596. c.ctx_ = ctx
  4597. return c
  4598. }
  4599. // Header returns an http.Header that can be modified by the caller to
  4600. // add HTTP headers to the request.
  4601. func (c *ProjectsTopicsCreateCall) Header() http.Header {
  4602. if c.header_ == nil {
  4603. c.header_ = make(http.Header)
  4604. }
  4605. return c.header_
  4606. }
  4607. func (c *ProjectsTopicsCreateCall) doRequest(alt string) (*http.Response, error) {
  4608. reqHeaders := make(http.Header)
  4609. for k, v := range c.header_ {
  4610. reqHeaders[k] = v
  4611. }
  4612. reqHeaders.Set("User-Agent", c.s.userAgent())
  4613. var body io.Reader = nil
  4614. body, err := googleapi.WithoutDataWrapper.JSONReader(c.topic)
  4615. if err != nil {
  4616. return nil, err
  4617. }
  4618. reqHeaders.Set("Content-Type", "application/json")
  4619. c.urlParams_.Set("alt", alt)
  4620. c.urlParams_.Set("prettyPrint", "false")
  4621. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  4622. urls += "?" + c.urlParams_.Encode()
  4623. req, err := http.NewRequest("PUT", urls, body)
  4624. if err != nil {
  4625. return nil, err
  4626. }
  4627. req.Header = reqHeaders
  4628. googleapi.Expand(req.URL, map[string]string{
  4629. "name": c.name,
  4630. })
  4631. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4632. }
  4633. // Do executes the "pubsub.projects.topics.create" call.
  4634. // Exactly one of *Topic or error will be non-nil. Any non-2xx status
  4635. // code is an error. Response headers are in either
  4636. // *Topic.ServerResponse.Header or (if a response was returned at all)
  4637. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4638. // check whether the returned error was because http.StatusNotModified
  4639. // was returned.
  4640. func (c *ProjectsTopicsCreateCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
  4641. gensupport.SetOptions(c.urlParams_, opts...)
  4642. res, err := c.doRequest("json")
  4643. if res != nil && res.StatusCode == http.StatusNotModified {
  4644. if res.Body != nil {
  4645. res.Body.Close()
  4646. }
  4647. return nil, &googleapi.Error{
  4648. Code: res.StatusCode,
  4649. Header: res.Header,
  4650. }
  4651. }
  4652. if err != nil {
  4653. return nil, err
  4654. }
  4655. defer googleapi.CloseBody(res)
  4656. if err := googleapi.CheckResponse(res); err != nil {
  4657. return nil, err
  4658. }
  4659. ret := &Topic{
  4660. ServerResponse: googleapi.ServerResponse{
  4661. Header: res.Header,
  4662. HTTPStatusCode: res.StatusCode,
  4663. },
  4664. }
  4665. target := &ret
  4666. if err := gensupport.DecodeResponse(target, res); err != nil {
  4667. return nil, err
  4668. }
  4669. return ret, nil
  4670. // {
  4671. // "description": "Creates the given topic with the given name. See the\n\u003ca href=\"https://cloud.google.com/pubsub/docs/admin#resource_names\"\u003e\nresource name rules\u003c/a\u003e.",
  4672. // "flatPath": "v1/projects/{projectsId}/topics/{topicsId}",
  4673. // "httpMethod": "PUT",
  4674. // "id": "pubsub.projects.topics.create",
  4675. // "parameterOrder": [
  4676. // "name"
  4677. // ],
  4678. // "parameters": {
  4679. // "name": {
  4680. // "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\"`.",
  4681. // "location": "path",
  4682. // "pattern": "^projects/[^/]+/topics/[^/]+$",
  4683. // "required": true,
  4684. // "type": "string"
  4685. // }
  4686. // },
  4687. // "path": "v1/{+name}",
  4688. // "request": {
  4689. // "$ref": "Topic"
  4690. // },
  4691. // "response": {
  4692. // "$ref": "Topic"
  4693. // },
  4694. // "scopes": [
  4695. // "https://www.googleapis.com/auth/cloud-platform",
  4696. // "https://www.googleapis.com/auth/pubsub"
  4697. // ]
  4698. // }
  4699. }
  4700. // method id "pubsub.projects.topics.delete":
  4701. type ProjectsTopicsDeleteCall struct {
  4702. s *Service
  4703. topic string
  4704. urlParams_ gensupport.URLParams
  4705. ctx_ context.Context
  4706. header_ http.Header
  4707. }
  4708. // Delete: Deletes the topic with the given name. Returns `NOT_FOUND` if
  4709. // the topic
  4710. // does not exist. After a topic is deleted, a new topic may be created
  4711. // with
  4712. // the same name; this is an entirely new topic with none of the
  4713. // old
  4714. // configuration or subscriptions. Existing subscriptions to this topic
  4715. // are
  4716. // not deleted, but their `topic` field is set to `_deleted-topic_`.
  4717. func (r *ProjectsTopicsService) Delete(topic string) *ProjectsTopicsDeleteCall {
  4718. c := &ProjectsTopicsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4719. c.topic = topic
  4720. return c
  4721. }
  4722. // Fields allows partial responses to be retrieved. See
  4723. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4724. // for more information.
  4725. func (c *ProjectsTopicsDeleteCall) Fields(s ...googleapi.Field) *ProjectsTopicsDeleteCall {
  4726. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4727. return c
  4728. }
  4729. // Context sets the context to be used in this call's Do method. Any
  4730. // pending HTTP request will be aborted if the provided context is
  4731. // canceled.
  4732. func (c *ProjectsTopicsDeleteCall) Context(ctx context.Context) *ProjectsTopicsDeleteCall {
  4733. c.ctx_ = ctx
  4734. return c
  4735. }
  4736. // Header returns an http.Header that can be modified by the caller to
  4737. // add HTTP headers to the request.
  4738. func (c *ProjectsTopicsDeleteCall) Header() http.Header {
  4739. if c.header_ == nil {
  4740. c.header_ = make(http.Header)
  4741. }
  4742. return c.header_
  4743. }
  4744. func (c *ProjectsTopicsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4745. reqHeaders := make(http.Header)
  4746. for k, v := range c.header_ {
  4747. reqHeaders[k] = v
  4748. }
  4749. reqHeaders.Set("User-Agent", c.s.userAgent())
  4750. var body io.Reader = nil
  4751. c.urlParams_.Set("alt", alt)
  4752. c.urlParams_.Set("prettyPrint", "false")
  4753. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+topic}")
  4754. urls += "?" + c.urlParams_.Encode()
  4755. req, err := http.NewRequest("DELETE", urls, body)
  4756. if err != nil {
  4757. return nil, err
  4758. }
  4759. req.Header = reqHeaders
  4760. googleapi.Expand(req.URL, map[string]string{
  4761. "topic": c.topic,
  4762. })
  4763. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4764. }
  4765. // Do executes the "pubsub.projects.topics.delete" call.
  4766. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  4767. // code is an error. Response headers are in either
  4768. // *Empty.ServerResponse.Header or (if a response was returned at all)
  4769. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4770. // check whether the returned error was because http.StatusNotModified
  4771. // was returned.
  4772. func (c *ProjectsTopicsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  4773. gensupport.SetOptions(c.urlParams_, opts...)
  4774. res, err := c.doRequest("json")
  4775. if res != nil && res.StatusCode == http.StatusNotModified {
  4776. if res.Body != nil {
  4777. res.Body.Close()
  4778. }
  4779. return nil, &googleapi.Error{
  4780. Code: res.StatusCode,
  4781. Header: res.Header,
  4782. }
  4783. }
  4784. if err != nil {
  4785. return nil, err
  4786. }
  4787. defer googleapi.CloseBody(res)
  4788. if err := googleapi.CheckResponse(res); err != nil {
  4789. return nil, err
  4790. }
  4791. ret := &Empty{
  4792. ServerResponse: googleapi.ServerResponse{
  4793. Header: res.Header,
  4794. HTTPStatusCode: res.StatusCode,
  4795. },
  4796. }
  4797. target := &ret
  4798. if err := gensupport.DecodeResponse(target, res); err != nil {
  4799. return nil, err
  4800. }
  4801. return ret, nil
  4802. // {
  4803. // "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_`.",
  4804. // "flatPath": "v1/projects/{projectsId}/topics/{topicsId}",
  4805. // "httpMethod": "DELETE",
  4806. // "id": "pubsub.projects.topics.delete",
  4807. // "parameterOrder": [
  4808. // "topic"
  4809. // ],
  4810. // "parameters": {
  4811. // "topic": {
  4812. // "description": "Name of the topic to delete.\nFormat is `projects/{project}/topics/{topic}`.",
  4813. // "location": "path",
  4814. // "pattern": "^projects/[^/]+/topics/[^/]+$",
  4815. // "required": true,
  4816. // "type": "string"
  4817. // }
  4818. // },
  4819. // "path": "v1/{+topic}",
  4820. // "response": {
  4821. // "$ref": "Empty"
  4822. // },
  4823. // "scopes": [
  4824. // "https://www.googleapis.com/auth/cloud-platform",
  4825. // "https://www.googleapis.com/auth/pubsub"
  4826. // ]
  4827. // }
  4828. }
  4829. // method id "pubsub.projects.topics.get":
  4830. type ProjectsTopicsGetCall struct {
  4831. s *Service
  4832. topic string
  4833. urlParams_ gensupport.URLParams
  4834. ifNoneMatch_ string
  4835. ctx_ context.Context
  4836. header_ http.Header
  4837. }
  4838. // Get: Gets the configuration of a topic.
  4839. func (r *ProjectsTopicsService) Get(topic string) *ProjectsTopicsGetCall {
  4840. c := &ProjectsTopicsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4841. c.topic = topic
  4842. return c
  4843. }
  4844. // Fields allows partial responses to be retrieved. See
  4845. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4846. // for more information.
  4847. func (c *ProjectsTopicsGetCall) Fields(s ...googleapi.Field) *ProjectsTopicsGetCall {
  4848. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4849. return c
  4850. }
  4851. // IfNoneMatch sets the optional parameter which makes the operation
  4852. // fail if the object's ETag matches the given value. This is useful for
  4853. // getting updates only after the object has changed since the last
  4854. // request. Use googleapi.IsNotModified to check whether the response
  4855. // error from Do is the result of In-None-Match.
  4856. func (c *ProjectsTopicsGetCall) IfNoneMatch(entityTag string) *ProjectsTopicsGetCall {
  4857. c.ifNoneMatch_ = entityTag
  4858. return c
  4859. }
  4860. // Context sets the context to be used in this call's Do method. Any
  4861. // pending HTTP request will be aborted if the provided context is
  4862. // canceled.
  4863. func (c *ProjectsTopicsGetCall) Context(ctx context.Context) *ProjectsTopicsGetCall {
  4864. c.ctx_ = ctx
  4865. return c
  4866. }
  4867. // Header returns an http.Header that can be modified by the caller to
  4868. // add HTTP headers to the request.
  4869. func (c *ProjectsTopicsGetCall) Header() http.Header {
  4870. if c.header_ == nil {
  4871. c.header_ = make(http.Header)
  4872. }
  4873. return c.header_
  4874. }
  4875. func (c *ProjectsTopicsGetCall) doRequest(alt string) (*http.Response, error) {
  4876. reqHeaders := make(http.Header)
  4877. for k, v := range c.header_ {
  4878. reqHeaders[k] = v
  4879. }
  4880. reqHeaders.Set("User-Agent", c.s.userAgent())
  4881. if c.ifNoneMatch_ != "" {
  4882. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4883. }
  4884. var body io.Reader = nil
  4885. c.urlParams_.Set("alt", alt)
  4886. c.urlParams_.Set("prettyPrint", "false")
  4887. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+topic}")
  4888. urls += "?" + c.urlParams_.Encode()
  4889. req, err := http.NewRequest("GET", urls, body)
  4890. if err != nil {
  4891. return nil, err
  4892. }
  4893. req.Header = reqHeaders
  4894. googleapi.Expand(req.URL, map[string]string{
  4895. "topic": c.topic,
  4896. })
  4897. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4898. }
  4899. // Do executes the "pubsub.projects.topics.get" call.
  4900. // Exactly one of *Topic or error will be non-nil. Any non-2xx status
  4901. // code is an error. Response headers are in either
  4902. // *Topic.ServerResponse.Header or (if a response was returned at all)
  4903. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4904. // check whether the returned error was because http.StatusNotModified
  4905. // was returned.
  4906. func (c *ProjectsTopicsGetCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
  4907. gensupport.SetOptions(c.urlParams_, opts...)
  4908. res, err := c.doRequest("json")
  4909. if res != nil && res.StatusCode == http.StatusNotModified {
  4910. if res.Body != nil {
  4911. res.Body.Close()
  4912. }
  4913. return nil, &googleapi.Error{
  4914. Code: res.StatusCode,
  4915. Header: res.Header,
  4916. }
  4917. }
  4918. if err != nil {
  4919. return nil, err
  4920. }
  4921. defer googleapi.CloseBody(res)
  4922. if err := googleapi.CheckResponse(res); err != nil {
  4923. return nil, err
  4924. }
  4925. ret := &Topic{
  4926. ServerResponse: googleapi.ServerResponse{
  4927. Header: res.Header,
  4928. HTTPStatusCode: res.StatusCode,
  4929. },
  4930. }
  4931. target := &ret
  4932. if err := gensupport.DecodeResponse(target, res); err != nil {
  4933. return nil, err
  4934. }
  4935. return ret, nil
  4936. // {
  4937. // "description": "Gets the configuration of a topic.",
  4938. // "flatPath": "v1/projects/{projectsId}/topics/{topicsId}",
  4939. // "httpMethod": "GET",
  4940. // "id": "pubsub.projects.topics.get",
  4941. // "parameterOrder": [
  4942. // "topic"
  4943. // ],
  4944. // "parameters": {
  4945. // "topic": {
  4946. // "description": "The name of the topic to get.\nFormat is `projects/{project}/topics/{topic}`.",
  4947. // "location": "path",
  4948. // "pattern": "^projects/[^/]+/topics/[^/]+$",
  4949. // "required": true,
  4950. // "type": "string"
  4951. // }
  4952. // },
  4953. // "path": "v1/{+topic}",
  4954. // "response": {
  4955. // "$ref": "Topic"
  4956. // },
  4957. // "scopes": [
  4958. // "https://www.googleapis.com/auth/cloud-platform",
  4959. // "https://www.googleapis.com/auth/pubsub"
  4960. // ]
  4961. // }
  4962. }
  4963. // method id "pubsub.projects.topics.getIamPolicy":
  4964. type ProjectsTopicsGetIamPolicyCall struct {
  4965. s *Service
  4966. resource string
  4967. urlParams_ gensupport.URLParams
  4968. ifNoneMatch_ string
  4969. ctx_ context.Context
  4970. header_ http.Header
  4971. }
  4972. // GetIamPolicy: Gets the access control policy for a resource.
  4973. // Returns an empty policy if the resource exists and does not have a
  4974. // policy
  4975. // set.
  4976. func (r *ProjectsTopicsService) GetIamPolicy(resource string) *ProjectsTopicsGetIamPolicyCall {
  4977. c := &ProjectsTopicsGetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4978. c.resource = resource
  4979. return c
  4980. }
  4981. // Fields allows partial responses to be retrieved. See
  4982. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4983. // for more information.
  4984. func (c *ProjectsTopicsGetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsTopicsGetIamPolicyCall {
  4985. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4986. return c
  4987. }
  4988. // IfNoneMatch sets the optional parameter which makes the operation
  4989. // fail if the object's ETag matches the given value. This is useful for
  4990. // getting updates only after the object has changed since the last
  4991. // request. Use googleapi.IsNotModified to check whether the response
  4992. // error from Do is the result of In-None-Match.
  4993. func (c *ProjectsTopicsGetIamPolicyCall) IfNoneMatch(entityTag string) *ProjectsTopicsGetIamPolicyCall {
  4994. c.ifNoneMatch_ = entityTag
  4995. return c
  4996. }
  4997. // Context sets the context to be used in this call's Do method. Any
  4998. // pending HTTP request will be aborted if the provided context is
  4999. // canceled.
  5000. func (c *ProjectsTopicsGetIamPolicyCall) Context(ctx context.Context) *ProjectsTopicsGetIamPolicyCall {
  5001. c.ctx_ = ctx
  5002. return c
  5003. }
  5004. // Header returns an http.Header that can be modified by the caller to
  5005. // add HTTP headers to the request.
  5006. func (c *ProjectsTopicsGetIamPolicyCall) Header() http.Header {
  5007. if c.header_ == nil {
  5008. c.header_ = make(http.Header)
  5009. }
  5010. return c.header_
  5011. }
  5012. func (c *ProjectsTopicsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  5013. reqHeaders := make(http.Header)
  5014. for k, v := range c.header_ {
  5015. reqHeaders[k] = v
  5016. }
  5017. reqHeaders.Set("User-Agent", c.s.userAgent())
  5018. if c.ifNoneMatch_ != "" {
  5019. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5020. }
  5021. var body io.Reader = nil
  5022. c.urlParams_.Set("alt", alt)
  5023. c.urlParams_.Set("prettyPrint", "false")
  5024. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:getIamPolicy")
  5025. urls += "?" + c.urlParams_.Encode()
  5026. req, err := http.NewRequest("GET", urls, body)
  5027. if err != nil {
  5028. return nil, err
  5029. }
  5030. req.Header = reqHeaders
  5031. googleapi.Expand(req.URL, map[string]string{
  5032. "resource": c.resource,
  5033. })
  5034. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5035. }
  5036. // Do executes the "pubsub.projects.topics.getIamPolicy" call.
  5037. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  5038. // code is an error. Response headers are in either
  5039. // *Policy.ServerResponse.Header or (if a response was returned at all)
  5040. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5041. // check whether the returned error was because http.StatusNotModified
  5042. // was returned.
  5043. func (c *ProjectsTopicsGetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  5044. gensupport.SetOptions(c.urlParams_, opts...)
  5045. res, err := c.doRequest("json")
  5046. if res != nil && res.StatusCode == http.StatusNotModified {
  5047. if res.Body != nil {
  5048. res.Body.Close()
  5049. }
  5050. return nil, &googleapi.Error{
  5051. Code: res.StatusCode,
  5052. Header: res.Header,
  5053. }
  5054. }
  5055. if err != nil {
  5056. return nil, err
  5057. }
  5058. defer googleapi.CloseBody(res)
  5059. if err := googleapi.CheckResponse(res); err != nil {
  5060. return nil, err
  5061. }
  5062. ret := &Policy{
  5063. ServerResponse: googleapi.ServerResponse{
  5064. Header: res.Header,
  5065. HTTPStatusCode: res.StatusCode,
  5066. },
  5067. }
  5068. target := &ret
  5069. if err := gensupport.DecodeResponse(target, res); err != nil {
  5070. return nil, err
  5071. }
  5072. return ret, nil
  5073. // {
  5074. // "description": "Gets the access control policy for a resource.\nReturns an empty policy if the resource exists and does not have a policy\nset.",
  5075. // "flatPath": "v1/projects/{projectsId}/topics/{topicsId}:getIamPolicy",
  5076. // "httpMethod": "GET",
  5077. // "id": "pubsub.projects.topics.getIamPolicy",
  5078. // "parameterOrder": [
  5079. // "resource"
  5080. // ],
  5081. // "parameters": {
  5082. // "resource": {
  5083. // "description": "REQUIRED: The resource for which the policy is being requested.\nSee the operation documentation for the appropriate value for this field.",
  5084. // "location": "path",
  5085. // "pattern": "^projects/[^/]+/topics/[^/]+$",
  5086. // "required": true,
  5087. // "type": "string"
  5088. // }
  5089. // },
  5090. // "path": "v1/{+resource}:getIamPolicy",
  5091. // "response": {
  5092. // "$ref": "Policy"
  5093. // },
  5094. // "scopes": [
  5095. // "https://www.googleapis.com/auth/cloud-platform",
  5096. // "https://www.googleapis.com/auth/pubsub"
  5097. // ]
  5098. // }
  5099. }
  5100. // method id "pubsub.projects.topics.list":
  5101. type ProjectsTopicsListCall struct {
  5102. s *Service
  5103. project string
  5104. urlParams_ gensupport.URLParams
  5105. ifNoneMatch_ string
  5106. ctx_ context.Context
  5107. header_ http.Header
  5108. }
  5109. // List: Lists matching topics.
  5110. func (r *ProjectsTopicsService) List(project string) *ProjectsTopicsListCall {
  5111. c := &ProjectsTopicsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5112. c.project = project
  5113. return c
  5114. }
  5115. // PageSize sets the optional parameter "pageSize": Maximum number of
  5116. // topics to return.
  5117. func (c *ProjectsTopicsListCall) PageSize(pageSize int64) *ProjectsTopicsListCall {
  5118. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5119. return c
  5120. }
  5121. // PageToken sets the optional parameter "pageToken": The value returned
  5122. // by the last `ListTopicsResponse`; indicates that this is
  5123. // a continuation of a prior `ListTopics` call, and that the system
  5124. // should
  5125. // return the next page of data.
  5126. func (c *ProjectsTopicsListCall) PageToken(pageToken string) *ProjectsTopicsListCall {
  5127. c.urlParams_.Set("pageToken", pageToken)
  5128. return c
  5129. }
  5130. // Fields allows partial responses to be retrieved. See
  5131. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5132. // for more information.
  5133. func (c *ProjectsTopicsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsListCall {
  5134. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5135. return c
  5136. }
  5137. // IfNoneMatch sets the optional parameter which makes the operation
  5138. // fail if the object's ETag matches the given value. This is useful for
  5139. // getting updates only after the object has changed since the last
  5140. // request. Use googleapi.IsNotModified to check whether the response
  5141. // error from Do is the result of In-None-Match.
  5142. func (c *ProjectsTopicsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsListCall {
  5143. c.ifNoneMatch_ = entityTag
  5144. return c
  5145. }
  5146. // Context sets the context to be used in this call's Do method. Any
  5147. // pending HTTP request will be aborted if the provided context is
  5148. // canceled.
  5149. func (c *ProjectsTopicsListCall) Context(ctx context.Context) *ProjectsTopicsListCall {
  5150. c.ctx_ = ctx
  5151. return c
  5152. }
  5153. // Header returns an http.Header that can be modified by the caller to
  5154. // add HTTP headers to the request.
  5155. func (c *ProjectsTopicsListCall) Header() http.Header {
  5156. if c.header_ == nil {
  5157. c.header_ = make(http.Header)
  5158. }
  5159. return c.header_
  5160. }
  5161. func (c *ProjectsTopicsListCall) doRequest(alt string) (*http.Response, error) {
  5162. reqHeaders := make(http.Header)
  5163. for k, v := range c.header_ {
  5164. reqHeaders[k] = v
  5165. }
  5166. reqHeaders.Set("User-Agent", c.s.userAgent())
  5167. if c.ifNoneMatch_ != "" {
  5168. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5169. }
  5170. var body io.Reader = nil
  5171. c.urlParams_.Set("alt", alt)
  5172. c.urlParams_.Set("prettyPrint", "false")
  5173. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+project}/topics")
  5174. urls += "?" + c.urlParams_.Encode()
  5175. req, err := http.NewRequest("GET", urls, body)
  5176. if err != nil {
  5177. return nil, err
  5178. }
  5179. req.Header = reqHeaders
  5180. googleapi.Expand(req.URL, map[string]string{
  5181. "project": c.project,
  5182. })
  5183. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5184. }
  5185. // Do executes the "pubsub.projects.topics.list" call.
  5186. // Exactly one of *ListTopicsResponse or error will be non-nil. Any
  5187. // non-2xx status code is an error. Response headers are in either
  5188. // *ListTopicsResponse.ServerResponse.Header or (if a response was
  5189. // returned at all) in error.(*googleapi.Error).Header. Use
  5190. // googleapi.IsNotModified to check whether the returned error was
  5191. // because http.StatusNotModified was returned.
  5192. func (c *ProjectsTopicsListCall) Do(opts ...googleapi.CallOption) (*ListTopicsResponse, error) {
  5193. gensupport.SetOptions(c.urlParams_, opts...)
  5194. res, err := c.doRequest("json")
  5195. if res != nil && res.StatusCode == http.StatusNotModified {
  5196. if res.Body != nil {
  5197. res.Body.Close()
  5198. }
  5199. return nil, &googleapi.Error{
  5200. Code: res.StatusCode,
  5201. Header: res.Header,
  5202. }
  5203. }
  5204. if err != nil {
  5205. return nil, err
  5206. }
  5207. defer googleapi.CloseBody(res)
  5208. if err := googleapi.CheckResponse(res); err != nil {
  5209. return nil, err
  5210. }
  5211. ret := &ListTopicsResponse{
  5212. ServerResponse: googleapi.ServerResponse{
  5213. Header: res.Header,
  5214. HTTPStatusCode: res.StatusCode,
  5215. },
  5216. }
  5217. target := &ret
  5218. if err := gensupport.DecodeResponse(target, res); err != nil {
  5219. return nil, err
  5220. }
  5221. return ret, nil
  5222. // {
  5223. // "description": "Lists matching topics.",
  5224. // "flatPath": "v1/projects/{projectsId}/topics",
  5225. // "httpMethod": "GET",
  5226. // "id": "pubsub.projects.topics.list",
  5227. // "parameterOrder": [
  5228. // "project"
  5229. // ],
  5230. // "parameters": {
  5231. // "pageSize": {
  5232. // "description": "Maximum number of topics to return.",
  5233. // "format": "int32",
  5234. // "location": "query",
  5235. // "type": "integer"
  5236. // },
  5237. // "pageToken": {
  5238. // "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.",
  5239. // "location": "query",
  5240. // "type": "string"
  5241. // },
  5242. // "project": {
  5243. // "description": "The name of the project in which to list topics.\nFormat is `projects/{project-id}`.",
  5244. // "location": "path",
  5245. // "pattern": "^projects/[^/]+$",
  5246. // "required": true,
  5247. // "type": "string"
  5248. // }
  5249. // },
  5250. // "path": "v1/{+project}/topics",
  5251. // "response": {
  5252. // "$ref": "ListTopicsResponse"
  5253. // },
  5254. // "scopes": [
  5255. // "https://www.googleapis.com/auth/cloud-platform",
  5256. // "https://www.googleapis.com/auth/pubsub"
  5257. // ]
  5258. // }
  5259. }
  5260. // Pages invokes f for each page of results.
  5261. // A non-nil error returned from f will halt the iteration.
  5262. // The provided context supersedes any context provided to the Context method.
  5263. func (c *ProjectsTopicsListCall) Pages(ctx context.Context, f func(*ListTopicsResponse) error) error {
  5264. c.ctx_ = ctx
  5265. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5266. for {
  5267. x, err := c.Do()
  5268. if err != nil {
  5269. return err
  5270. }
  5271. if err := f(x); err != nil {
  5272. return err
  5273. }
  5274. if x.NextPageToken == "" {
  5275. return nil
  5276. }
  5277. c.PageToken(x.NextPageToken)
  5278. }
  5279. }
  5280. // method id "pubsub.projects.topics.patch":
  5281. type ProjectsTopicsPatchCall struct {
  5282. s *Service
  5283. name string
  5284. updatetopicrequest *UpdateTopicRequest
  5285. urlParams_ gensupport.URLParams
  5286. ctx_ context.Context
  5287. header_ http.Header
  5288. }
  5289. // Patch: Updates an existing topic. Note that certain properties of
  5290. // a
  5291. // topic are not modifiable.
  5292. func (r *ProjectsTopicsService) Patch(name string, updatetopicrequest *UpdateTopicRequest) *ProjectsTopicsPatchCall {
  5293. c := &ProjectsTopicsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5294. c.name = name
  5295. c.updatetopicrequest = updatetopicrequest
  5296. return c
  5297. }
  5298. // Fields allows partial responses to be retrieved. See
  5299. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5300. // for more information.
  5301. func (c *ProjectsTopicsPatchCall) Fields(s ...googleapi.Field) *ProjectsTopicsPatchCall {
  5302. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5303. return c
  5304. }
  5305. // Context sets the context to be used in this call's Do method. Any
  5306. // pending HTTP request will be aborted if the provided context is
  5307. // canceled.
  5308. func (c *ProjectsTopicsPatchCall) Context(ctx context.Context) *ProjectsTopicsPatchCall {
  5309. c.ctx_ = ctx
  5310. return c
  5311. }
  5312. // Header returns an http.Header that can be modified by the caller to
  5313. // add HTTP headers to the request.
  5314. func (c *ProjectsTopicsPatchCall) Header() http.Header {
  5315. if c.header_ == nil {
  5316. c.header_ = make(http.Header)
  5317. }
  5318. return c.header_
  5319. }
  5320. func (c *ProjectsTopicsPatchCall) doRequest(alt string) (*http.Response, error) {
  5321. reqHeaders := make(http.Header)
  5322. for k, v := range c.header_ {
  5323. reqHeaders[k] = v
  5324. }
  5325. reqHeaders.Set("User-Agent", c.s.userAgent())
  5326. var body io.Reader = nil
  5327. body, err := googleapi.WithoutDataWrapper.JSONReader(c.updatetopicrequest)
  5328. if err != nil {
  5329. return nil, err
  5330. }
  5331. reqHeaders.Set("Content-Type", "application/json")
  5332. c.urlParams_.Set("alt", alt)
  5333. c.urlParams_.Set("prettyPrint", "false")
  5334. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}")
  5335. urls += "?" + c.urlParams_.Encode()
  5336. req, err := http.NewRequest("PATCH", urls, body)
  5337. if err != nil {
  5338. return nil, err
  5339. }
  5340. req.Header = reqHeaders
  5341. googleapi.Expand(req.URL, map[string]string{
  5342. "name": c.name,
  5343. })
  5344. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5345. }
  5346. // Do executes the "pubsub.projects.topics.patch" call.
  5347. // Exactly one of *Topic or error will be non-nil. Any non-2xx status
  5348. // code is an error. Response headers are in either
  5349. // *Topic.ServerResponse.Header or (if a response was returned at all)
  5350. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5351. // check whether the returned error was because http.StatusNotModified
  5352. // was returned.
  5353. func (c *ProjectsTopicsPatchCall) Do(opts ...googleapi.CallOption) (*Topic, error) {
  5354. gensupport.SetOptions(c.urlParams_, opts...)
  5355. res, err := c.doRequest("json")
  5356. if res != nil && res.StatusCode == http.StatusNotModified {
  5357. if res.Body != nil {
  5358. res.Body.Close()
  5359. }
  5360. return nil, &googleapi.Error{
  5361. Code: res.StatusCode,
  5362. Header: res.Header,
  5363. }
  5364. }
  5365. if err != nil {
  5366. return nil, err
  5367. }
  5368. defer googleapi.CloseBody(res)
  5369. if err := googleapi.CheckResponse(res); err != nil {
  5370. return nil, err
  5371. }
  5372. ret := &Topic{
  5373. ServerResponse: googleapi.ServerResponse{
  5374. Header: res.Header,
  5375. HTTPStatusCode: res.StatusCode,
  5376. },
  5377. }
  5378. target := &ret
  5379. if err := gensupport.DecodeResponse(target, res); err != nil {
  5380. return nil, err
  5381. }
  5382. return ret, nil
  5383. // {
  5384. // "description": "Updates an existing topic. Note that certain properties of a\ntopic are not modifiable.",
  5385. // "flatPath": "v1/projects/{projectsId}/topics/{topicsId}",
  5386. // "httpMethod": "PATCH",
  5387. // "id": "pubsub.projects.topics.patch",
  5388. // "parameterOrder": [
  5389. // "name"
  5390. // ],
  5391. // "parameters": {
  5392. // "name": {
  5393. // "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\"`.",
  5394. // "location": "path",
  5395. // "pattern": "^projects/[^/]+/topics/[^/]+$",
  5396. // "required": true,
  5397. // "type": "string"
  5398. // }
  5399. // },
  5400. // "path": "v1/{+name}",
  5401. // "request": {
  5402. // "$ref": "UpdateTopicRequest"
  5403. // },
  5404. // "response": {
  5405. // "$ref": "Topic"
  5406. // },
  5407. // "scopes": [
  5408. // "https://www.googleapis.com/auth/cloud-platform",
  5409. // "https://www.googleapis.com/auth/pubsub"
  5410. // ]
  5411. // }
  5412. }
  5413. // method id "pubsub.projects.topics.publish":
  5414. type ProjectsTopicsPublishCall struct {
  5415. s *Service
  5416. topic string
  5417. publishrequest *PublishRequest
  5418. urlParams_ gensupport.URLParams
  5419. ctx_ context.Context
  5420. header_ http.Header
  5421. }
  5422. // Publish: Adds one or more messages to the topic. Returns `NOT_FOUND`
  5423. // if the topic
  5424. // does not exist.
  5425. func (r *ProjectsTopicsService) Publish(topic string, publishrequest *PublishRequest) *ProjectsTopicsPublishCall {
  5426. c := &ProjectsTopicsPublishCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5427. c.topic = topic
  5428. c.publishrequest = publishrequest
  5429. return c
  5430. }
  5431. // Fields allows partial responses to be retrieved. See
  5432. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5433. // for more information.
  5434. func (c *ProjectsTopicsPublishCall) Fields(s ...googleapi.Field) *ProjectsTopicsPublishCall {
  5435. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5436. return c
  5437. }
  5438. // Context sets the context to be used in this call's Do method. Any
  5439. // pending HTTP request will be aborted if the provided context is
  5440. // canceled.
  5441. func (c *ProjectsTopicsPublishCall) Context(ctx context.Context) *ProjectsTopicsPublishCall {
  5442. c.ctx_ = ctx
  5443. return c
  5444. }
  5445. // Header returns an http.Header that can be modified by the caller to
  5446. // add HTTP headers to the request.
  5447. func (c *ProjectsTopicsPublishCall) Header() http.Header {
  5448. if c.header_ == nil {
  5449. c.header_ = make(http.Header)
  5450. }
  5451. return c.header_
  5452. }
  5453. func (c *ProjectsTopicsPublishCall) doRequest(alt string) (*http.Response, error) {
  5454. reqHeaders := make(http.Header)
  5455. for k, v := range c.header_ {
  5456. reqHeaders[k] = v
  5457. }
  5458. reqHeaders.Set("User-Agent", c.s.userAgent())
  5459. var body io.Reader = nil
  5460. body, err := googleapi.WithoutDataWrapper.JSONReader(c.publishrequest)
  5461. if err != nil {
  5462. return nil, err
  5463. }
  5464. reqHeaders.Set("Content-Type", "application/json")
  5465. c.urlParams_.Set("alt", alt)
  5466. c.urlParams_.Set("prettyPrint", "false")
  5467. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+topic}:publish")
  5468. urls += "?" + c.urlParams_.Encode()
  5469. req, err := http.NewRequest("POST", urls, body)
  5470. if err != nil {
  5471. return nil, err
  5472. }
  5473. req.Header = reqHeaders
  5474. googleapi.Expand(req.URL, map[string]string{
  5475. "topic": c.topic,
  5476. })
  5477. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5478. }
  5479. // Do executes the "pubsub.projects.topics.publish" call.
  5480. // Exactly one of *PublishResponse or error will be non-nil. Any non-2xx
  5481. // status code is an error. Response headers are in either
  5482. // *PublishResponse.ServerResponse.Header or (if a response was returned
  5483. // at all) in error.(*googleapi.Error).Header. Use
  5484. // googleapi.IsNotModified to check whether the returned error was
  5485. // because http.StatusNotModified was returned.
  5486. func (c *ProjectsTopicsPublishCall) Do(opts ...googleapi.CallOption) (*PublishResponse, error) {
  5487. gensupport.SetOptions(c.urlParams_, opts...)
  5488. res, err := c.doRequest("json")
  5489. if res != nil && res.StatusCode == http.StatusNotModified {
  5490. if res.Body != nil {
  5491. res.Body.Close()
  5492. }
  5493. return nil, &googleapi.Error{
  5494. Code: res.StatusCode,
  5495. Header: res.Header,
  5496. }
  5497. }
  5498. if err != nil {
  5499. return nil, err
  5500. }
  5501. defer googleapi.CloseBody(res)
  5502. if err := googleapi.CheckResponse(res); err != nil {
  5503. return nil, err
  5504. }
  5505. ret := &PublishResponse{
  5506. ServerResponse: googleapi.ServerResponse{
  5507. Header: res.Header,
  5508. HTTPStatusCode: res.StatusCode,
  5509. },
  5510. }
  5511. target := &ret
  5512. if err := gensupport.DecodeResponse(target, res); err != nil {
  5513. return nil, err
  5514. }
  5515. return ret, nil
  5516. // {
  5517. // "description": "Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic\ndoes not exist.",
  5518. // "flatPath": "v1/projects/{projectsId}/topics/{topicsId}:publish",
  5519. // "httpMethod": "POST",
  5520. // "id": "pubsub.projects.topics.publish",
  5521. // "parameterOrder": [
  5522. // "topic"
  5523. // ],
  5524. // "parameters": {
  5525. // "topic": {
  5526. // "description": "The messages in the request will be published on this topic.\nFormat is `projects/{project}/topics/{topic}`.",
  5527. // "location": "path",
  5528. // "pattern": "^projects/[^/]+/topics/[^/]+$",
  5529. // "required": true,
  5530. // "type": "string"
  5531. // }
  5532. // },
  5533. // "path": "v1/{+topic}:publish",
  5534. // "request": {
  5535. // "$ref": "PublishRequest"
  5536. // },
  5537. // "response": {
  5538. // "$ref": "PublishResponse"
  5539. // },
  5540. // "scopes": [
  5541. // "https://www.googleapis.com/auth/cloud-platform",
  5542. // "https://www.googleapis.com/auth/pubsub"
  5543. // ]
  5544. // }
  5545. }
  5546. // method id "pubsub.projects.topics.setIamPolicy":
  5547. type ProjectsTopicsSetIamPolicyCall struct {
  5548. s *Service
  5549. resource string
  5550. setiampolicyrequest *SetIamPolicyRequest
  5551. urlParams_ gensupport.URLParams
  5552. ctx_ context.Context
  5553. header_ http.Header
  5554. }
  5555. // SetIamPolicy: Sets the access control policy on the specified
  5556. // resource. Replaces any
  5557. // existing policy.
  5558. func (r *ProjectsTopicsService) SetIamPolicy(resource string, setiampolicyrequest *SetIamPolicyRequest) *ProjectsTopicsSetIamPolicyCall {
  5559. c := &ProjectsTopicsSetIamPolicyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5560. c.resource = resource
  5561. c.setiampolicyrequest = setiampolicyrequest
  5562. return c
  5563. }
  5564. // Fields allows partial responses to be retrieved. See
  5565. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5566. // for more information.
  5567. func (c *ProjectsTopicsSetIamPolicyCall) Fields(s ...googleapi.Field) *ProjectsTopicsSetIamPolicyCall {
  5568. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5569. return c
  5570. }
  5571. // Context sets the context to be used in this call's Do method. Any
  5572. // pending HTTP request will be aborted if the provided context is
  5573. // canceled.
  5574. func (c *ProjectsTopicsSetIamPolicyCall) Context(ctx context.Context) *ProjectsTopicsSetIamPolicyCall {
  5575. c.ctx_ = ctx
  5576. return c
  5577. }
  5578. // Header returns an http.Header that can be modified by the caller to
  5579. // add HTTP headers to the request.
  5580. func (c *ProjectsTopicsSetIamPolicyCall) Header() http.Header {
  5581. if c.header_ == nil {
  5582. c.header_ = make(http.Header)
  5583. }
  5584. return c.header_
  5585. }
  5586. func (c *ProjectsTopicsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) {
  5587. reqHeaders := make(http.Header)
  5588. for k, v := range c.header_ {
  5589. reqHeaders[k] = v
  5590. }
  5591. reqHeaders.Set("User-Agent", c.s.userAgent())
  5592. var body io.Reader = nil
  5593. body, err := googleapi.WithoutDataWrapper.JSONReader(c.setiampolicyrequest)
  5594. if err != nil {
  5595. return nil, err
  5596. }
  5597. reqHeaders.Set("Content-Type", "application/json")
  5598. c.urlParams_.Set("alt", alt)
  5599. c.urlParams_.Set("prettyPrint", "false")
  5600. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:setIamPolicy")
  5601. urls += "?" + c.urlParams_.Encode()
  5602. req, err := http.NewRequest("POST", urls, body)
  5603. if err != nil {
  5604. return nil, err
  5605. }
  5606. req.Header = reqHeaders
  5607. googleapi.Expand(req.URL, map[string]string{
  5608. "resource": c.resource,
  5609. })
  5610. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5611. }
  5612. // Do executes the "pubsub.projects.topics.setIamPolicy" call.
  5613. // Exactly one of *Policy or error will be non-nil. Any non-2xx status
  5614. // code is an error. Response headers are in either
  5615. // *Policy.ServerResponse.Header or (if a response was returned at all)
  5616. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5617. // check whether the returned error was because http.StatusNotModified
  5618. // was returned.
  5619. func (c *ProjectsTopicsSetIamPolicyCall) Do(opts ...googleapi.CallOption) (*Policy, error) {
  5620. gensupport.SetOptions(c.urlParams_, opts...)
  5621. res, err := c.doRequest("json")
  5622. if res != nil && res.StatusCode == http.StatusNotModified {
  5623. if res.Body != nil {
  5624. res.Body.Close()
  5625. }
  5626. return nil, &googleapi.Error{
  5627. Code: res.StatusCode,
  5628. Header: res.Header,
  5629. }
  5630. }
  5631. if err != nil {
  5632. return nil, err
  5633. }
  5634. defer googleapi.CloseBody(res)
  5635. if err := googleapi.CheckResponse(res); err != nil {
  5636. return nil, err
  5637. }
  5638. ret := &Policy{
  5639. ServerResponse: googleapi.ServerResponse{
  5640. Header: res.Header,
  5641. HTTPStatusCode: res.StatusCode,
  5642. },
  5643. }
  5644. target := &ret
  5645. if err := gensupport.DecodeResponse(target, res); err != nil {
  5646. return nil, err
  5647. }
  5648. return ret, nil
  5649. // {
  5650. // "description": "Sets the access control policy on the specified resource. Replaces any\nexisting policy.",
  5651. // "flatPath": "v1/projects/{projectsId}/topics/{topicsId}:setIamPolicy",
  5652. // "httpMethod": "POST",
  5653. // "id": "pubsub.projects.topics.setIamPolicy",
  5654. // "parameterOrder": [
  5655. // "resource"
  5656. // ],
  5657. // "parameters": {
  5658. // "resource": {
  5659. // "description": "REQUIRED: The resource for which the policy is being specified.\nSee the operation documentation for the appropriate value for this field.",
  5660. // "location": "path",
  5661. // "pattern": "^projects/[^/]+/topics/[^/]+$",
  5662. // "required": true,
  5663. // "type": "string"
  5664. // }
  5665. // },
  5666. // "path": "v1/{+resource}:setIamPolicy",
  5667. // "request": {
  5668. // "$ref": "SetIamPolicyRequest"
  5669. // },
  5670. // "response": {
  5671. // "$ref": "Policy"
  5672. // },
  5673. // "scopes": [
  5674. // "https://www.googleapis.com/auth/cloud-platform",
  5675. // "https://www.googleapis.com/auth/pubsub"
  5676. // ]
  5677. // }
  5678. }
  5679. // method id "pubsub.projects.topics.testIamPermissions":
  5680. type ProjectsTopicsTestIamPermissionsCall struct {
  5681. s *Service
  5682. resource string
  5683. testiampermissionsrequest *TestIamPermissionsRequest
  5684. urlParams_ gensupport.URLParams
  5685. ctx_ context.Context
  5686. header_ http.Header
  5687. }
  5688. // TestIamPermissions: Returns permissions that a caller has on the
  5689. // specified resource.
  5690. // If the resource does not exist, this will return an empty set
  5691. // of
  5692. // permissions, not a NOT_FOUND error.
  5693. //
  5694. // Note: This operation is designed to be used for building
  5695. // permission-aware
  5696. // UIs and command-line tools, not for authorization checking. This
  5697. // operation
  5698. // may "fail open" without warning.
  5699. func (r *ProjectsTopicsService) TestIamPermissions(resource string, testiampermissionsrequest *TestIamPermissionsRequest) *ProjectsTopicsTestIamPermissionsCall {
  5700. c := &ProjectsTopicsTestIamPermissionsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5701. c.resource = resource
  5702. c.testiampermissionsrequest = testiampermissionsrequest
  5703. return c
  5704. }
  5705. // Fields allows partial responses to be retrieved. See
  5706. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5707. // for more information.
  5708. func (c *ProjectsTopicsTestIamPermissionsCall) Fields(s ...googleapi.Field) *ProjectsTopicsTestIamPermissionsCall {
  5709. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5710. return c
  5711. }
  5712. // Context sets the context to be used in this call's Do method. Any
  5713. // pending HTTP request will be aborted if the provided context is
  5714. // canceled.
  5715. func (c *ProjectsTopicsTestIamPermissionsCall) Context(ctx context.Context) *ProjectsTopicsTestIamPermissionsCall {
  5716. c.ctx_ = ctx
  5717. return c
  5718. }
  5719. // Header returns an http.Header that can be modified by the caller to
  5720. // add HTTP headers to the request.
  5721. func (c *ProjectsTopicsTestIamPermissionsCall) Header() http.Header {
  5722. if c.header_ == nil {
  5723. c.header_ = make(http.Header)
  5724. }
  5725. return c.header_
  5726. }
  5727. func (c *ProjectsTopicsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) {
  5728. reqHeaders := make(http.Header)
  5729. for k, v := range c.header_ {
  5730. reqHeaders[k] = v
  5731. }
  5732. reqHeaders.Set("User-Agent", c.s.userAgent())
  5733. var body io.Reader = nil
  5734. body, err := googleapi.WithoutDataWrapper.JSONReader(c.testiampermissionsrequest)
  5735. if err != nil {
  5736. return nil, err
  5737. }
  5738. reqHeaders.Set("Content-Type", "application/json")
  5739. c.urlParams_.Set("alt", alt)
  5740. c.urlParams_.Set("prettyPrint", "false")
  5741. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+resource}:testIamPermissions")
  5742. urls += "?" + c.urlParams_.Encode()
  5743. req, err := http.NewRequest("POST", urls, body)
  5744. if err != nil {
  5745. return nil, err
  5746. }
  5747. req.Header = reqHeaders
  5748. googleapi.Expand(req.URL, map[string]string{
  5749. "resource": c.resource,
  5750. })
  5751. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5752. }
  5753. // Do executes the "pubsub.projects.topics.testIamPermissions" call.
  5754. // Exactly one of *TestIamPermissionsResponse or error will be non-nil.
  5755. // Any non-2xx status code is an error. Response headers are in either
  5756. // *TestIamPermissionsResponse.ServerResponse.Header or (if a response
  5757. // was returned at all) in error.(*googleapi.Error).Header. Use
  5758. // googleapi.IsNotModified to check whether the returned error was
  5759. // because http.StatusNotModified was returned.
  5760. func (c *ProjectsTopicsTestIamPermissionsCall) Do(opts ...googleapi.CallOption) (*TestIamPermissionsResponse, error) {
  5761. gensupport.SetOptions(c.urlParams_, opts...)
  5762. res, err := c.doRequest("json")
  5763. if res != nil && res.StatusCode == http.StatusNotModified {
  5764. if res.Body != nil {
  5765. res.Body.Close()
  5766. }
  5767. return nil, &googleapi.Error{
  5768. Code: res.StatusCode,
  5769. Header: res.Header,
  5770. }
  5771. }
  5772. if err != nil {
  5773. return nil, err
  5774. }
  5775. defer googleapi.CloseBody(res)
  5776. if err := googleapi.CheckResponse(res); err != nil {
  5777. return nil, err
  5778. }
  5779. ret := &TestIamPermissionsResponse{
  5780. ServerResponse: googleapi.ServerResponse{
  5781. Header: res.Header,
  5782. HTTPStatusCode: res.StatusCode,
  5783. },
  5784. }
  5785. target := &ret
  5786. if err := gensupport.DecodeResponse(target, res); err != nil {
  5787. return nil, err
  5788. }
  5789. return ret, nil
  5790. // {
  5791. // "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.",
  5792. // "flatPath": "v1/projects/{projectsId}/topics/{topicsId}:testIamPermissions",
  5793. // "httpMethod": "POST",
  5794. // "id": "pubsub.projects.topics.testIamPermissions",
  5795. // "parameterOrder": [
  5796. // "resource"
  5797. // ],
  5798. // "parameters": {
  5799. // "resource": {
  5800. // "description": "REQUIRED: The resource for which the policy detail is being requested.\nSee the operation documentation for the appropriate value for this field.",
  5801. // "location": "path",
  5802. // "pattern": "^projects/[^/]+/topics/[^/]+$",
  5803. // "required": true,
  5804. // "type": "string"
  5805. // }
  5806. // },
  5807. // "path": "v1/{+resource}:testIamPermissions",
  5808. // "request": {
  5809. // "$ref": "TestIamPermissionsRequest"
  5810. // },
  5811. // "response": {
  5812. // "$ref": "TestIamPermissionsResponse"
  5813. // },
  5814. // "scopes": [
  5815. // "https://www.googleapis.com/auth/cloud-platform",
  5816. // "https://www.googleapis.com/auth/pubsub"
  5817. // ]
  5818. // }
  5819. }
  5820. // method id "pubsub.projects.topics.snapshots.list":
  5821. type ProjectsTopicsSnapshotsListCall struct {
  5822. s *Service
  5823. topic string
  5824. urlParams_ gensupport.URLParams
  5825. ifNoneMatch_ string
  5826. ctx_ context.Context
  5827. header_ http.Header
  5828. }
  5829. // List: Lists the names of the snapshots on this topic. Snapshots are
  5830. // used in
  5831. // <a
  5832. // href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
  5833. // o
  5834. // perations, which allow
  5835. // you to manage message acknowledgments in bulk. That is, you can set
  5836. // the
  5837. // acknowledgment state of messages in an existing subscription to the
  5838. // state
  5839. // captured by a snapshot.<br><br>
  5840. // <b>BETA:</b> This feature is part of a beta release. This API might
  5841. // be
  5842. // changed in backward-incompatible ways and is not recommended for
  5843. // production
  5844. // use. It is not subject to any SLA or deprecation policy.
  5845. func (r *ProjectsTopicsSnapshotsService) List(topic string) *ProjectsTopicsSnapshotsListCall {
  5846. c := &ProjectsTopicsSnapshotsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5847. c.topic = topic
  5848. return c
  5849. }
  5850. // PageSize sets the optional parameter "pageSize": Maximum number of
  5851. // snapshot names to return.
  5852. func (c *ProjectsTopicsSnapshotsListCall) PageSize(pageSize int64) *ProjectsTopicsSnapshotsListCall {
  5853. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5854. return c
  5855. }
  5856. // PageToken sets the optional parameter "pageToken": The value returned
  5857. // by the last `ListTopicSnapshotsResponse`; indicates
  5858. // that this is a continuation of a prior `ListTopicSnapshots` call,
  5859. // and
  5860. // that the system should return the next page of data.
  5861. func (c *ProjectsTopicsSnapshotsListCall) PageToken(pageToken string) *ProjectsTopicsSnapshotsListCall {
  5862. c.urlParams_.Set("pageToken", pageToken)
  5863. return c
  5864. }
  5865. // Fields allows partial responses to be retrieved. See
  5866. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5867. // for more information.
  5868. func (c *ProjectsTopicsSnapshotsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsSnapshotsListCall {
  5869. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5870. return c
  5871. }
  5872. // IfNoneMatch sets the optional parameter which makes the operation
  5873. // fail if the object's ETag matches the given value. This is useful for
  5874. // getting updates only after the object has changed since the last
  5875. // request. Use googleapi.IsNotModified to check whether the response
  5876. // error from Do is the result of In-None-Match.
  5877. func (c *ProjectsTopicsSnapshotsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsSnapshotsListCall {
  5878. c.ifNoneMatch_ = entityTag
  5879. return c
  5880. }
  5881. // Context sets the context to be used in this call's Do method. Any
  5882. // pending HTTP request will be aborted if the provided context is
  5883. // canceled.
  5884. func (c *ProjectsTopicsSnapshotsListCall) Context(ctx context.Context) *ProjectsTopicsSnapshotsListCall {
  5885. c.ctx_ = ctx
  5886. return c
  5887. }
  5888. // Header returns an http.Header that can be modified by the caller to
  5889. // add HTTP headers to the request.
  5890. func (c *ProjectsTopicsSnapshotsListCall) Header() http.Header {
  5891. if c.header_ == nil {
  5892. c.header_ = make(http.Header)
  5893. }
  5894. return c.header_
  5895. }
  5896. func (c *ProjectsTopicsSnapshotsListCall) doRequest(alt string) (*http.Response, error) {
  5897. reqHeaders := make(http.Header)
  5898. for k, v := range c.header_ {
  5899. reqHeaders[k] = v
  5900. }
  5901. reqHeaders.Set("User-Agent", c.s.userAgent())
  5902. if c.ifNoneMatch_ != "" {
  5903. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5904. }
  5905. var body io.Reader = nil
  5906. c.urlParams_.Set("alt", alt)
  5907. c.urlParams_.Set("prettyPrint", "false")
  5908. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+topic}/snapshots")
  5909. urls += "?" + c.urlParams_.Encode()
  5910. req, err := http.NewRequest("GET", urls, body)
  5911. if err != nil {
  5912. return nil, err
  5913. }
  5914. req.Header = reqHeaders
  5915. googleapi.Expand(req.URL, map[string]string{
  5916. "topic": c.topic,
  5917. })
  5918. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5919. }
  5920. // Do executes the "pubsub.projects.topics.snapshots.list" call.
  5921. // Exactly one of *ListTopicSnapshotsResponse or error will be non-nil.
  5922. // Any non-2xx status code is an error. Response headers are in either
  5923. // *ListTopicSnapshotsResponse.ServerResponse.Header or (if a response
  5924. // was returned at all) in error.(*googleapi.Error).Header. Use
  5925. // googleapi.IsNotModified to check whether the returned error was
  5926. // because http.StatusNotModified was returned.
  5927. func (c *ProjectsTopicsSnapshotsListCall) Do(opts ...googleapi.CallOption) (*ListTopicSnapshotsResponse, error) {
  5928. gensupport.SetOptions(c.urlParams_, opts...)
  5929. res, err := c.doRequest("json")
  5930. if res != nil && res.StatusCode == http.StatusNotModified {
  5931. if res.Body != nil {
  5932. res.Body.Close()
  5933. }
  5934. return nil, &googleapi.Error{
  5935. Code: res.StatusCode,
  5936. Header: res.Header,
  5937. }
  5938. }
  5939. if err != nil {
  5940. return nil, err
  5941. }
  5942. defer googleapi.CloseBody(res)
  5943. if err := googleapi.CheckResponse(res); err != nil {
  5944. return nil, err
  5945. }
  5946. ret := &ListTopicSnapshotsResponse{
  5947. ServerResponse: googleapi.ServerResponse{
  5948. Header: res.Header,
  5949. HTTPStatusCode: res.StatusCode,
  5950. },
  5951. }
  5952. target := &ret
  5953. if err := gensupport.DecodeResponse(target, res); err != nil {
  5954. return nil, err
  5955. }
  5956. return ret, nil
  5957. // {
  5958. // "description": "Lists the names of the snapshots on this topic. Snapshots are used in\n\u003ca href=\"https://cloud.google.com/pubsub/docs/replay-overview\"\u003eSeek\u003c/a\u003e\noperations, which allow\nyou to manage message acknowledgments in bulk. That is, you can set the\nacknowledgment state of messages in an existing subscription to the state\ncaptured by a snapshot.\u003cbr\u003e\u003cbr\u003e\n\u003cb\u003eBETA:\u003c/b\u003e This feature is part of a beta release. This API might be\nchanged in backward-incompatible ways and is not recommended for production\nuse. It is not subject to any SLA or deprecation policy.",
  5959. // "flatPath": "v1/projects/{projectsId}/topics/{topicsId}/snapshots",
  5960. // "httpMethod": "GET",
  5961. // "id": "pubsub.projects.topics.snapshots.list",
  5962. // "parameterOrder": [
  5963. // "topic"
  5964. // ],
  5965. // "parameters": {
  5966. // "pageSize": {
  5967. // "description": "Maximum number of snapshot names to return.",
  5968. // "format": "int32",
  5969. // "location": "query",
  5970. // "type": "integer"
  5971. // },
  5972. // "pageToken": {
  5973. // "description": "The value returned by the last `ListTopicSnapshotsResponse`; indicates\nthat this is a continuation of a prior `ListTopicSnapshots` call, and\nthat the system should return the next page of data.",
  5974. // "location": "query",
  5975. // "type": "string"
  5976. // },
  5977. // "topic": {
  5978. // "description": "The name of the topic that snapshots are attached to.\nFormat is `projects/{project}/topics/{topic}`.",
  5979. // "location": "path",
  5980. // "pattern": "^projects/[^/]+/topics/[^/]+$",
  5981. // "required": true,
  5982. // "type": "string"
  5983. // }
  5984. // },
  5985. // "path": "v1/{+topic}/snapshots",
  5986. // "response": {
  5987. // "$ref": "ListTopicSnapshotsResponse"
  5988. // },
  5989. // "scopes": [
  5990. // "https://www.googleapis.com/auth/cloud-platform",
  5991. // "https://www.googleapis.com/auth/pubsub"
  5992. // ]
  5993. // }
  5994. }
  5995. // Pages invokes f for each page of results.
  5996. // A non-nil error returned from f will halt the iteration.
  5997. // The provided context supersedes any context provided to the Context method.
  5998. func (c *ProjectsTopicsSnapshotsListCall) Pages(ctx context.Context, f func(*ListTopicSnapshotsResponse) error) error {
  5999. c.ctx_ = ctx
  6000. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6001. for {
  6002. x, err := c.Do()
  6003. if err != nil {
  6004. return err
  6005. }
  6006. if err := f(x); err != nil {
  6007. return err
  6008. }
  6009. if x.NextPageToken == "" {
  6010. return nil
  6011. }
  6012. c.PageToken(x.NextPageToken)
  6013. }
  6014. }
  6015. // method id "pubsub.projects.topics.subscriptions.list":
  6016. type ProjectsTopicsSubscriptionsListCall struct {
  6017. s *Service
  6018. topic string
  6019. urlParams_ gensupport.URLParams
  6020. ifNoneMatch_ string
  6021. ctx_ context.Context
  6022. header_ http.Header
  6023. }
  6024. // List: Lists the names of the subscriptions on this topic.
  6025. func (r *ProjectsTopicsSubscriptionsService) List(topic string) *ProjectsTopicsSubscriptionsListCall {
  6026. c := &ProjectsTopicsSubscriptionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6027. c.topic = topic
  6028. return c
  6029. }
  6030. // PageSize sets the optional parameter "pageSize": Maximum number of
  6031. // subscription names to return.
  6032. func (c *ProjectsTopicsSubscriptionsListCall) PageSize(pageSize int64) *ProjectsTopicsSubscriptionsListCall {
  6033. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6034. return c
  6035. }
  6036. // PageToken sets the optional parameter "pageToken": The value returned
  6037. // by the last `ListTopicSubscriptionsResponse`; indicates
  6038. // that this is a continuation of a prior `ListTopicSubscriptions` call,
  6039. // and
  6040. // that the system should return the next page of data.
  6041. func (c *ProjectsTopicsSubscriptionsListCall) PageToken(pageToken string) *ProjectsTopicsSubscriptionsListCall {
  6042. c.urlParams_.Set("pageToken", pageToken)
  6043. return c
  6044. }
  6045. // Fields allows partial responses to be retrieved. See
  6046. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6047. // for more information.
  6048. func (c *ProjectsTopicsSubscriptionsListCall) Fields(s ...googleapi.Field) *ProjectsTopicsSubscriptionsListCall {
  6049. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6050. return c
  6051. }
  6052. // IfNoneMatch sets the optional parameter which makes the operation
  6053. // fail if the object's ETag matches the given value. This is useful for
  6054. // getting updates only after the object has changed since the last
  6055. // request. Use googleapi.IsNotModified to check whether the response
  6056. // error from Do is the result of In-None-Match.
  6057. func (c *ProjectsTopicsSubscriptionsListCall) IfNoneMatch(entityTag string) *ProjectsTopicsSubscriptionsListCall {
  6058. c.ifNoneMatch_ = entityTag
  6059. return c
  6060. }
  6061. // Context sets the context to be used in this call's Do method. Any
  6062. // pending HTTP request will be aborted if the provided context is
  6063. // canceled.
  6064. func (c *ProjectsTopicsSubscriptionsListCall) Context(ctx context.Context) *ProjectsTopicsSubscriptionsListCall {
  6065. c.ctx_ = ctx
  6066. return c
  6067. }
  6068. // Header returns an http.Header that can be modified by the caller to
  6069. // add HTTP headers to the request.
  6070. func (c *ProjectsTopicsSubscriptionsListCall) Header() http.Header {
  6071. if c.header_ == nil {
  6072. c.header_ = make(http.Header)
  6073. }
  6074. return c.header_
  6075. }
  6076. func (c *ProjectsTopicsSubscriptionsListCall) doRequest(alt string) (*http.Response, error) {
  6077. reqHeaders := make(http.Header)
  6078. for k, v := range c.header_ {
  6079. reqHeaders[k] = v
  6080. }
  6081. reqHeaders.Set("User-Agent", c.s.userAgent())
  6082. if c.ifNoneMatch_ != "" {
  6083. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6084. }
  6085. var body io.Reader = nil
  6086. c.urlParams_.Set("alt", alt)
  6087. c.urlParams_.Set("prettyPrint", "false")
  6088. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+topic}/subscriptions")
  6089. urls += "?" + c.urlParams_.Encode()
  6090. req, err := http.NewRequest("GET", urls, body)
  6091. if err != nil {
  6092. return nil, err
  6093. }
  6094. req.Header = reqHeaders
  6095. googleapi.Expand(req.URL, map[string]string{
  6096. "topic": c.topic,
  6097. })
  6098. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6099. }
  6100. // Do executes the "pubsub.projects.topics.subscriptions.list" call.
  6101. // Exactly one of *ListTopicSubscriptionsResponse or error will be
  6102. // non-nil. Any non-2xx status code is an error. Response headers are in
  6103. // either *ListTopicSubscriptionsResponse.ServerResponse.Header or (if a
  6104. // response was returned at all) in error.(*googleapi.Error).Header. Use
  6105. // googleapi.IsNotModified to check whether the returned error was
  6106. // because http.StatusNotModified was returned.
  6107. func (c *ProjectsTopicsSubscriptionsListCall) Do(opts ...googleapi.CallOption) (*ListTopicSubscriptionsResponse, error) {
  6108. gensupport.SetOptions(c.urlParams_, opts...)
  6109. res, err := c.doRequest("json")
  6110. if res != nil && res.StatusCode == http.StatusNotModified {
  6111. if res.Body != nil {
  6112. res.Body.Close()
  6113. }
  6114. return nil, &googleapi.Error{
  6115. Code: res.StatusCode,
  6116. Header: res.Header,
  6117. }
  6118. }
  6119. if err != nil {
  6120. return nil, err
  6121. }
  6122. defer googleapi.CloseBody(res)
  6123. if err := googleapi.CheckResponse(res); err != nil {
  6124. return nil, err
  6125. }
  6126. ret := &ListTopicSubscriptionsResponse{
  6127. ServerResponse: googleapi.ServerResponse{
  6128. Header: res.Header,
  6129. HTTPStatusCode: res.StatusCode,
  6130. },
  6131. }
  6132. target := &ret
  6133. if err := gensupport.DecodeResponse(target, res); err != nil {
  6134. return nil, err
  6135. }
  6136. return ret, nil
  6137. // {
  6138. // "description": "Lists the names of the subscriptions on this topic.",
  6139. // "flatPath": "v1/projects/{projectsId}/topics/{topicsId}/subscriptions",
  6140. // "httpMethod": "GET",
  6141. // "id": "pubsub.projects.topics.subscriptions.list",
  6142. // "parameterOrder": [
  6143. // "topic"
  6144. // ],
  6145. // "parameters": {
  6146. // "pageSize": {
  6147. // "description": "Maximum number of subscription names to return.",
  6148. // "format": "int32",
  6149. // "location": "query",
  6150. // "type": "integer"
  6151. // },
  6152. // "pageToken": {
  6153. // "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.",
  6154. // "location": "query",
  6155. // "type": "string"
  6156. // },
  6157. // "topic": {
  6158. // "description": "The name of the topic that subscriptions are attached to.\nFormat is `projects/{project}/topics/{topic}`.",
  6159. // "location": "path",
  6160. // "pattern": "^projects/[^/]+/topics/[^/]+$",
  6161. // "required": true,
  6162. // "type": "string"
  6163. // }
  6164. // },
  6165. // "path": "v1/{+topic}/subscriptions",
  6166. // "response": {
  6167. // "$ref": "ListTopicSubscriptionsResponse"
  6168. // },
  6169. // "scopes": [
  6170. // "https://www.googleapis.com/auth/cloud-platform",
  6171. // "https://www.googleapis.com/auth/pubsub"
  6172. // ]
  6173. // }
  6174. }
  6175. // Pages invokes f for each page of results.
  6176. // A non-nil error returned from f will halt the iteration.
  6177. // The provided context supersedes any context provided to the Context method.
  6178. func (c *ProjectsTopicsSubscriptionsListCall) Pages(ctx context.Context, f func(*ListTopicSubscriptionsResponse) error) error {
  6179. c.ctx_ = ctx
  6180. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6181. for {
  6182. x, err := c.Do()
  6183. if err != nil {
  6184. return err
  6185. }
  6186. if err := f(x); err != nil {
  6187. return err
  6188. }
  6189. if x.NextPageToken == "" {
  6190. return nil
  6191. }
  6192. c.PageToken(x.NextPageToken)
  6193. }
  6194. }