@google-cloud/pubsub 2.18.1 → 2.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/build/src/iam.d.ts +180 -0
  3. package/build/src/iam.js +2 -172
  4. package/build/src/iam.js.map +1 -1
  5. package/build/src/index.d.ts +12 -4
  6. package/build/src/index.js +12 -4
  7. package/build/src/index.js.map +1 -1
  8. package/build/src/publisher/flow-publisher.d.ts +6 -0
  9. package/build/src/publisher/flow-publisher.js +6 -0
  10. package/build/src/publisher/flow-publisher.js.map +1 -1
  11. package/build/src/publisher/index.d.ts +35 -0
  12. package/build/src/publisher/index.js +0 -35
  13. package/build/src/publisher/index.js.map +1 -1
  14. package/build/src/pubsub.d.ts +354 -4
  15. package/build/src/pubsub.js +28 -322
  16. package/build/src/pubsub.js.map +1 -1
  17. package/build/src/schema.d.ts +9 -4
  18. package/build/src/schema.js +9 -4
  19. package/build/src/schema.js.map +1 -1
  20. package/build/src/snapshot.d.ts +87 -0
  21. package/build/src/snapshot.js +2 -79
  22. package/build/src/snapshot.js.map +1 -1
  23. package/build/src/subscriber.d.ts +6 -0
  24. package/build/src/subscriber.js +6 -0
  25. package/build/src/subscriber.js.map +1 -1
  26. package/build/src/subscription.d.ts +439 -9
  27. package/build/src/subscription.js +24 -400
  28. package/build/src/subscription.js.map +1 -1
  29. package/build/src/topic.d.ts +466 -1
  30. package/build/src/topic.js +17 -417
  31. package/build/src/topic.js.map +1 -1
  32. package/build/src/v1/publisher_client.d.ts +262 -0
  33. package/build/src/v1/publisher_client.js +6 -244
  34. package/build/src/v1/publisher_client.js.map +1 -1
  35. package/build/src/v1/schema_service_client.d.ts +165 -0
  36. package/build/src/v1/schema_service_client.js +2 -153
  37. package/build/src/v1/schema_service_client.js.map +1 -1
  38. package/build/src/v1/subscriber_client.d.ts +566 -0
  39. package/build/src/v1/subscriber_client.js +6 -534
  40. package/build/src/v1/subscriber_client.js.map +1 -1
  41. package/package.json +2 -2
@@ -102,44 +102,546 @@ export declare class SubscriberClient {
102
102
  * @returns {string[]} List of default scopes.
103
103
  */
104
104
  static get scopes(): string[];
105
+ /**
106
+ * Return the project ID used by this class.
107
+ * @returns {Promise} A promise that resolves to string containing the project ID.
108
+ */
105
109
  getProjectId(): Promise<string>;
106
110
  getProjectId(callback: Callback<string, undefined, undefined>): void;
111
+ /**
112
+ * Creates a subscription to a given topic. See the [resource name rules]
113
+ * (https://cloud.google.com/pubsub/docs/admin#resource_names).
114
+ * If the subscription already exists, returns `ALREADY_EXISTS`.
115
+ * If the corresponding topic doesn't exist, returns `NOT_FOUND`.
116
+ *
117
+ * If the name is not provided in the request, the server will assign a random
118
+ * name for this subscription on the same project as the topic, conforming
119
+ * to the [resource name format]
120
+ * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated
121
+ * name is populated in the returned Subscription object. Note that for REST
122
+ * API requests, you must specify a name in the request.
123
+ *
124
+ * @param {Object} request
125
+ * The request object that will be sent.
126
+ * @param {string} request.name
127
+ * Required. The name of the subscription. It must have the format
128
+ * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
129
+ * start with a letter, and contain only letters (`[A-Za-z]`), numbers
130
+ * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
131
+ * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
132
+ * in length, and it must not start with `"goog"`.
133
+ * @param {string} request.topic
134
+ * Required. The name of the topic from which this subscription is receiving
135
+ * messages. Format is `projects/{project}/topics/{topic}`. The value of this
136
+ * field will be `_deleted-topic_` if the topic has been deleted.
137
+ * @param {google.pubsub.v1.PushConfig} request.pushConfig
138
+ * If push delivery is used with this subscription, this field is
139
+ * used to configure it. An empty `pushConfig` signifies that the subscriber
140
+ * will pull and ack messages using API methods.
141
+ * @param {number} request.ackDeadlineSeconds
142
+ * The approximate amount of time (on a best-effort basis) Pub/Sub waits for
143
+ * the subscriber to acknowledge receipt before resending the message. In the
144
+ * interval after the message is delivered and before it is acknowledged, it
145
+ * is considered to be <i>outstanding</i>. During that time period, the
146
+ * message will not be redelivered (on a best-effort basis).
147
+ *
148
+ * For pull subscriptions, this value is used as the initial value for the ack
149
+ * deadline. To override this value for a given message, call
150
+ * `ModifyAckDeadline` with the corresponding `ack_id` if using
151
+ * non-streaming pull or send the `ack_id` in a
152
+ * `StreamingModifyAckDeadlineRequest` if using streaming pull.
153
+ * The minimum custom deadline you can specify is 10 seconds.
154
+ * The maximum custom deadline you can specify is 600 seconds (10 minutes).
155
+ * If this parameter is 0, a default value of 10 seconds is used.
156
+ *
157
+ * For push delivery, this value is also used to set the request timeout for
158
+ * the call to the push endpoint.
159
+ *
160
+ * If the subscriber never acknowledges the message, the Pub/Sub
161
+ * system will eventually redeliver the message.
162
+ * @param {boolean} request.retainAckedMessages
163
+ * Indicates whether to retain acknowledged messages. If true, then
164
+ * messages are not expunged from the subscription's backlog, even if they are
165
+ * acknowledged, until they fall out of the `message_retention_duration`
166
+ * window. This must be true if you would like to [`Seek` to a timestamp]
167
+ * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in
168
+ * the past to replay previously-acknowledged messages.
169
+ * @param {google.protobuf.Duration} request.messageRetentionDuration
170
+ * How long to retain unacknowledged messages in the subscription's backlog,
171
+ * from the moment a message is published.
172
+ * If `retain_acked_messages` is true, then this also configures the retention
173
+ * of acknowledged messages, and thus configures how far back in time a `Seek`
174
+ * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
175
+ * minutes.
176
+ * @param {number[]} request.labels
177
+ * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
178
+ * managing labels</a>.
179
+ * @param {boolean} request.enableMessageOrdering
180
+ * If true, messages published with the same `ordering_key` in `PubsubMessage`
181
+ * will be delivered to the subscribers in the order in which they
182
+ * are received by the Pub/Sub system. Otherwise, they may be delivered in
183
+ * any order.
184
+ * @param {google.pubsub.v1.ExpirationPolicy} request.expirationPolicy
185
+ * A policy that specifies the conditions for this subscription's expiration.
186
+ * A subscription is considered active as long as any connected subscriber is
187
+ * successfully consuming messages from the subscription or is issuing
188
+ * operations on the subscription. If `expiration_policy` is not set, a
189
+ * *default policy* with `ttl` of 31 days will be used. The minimum allowed
190
+ * value for `expiration_policy.ttl` is 1 day.
191
+ * @param {string} request.filter
192
+ * An expression written in the Pub/Sub [filter
193
+ * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
194
+ * then only `PubsubMessage`s whose `attributes` field matches the filter are
195
+ * delivered on this subscription. If empty, then no messages are filtered
196
+ * out.
197
+ * @param {google.pubsub.v1.DeadLetterPolicy} request.deadLetterPolicy
198
+ * A policy that specifies the conditions for dead lettering messages in
199
+ * this subscription. If dead_letter_policy is not set, dead lettering
200
+ * is disabled.
201
+ *
202
+ * The Cloud Pub/Sub service account associated with this subscriptions's
203
+ * parent project (i.e.,
204
+ * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
205
+ * permission to Acknowledge() messages on this subscription.
206
+ * @param {google.pubsub.v1.RetryPolicy} request.retryPolicy
207
+ * A policy that specifies how Pub/Sub retries message delivery for this
208
+ * subscription.
209
+ *
210
+ * If not set, the default retry policy is applied. This generally implies
211
+ * that messages will be retried as soon as possible for healthy subscribers.
212
+ * RetryPolicy will be triggered on NACKs or acknowledgement deadline
213
+ * exceeded events for a given message.
214
+ * @param {boolean} request.detached
215
+ * Indicates whether the subscription is detached from its topic. Detached
216
+ * subscriptions don't receive messages from their topic and don't retain any
217
+ * backlog. `Pull` and `StreamingPull` requests will return
218
+ * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
219
+ * the endpoint will not be made.
220
+ * @param {google.protobuf.Duration} request.topicMessageRetentionDuration
221
+ * Output only. Indicates the minimum duration for which a message is retained
222
+ * after it is published to the subscription's topic. If this field is set,
223
+ * messages published to the subscription's topic in the last
224
+ * `topic_message_retention_duration` are always available to subscribers. See
225
+ * the `message_retention_duration` field in `Topic`. This field is set only
226
+ * in responses from the server; it is ignored if it is set in any requests.
227
+ * @param {object} [options]
228
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
229
+ * @returns {Promise} - The promise which resolves to an array.
230
+ * The first element of the array is an object representing [Subscription]{@link google.pubsub.v1.Subscription}.
231
+ * Please see the
232
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
233
+ * for more details and examples.
234
+ * @example
235
+ * ```
236
+ * const [response] = await client.createSubscription(request);
237
+ * ```
238
+ */
107
239
  createSubscription(request?: protos.google.pubsub.v1.ISubscription, options?: CallOptions): Promise<[protos.google.pubsub.v1.ISubscription, protos.google.pubsub.v1.ISubscription | undefined, {} | undefined]>;
108
240
  createSubscription(request: protos.google.pubsub.v1.ISubscription, options: CallOptions, callback: Callback<protos.google.pubsub.v1.ISubscription, protos.google.pubsub.v1.ISubscription | null | undefined, {} | null | undefined>): void;
109
241
  createSubscription(request: protos.google.pubsub.v1.ISubscription, callback: Callback<protos.google.pubsub.v1.ISubscription, protos.google.pubsub.v1.ISubscription | null | undefined, {} | null | undefined>): void;
242
+ /**
243
+ * Gets the configuration details of a subscription.
244
+ *
245
+ * @param {Object} request
246
+ * The request object that will be sent.
247
+ * @param {string} request.subscription
248
+ * Required. The name of the subscription to get.
249
+ * Format is `projects/{project}/subscriptions/{sub}`.
250
+ * @param {object} [options]
251
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
252
+ * @returns {Promise} - The promise which resolves to an array.
253
+ * The first element of the array is an object representing [Subscription]{@link google.pubsub.v1.Subscription}.
254
+ * Please see the
255
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
256
+ * for more details and examples.
257
+ * @example
258
+ * ```
259
+ * const [response] = await client.getSubscription(request);
260
+ * ```
261
+ */
110
262
  getSubscription(request?: protos.google.pubsub.v1.IGetSubscriptionRequest, options?: CallOptions): Promise<[protos.google.pubsub.v1.ISubscription, protos.google.pubsub.v1.IGetSubscriptionRequest | undefined, {} | undefined]>;
111
263
  getSubscription(request: protos.google.pubsub.v1.IGetSubscriptionRequest, options: CallOptions, callback: Callback<protos.google.pubsub.v1.ISubscription, protos.google.pubsub.v1.IGetSubscriptionRequest | null | undefined, {} | null | undefined>): void;
112
264
  getSubscription(request: protos.google.pubsub.v1.IGetSubscriptionRequest, callback: Callback<protos.google.pubsub.v1.ISubscription, protos.google.pubsub.v1.IGetSubscriptionRequest | null | undefined, {} | null | undefined>): void;
265
+ /**
266
+ * Updates an existing subscription. Note that certain properties of a
267
+ * subscription, such as its topic, are not modifiable.
268
+ *
269
+ * @param {Object} request
270
+ * The request object that will be sent.
271
+ * @param {google.pubsub.v1.Subscription} request.subscription
272
+ * Required. The updated subscription object.
273
+ * @param {google.protobuf.FieldMask} request.updateMask
274
+ * Required. Indicates which fields in the provided subscription to update.
275
+ * Must be specified and non-empty.
276
+ * @param {object} [options]
277
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
278
+ * @returns {Promise} - The promise which resolves to an array.
279
+ * The first element of the array is an object representing [Subscription]{@link google.pubsub.v1.Subscription}.
280
+ * Please see the
281
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
282
+ * for more details and examples.
283
+ * @example
284
+ * ```
285
+ * const [response] = await client.updateSubscription(request);
286
+ * ```
287
+ */
113
288
  updateSubscription(request?: protos.google.pubsub.v1.IUpdateSubscriptionRequest, options?: CallOptions): Promise<[protos.google.pubsub.v1.ISubscription, protos.google.pubsub.v1.IUpdateSubscriptionRequest | undefined, {} | undefined]>;
114
289
  updateSubscription(request: protos.google.pubsub.v1.IUpdateSubscriptionRequest, options: CallOptions, callback: Callback<protos.google.pubsub.v1.ISubscription, protos.google.pubsub.v1.IUpdateSubscriptionRequest | null | undefined, {} | null | undefined>): void;
115
290
  updateSubscription(request: protos.google.pubsub.v1.IUpdateSubscriptionRequest, callback: Callback<protos.google.pubsub.v1.ISubscription, protos.google.pubsub.v1.IUpdateSubscriptionRequest | null | undefined, {} | null | undefined>): void;
291
+ /**
292
+ * Deletes an existing subscription. All messages retained in the subscription
293
+ * are immediately dropped. Calls to `Pull` after deletion will return
294
+ * `NOT_FOUND`. After a subscription is deleted, a new one may be created with
295
+ * the same name, but the new one has no association with the old
296
+ * subscription or its topic unless the same topic is specified.
297
+ *
298
+ * @param {Object} request
299
+ * The request object that will be sent.
300
+ * @param {string} request.subscription
301
+ * Required. The subscription to delete.
302
+ * Format is `projects/{project}/subscriptions/{sub}`.
303
+ * @param {object} [options]
304
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
305
+ * @returns {Promise} - The promise which resolves to an array.
306
+ * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
307
+ * Please see the
308
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
309
+ * for more details and examples.
310
+ * @example
311
+ * ```
312
+ * const [response] = await client.deleteSubscription(request);
313
+ * ```
314
+ */
116
315
  deleteSubscription(request?: protos.google.pubsub.v1.IDeleteSubscriptionRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IDeleteSubscriptionRequest | undefined, {} | undefined]>;
117
316
  deleteSubscription(request: protos.google.pubsub.v1.IDeleteSubscriptionRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IDeleteSubscriptionRequest | null | undefined, {} | null | undefined>): void;
118
317
  deleteSubscription(request: protos.google.pubsub.v1.IDeleteSubscriptionRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IDeleteSubscriptionRequest | null | undefined, {} | null | undefined>): void;
318
+ /**
319
+ * Modifies the ack deadline for a specific message. This method is useful
320
+ * to indicate that more time is needed to process a message by the
321
+ * subscriber, or to make the message available for redelivery if the
322
+ * processing was interrupted. Note that this does not modify the
323
+ * subscription-level `ackDeadlineSeconds` used for subsequent messages.
324
+ *
325
+ * @param {Object} request
326
+ * The request object that will be sent.
327
+ * @param {string} request.subscription
328
+ * Required. The name of the subscription.
329
+ * Format is `projects/{project}/subscriptions/{sub}`.
330
+ * @param {string[]} request.ackIds
331
+ * Required. List of acknowledgment IDs.
332
+ * @param {number} request.ackDeadlineSeconds
333
+ * Required. The new ack deadline with respect to the time this request was
334
+ * sent to the Pub/Sub system. For example, if the value is 10, the new ack
335
+ * deadline will expire 10 seconds after the `ModifyAckDeadline` call was
336
+ * made. Specifying zero might immediately make the message available for
337
+ * delivery to another subscriber client. This typically results in an
338
+ * increase in the rate of message redeliveries (that is, duplicates).
339
+ * The minimum deadline you can specify is 0 seconds.
340
+ * The maximum deadline you can specify is 600 seconds (10 minutes).
341
+ * @param {object} [options]
342
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
343
+ * @returns {Promise} - The promise which resolves to an array.
344
+ * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
345
+ * Please see the
346
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
347
+ * for more details and examples.
348
+ * @example
349
+ * ```
350
+ * const [response] = await client.modifyAckDeadline(request);
351
+ * ```
352
+ */
119
353
  modifyAckDeadline(request?: protos.google.pubsub.v1.IModifyAckDeadlineRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IModifyAckDeadlineRequest | undefined, {} | undefined]>;
120
354
  modifyAckDeadline(request: protos.google.pubsub.v1.IModifyAckDeadlineRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IModifyAckDeadlineRequest | null | undefined, {} | null | undefined>): void;
121
355
  modifyAckDeadline(request: protos.google.pubsub.v1.IModifyAckDeadlineRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IModifyAckDeadlineRequest | null | undefined, {} | null | undefined>): void;
356
+ /**
357
+ * Acknowledges the messages associated with the `ack_ids` in the
358
+ * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages
359
+ * from the subscription.
360
+ *
361
+ * Acknowledging a message whose ack deadline has expired may succeed,
362
+ * but such a message may be redelivered later. Acknowledging a message more
363
+ * than once will not result in an error.
364
+ *
365
+ * @param {Object} request
366
+ * The request object that will be sent.
367
+ * @param {string} request.subscription
368
+ * Required. The subscription whose message is being acknowledged.
369
+ * Format is `projects/{project}/subscriptions/{sub}`.
370
+ * @param {string[]} request.ackIds
371
+ * Required. The acknowledgment ID for the messages being acknowledged that
372
+ * was returned by the Pub/Sub system in the `Pull` response. Must not be
373
+ * empty.
374
+ * @param {object} [options]
375
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
376
+ * @returns {Promise} - The promise which resolves to an array.
377
+ * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
378
+ * Please see the
379
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
380
+ * for more details and examples.
381
+ * @example
382
+ * ```
383
+ * const [response] = await client.acknowledge(request);
384
+ * ```
385
+ */
122
386
  acknowledge(request?: protos.google.pubsub.v1.IAcknowledgeRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IAcknowledgeRequest | undefined, {} | undefined]>;
123
387
  acknowledge(request: protos.google.pubsub.v1.IAcknowledgeRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IAcknowledgeRequest | null | undefined, {} | null | undefined>): void;
124
388
  acknowledge(request: protos.google.pubsub.v1.IAcknowledgeRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IAcknowledgeRequest | null | undefined, {} | null | undefined>): void;
389
+ /**
390
+ * Pulls messages from the server. The server may return `UNAVAILABLE` if
391
+ * there are too many concurrent pull requests pending for the given
392
+ * subscription.
393
+ *
394
+ * @param {Object} request
395
+ * The request object that will be sent.
396
+ * @param {string} request.subscription
397
+ * Required. The subscription from which messages should be pulled.
398
+ * Format is `projects/{project}/subscriptions/{sub}`.
399
+ * @param {boolean} [request.returnImmediately]
400
+ * Optional. If this field set to true, the system will respond immediately
401
+ * even if it there are no messages available to return in the `Pull`
402
+ * response. Otherwise, the system may wait (for a bounded amount of time)
403
+ * until at least one message is available, rather than returning no messages.
404
+ * Warning: setting this field to `true` is discouraged because it adversely
405
+ * impacts the performance of `Pull` operations. We recommend that users do
406
+ * not set this field.
407
+ * @param {number} request.maxMessages
408
+ * Required. The maximum number of messages to return for this request. Must
409
+ * be a positive integer. The Pub/Sub system may return fewer than the number
410
+ * specified.
411
+ * @param {object} [options]
412
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
413
+ * @returns {Promise} - The promise which resolves to an array.
414
+ * The first element of the array is an object representing [PullResponse]{@link google.pubsub.v1.PullResponse}.
415
+ * Please see the
416
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
417
+ * for more details and examples.
418
+ * @example
419
+ * ```
420
+ * const [response] = await client.pull(request);
421
+ * ```
422
+ */
125
423
  pull(request?: protos.google.pubsub.v1.IPullRequest, options?: CallOptions): Promise<[protos.google.pubsub.v1.IPullResponse, protos.google.pubsub.v1.IPullRequest | undefined, {} | undefined]>;
126
424
  pull(request: protos.google.pubsub.v1.IPullRequest, options: CallOptions, callback: Callback<protos.google.pubsub.v1.IPullResponse, protos.google.pubsub.v1.IPullRequest | null | undefined, {} | null | undefined>): void;
127
425
  pull(request: protos.google.pubsub.v1.IPullRequest, callback: Callback<protos.google.pubsub.v1.IPullResponse, protos.google.pubsub.v1.IPullRequest | null | undefined, {} | null | undefined>): void;
426
+ /**
427
+ * Modifies the `PushConfig` for a specified subscription.
428
+ *
429
+ * This may be used to change a push subscription to a pull one (signified by
430
+ * an empty `PushConfig`) or vice versa, or change the endpoint URL and other
431
+ * attributes of a push subscription. Messages will accumulate for delivery
432
+ * continuously through the call regardless of changes to the `PushConfig`.
433
+ *
434
+ * @param {Object} request
435
+ * The request object that will be sent.
436
+ * @param {string} request.subscription
437
+ * Required. The name of the subscription.
438
+ * Format is `projects/{project}/subscriptions/{sub}`.
439
+ * @param {google.pubsub.v1.PushConfig} request.pushConfig
440
+ * Required. The push configuration for future deliveries.
441
+ *
442
+ * An empty `pushConfig` indicates that the Pub/Sub system should
443
+ * stop pushing messages from the given subscription and allow
444
+ * messages to be pulled and acknowledged - effectively pausing
445
+ * the subscription if `Pull` or `StreamingPull` is not called.
446
+ * @param {object} [options]
447
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
448
+ * @returns {Promise} - The promise which resolves to an array.
449
+ * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
450
+ * Please see the
451
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
452
+ * for more details and examples.
453
+ * @example
454
+ * ```
455
+ * const [response] = await client.modifyPushConfig(request);
456
+ * ```
457
+ */
128
458
  modifyPushConfig(request?: protos.google.pubsub.v1.IModifyPushConfigRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IModifyPushConfigRequest | undefined, {} | undefined]>;
129
459
  modifyPushConfig(request: protos.google.pubsub.v1.IModifyPushConfigRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IModifyPushConfigRequest | null | undefined, {} | null | undefined>): void;
130
460
  modifyPushConfig(request: protos.google.pubsub.v1.IModifyPushConfigRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IModifyPushConfigRequest | null | undefined, {} | null | undefined>): void;
461
+ /**
462
+ * Gets the configuration details of a snapshot. Snapshots are used in
463
+ * <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
464
+ * operations, which allow you to manage message acknowledgments in bulk. That
465
+ * is, you can set the acknowledgment state of messages in an existing
466
+ * subscription to the state captured by a snapshot.
467
+ *
468
+ * @param {Object} request
469
+ * The request object that will be sent.
470
+ * @param {string} request.snapshot
471
+ * Required. The name of the snapshot to get.
472
+ * Format is `projects/{project}/snapshots/{snap}`.
473
+ * @param {object} [options]
474
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
475
+ * @returns {Promise} - The promise which resolves to an array.
476
+ * The first element of the array is an object representing [Snapshot]{@link google.pubsub.v1.Snapshot}.
477
+ * Please see the
478
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
479
+ * for more details and examples.
480
+ * @example
481
+ * ```
482
+ * const [response] = await client.getSnapshot(request);
483
+ * ```
484
+ */
131
485
  getSnapshot(request?: protos.google.pubsub.v1.IGetSnapshotRequest, options?: CallOptions): Promise<[protos.google.pubsub.v1.ISnapshot, protos.google.pubsub.v1.IGetSnapshotRequest | undefined, {} | undefined]>;
132
486
  getSnapshot(request: protos.google.pubsub.v1.IGetSnapshotRequest, options: CallOptions, callback: Callback<protos.google.pubsub.v1.ISnapshot, protos.google.pubsub.v1.IGetSnapshotRequest | null | undefined, {} | null | undefined>): void;
133
487
  getSnapshot(request: protos.google.pubsub.v1.IGetSnapshotRequest, callback: Callback<protos.google.pubsub.v1.ISnapshot, protos.google.pubsub.v1.IGetSnapshotRequest | null | undefined, {} | null | undefined>): void;
488
+ /**
489
+ * Creates a snapshot from the requested subscription. Snapshots are used in
490
+ * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
491
+ * which allow you to manage message acknowledgments in bulk. That is, you can
492
+ * set the acknowledgment state of messages in an existing subscription to the
493
+ * state captured by a snapshot.
494
+ * If the snapshot already exists, returns `ALREADY_EXISTS`.
495
+ * If the requested subscription doesn't exist, returns `NOT_FOUND`.
496
+ * If the backlog in the subscription is too old -- and the resulting snapshot
497
+ * would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.
498
+ * See also the `Snapshot.expire_time` field. If the name is not provided in
499
+ * the request, the server will assign a random
500
+ * name for this snapshot on the same project as the subscription, conforming
501
+ * to the [resource name format]
502
+ * (https://cloud.google.com/pubsub/docs/admin#resource_names). The
503
+ * generated name is populated in the returned Snapshot object. Note that for
504
+ * REST API requests, you must specify a name in the request.
505
+ *
506
+ * @param {Object} request
507
+ * The request object that will be sent.
508
+ * @param {string} request.name
509
+ * Required. User-provided name for this snapshot. If the name is not provided
510
+ * in the request, the server will assign a random name for this snapshot on
511
+ * the same project as the subscription. Note that for REST API requests, you
512
+ * must specify a name. See the <a
513
+ * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource
514
+ * name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
515
+ * @param {string} request.subscription
516
+ * Required. The subscription whose backlog the snapshot retains.
517
+ * Specifically, the created snapshot is guaranteed to retain:
518
+ * (a) The existing backlog on the subscription. More precisely, this is
519
+ * defined as the messages in the subscription's backlog that are
520
+ * unacknowledged upon the successful completion of the
521
+ * `CreateSnapshot` request; as well as:
522
+ * (b) Any messages published to the subscription's topic following the
523
+ * successful completion of the CreateSnapshot request.
524
+ * Format is `projects/{project}/subscriptions/{sub}`.
525
+ * @param {number[]} request.labels
526
+ * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
527
+ * managing labels</a>.
528
+ * @param {object} [options]
529
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
530
+ * @returns {Promise} - The promise which resolves to an array.
531
+ * The first element of the array is an object representing [Snapshot]{@link google.pubsub.v1.Snapshot}.
532
+ * Please see the
533
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
534
+ * for more details and examples.
535
+ * @example
536
+ * ```
537
+ * const [response] = await client.createSnapshot(request);
538
+ * ```
539
+ */
134
540
  createSnapshot(request?: protos.google.pubsub.v1.ICreateSnapshotRequest, options?: CallOptions): Promise<[protos.google.pubsub.v1.ISnapshot, protos.google.pubsub.v1.ICreateSnapshotRequest | undefined, {} | undefined]>;
135
541
  createSnapshot(request: protos.google.pubsub.v1.ICreateSnapshotRequest, options: CallOptions, callback: Callback<protos.google.pubsub.v1.ISnapshot, protos.google.pubsub.v1.ICreateSnapshotRequest | null | undefined, {} | null | undefined>): void;
136
542
  createSnapshot(request: protos.google.pubsub.v1.ICreateSnapshotRequest, callback: Callback<protos.google.pubsub.v1.ISnapshot, protos.google.pubsub.v1.ICreateSnapshotRequest | null | undefined, {} | null | undefined>): void;
543
+ /**
544
+ * Updates an existing snapshot. Snapshots are used in
545
+ * <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
546
+ * operations, which allow
547
+ * you to manage message acknowledgments in bulk. That is, you can set the
548
+ * acknowledgment state of messages in an existing subscription to the state
549
+ * captured by a snapshot.
550
+ *
551
+ * @param {Object} request
552
+ * The request object that will be sent.
553
+ * @param {google.pubsub.v1.Snapshot} request.snapshot
554
+ * Required. The updated snapshot object.
555
+ * @param {google.protobuf.FieldMask} request.updateMask
556
+ * Required. Indicates which fields in the provided snapshot to update.
557
+ * Must be specified and non-empty.
558
+ * @param {object} [options]
559
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
560
+ * @returns {Promise} - The promise which resolves to an array.
561
+ * The first element of the array is an object representing [Snapshot]{@link google.pubsub.v1.Snapshot}.
562
+ * Please see the
563
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
564
+ * for more details and examples.
565
+ * @example
566
+ * ```
567
+ * const [response] = await client.updateSnapshot(request);
568
+ * ```
569
+ */
137
570
  updateSnapshot(request?: protos.google.pubsub.v1.IUpdateSnapshotRequest, options?: CallOptions): Promise<[protos.google.pubsub.v1.ISnapshot, protos.google.pubsub.v1.IUpdateSnapshotRequest | undefined, {} | undefined]>;
138
571
  updateSnapshot(request: protos.google.pubsub.v1.IUpdateSnapshotRequest, options: CallOptions, callback: Callback<protos.google.pubsub.v1.ISnapshot, protos.google.pubsub.v1.IUpdateSnapshotRequest | null | undefined, {} | null | undefined>): void;
139
572
  updateSnapshot(request: protos.google.pubsub.v1.IUpdateSnapshotRequest, callback: Callback<protos.google.pubsub.v1.ISnapshot, protos.google.pubsub.v1.IUpdateSnapshotRequest | null | undefined, {} | null | undefined>): void;
573
+ /**
574
+ * Removes an existing snapshot. Snapshots are used in [Seek]
575
+ * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which
576
+ * allow you to manage message acknowledgments in bulk. That is, you can set
577
+ * the acknowledgment state of messages in an existing subscription to the
578
+ * state captured by a snapshot.
579
+ * When the snapshot is deleted, all messages retained in the snapshot
580
+ * are immediately dropped. After a snapshot is deleted, a new one may be
581
+ * created with the same name, but the new one has no association with the old
582
+ * snapshot or its subscription, unless the same subscription is specified.
583
+ *
584
+ * @param {Object} request
585
+ * The request object that will be sent.
586
+ * @param {string} request.snapshot
587
+ * Required. The name of the snapshot to delete.
588
+ * Format is `projects/{project}/snapshots/{snap}`.
589
+ * @param {object} [options]
590
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
591
+ * @returns {Promise} - The promise which resolves to an array.
592
+ * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
593
+ * Please see the
594
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
595
+ * for more details and examples.
596
+ * @example
597
+ * ```
598
+ * const [response] = await client.deleteSnapshot(request);
599
+ * ```
600
+ */
140
601
  deleteSnapshot(request?: protos.google.pubsub.v1.IDeleteSnapshotRequest, options?: CallOptions): Promise<[protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IDeleteSnapshotRequest | undefined, {} | undefined]>;
141
602
  deleteSnapshot(request: protos.google.pubsub.v1.IDeleteSnapshotRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IDeleteSnapshotRequest | null | undefined, {} | null | undefined>): void;
142
603
  deleteSnapshot(request: protos.google.pubsub.v1.IDeleteSnapshotRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.pubsub.v1.IDeleteSnapshotRequest | null | undefined, {} | null | undefined>): void;
604
+ /**
605
+ * Seeks an existing subscription to a point in time or to a given snapshot,
606
+ * whichever is provided in the request. Snapshots are used in [Seek]
607
+ * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which
608
+ * allow you to manage message acknowledgments in bulk. That is, you can set
609
+ * the acknowledgment state of messages in an existing subscription to the
610
+ * state captured by a snapshot. Note that both the subscription and the
611
+ * snapshot must be on the same topic.
612
+ *
613
+ * @param {Object} request
614
+ * The request object that will be sent.
615
+ * @param {string} request.subscription
616
+ * Required. The subscription to affect.
617
+ * @param {google.protobuf.Timestamp} request.time
618
+ * The time to seek to.
619
+ * Messages retained in the subscription that were published before this
620
+ * time are marked as acknowledged, and messages retained in the
621
+ * subscription that were published after this time are marked as
622
+ * unacknowledged. Note that this operation affects only those messages
623
+ * retained in the subscription (configured by the combination of
624
+ * `message_retention_duration` and `retain_acked_messages`). For example,
625
+ * if `time` corresponds to a point before the message retention
626
+ * window (or to a point before the system's notion of the subscription
627
+ * creation time), only retained messages will be marked as unacknowledged,
628
+ * and already-expunged messages will not be restored.
629
+ * @param {string} request.snapshot
630
+ * The snapshot to seek to. The snapshot's topic must be the same as that of
631
+ * the provided subscription.
632
+ * Format is `projects/{project}/snapshots/{snap}`.
633
+ * @param {object} [options]
634
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
635
+ * @returns {Promise} - The promise which resolves to an array.
636
+ * The first element of the array is an object representing [SeekResponse]{@link google.pubsub.v1.SeekResponse}.
637
+ * Please see the
638
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
639
+ * for more details and examples.
640
+ * @example
641
+ * ```
642
+ * const [response] = await client.seek(request);
643
+ * ```
644
+ */
143
645
  seek(request?: protos.google.pubsub.v1.ISeekRequest, options?: CallOptions): Promise<[protos.google.pubsub.v1.ISeekResponse, protos.google.pubsub.v1.ISeekRequest | undefined, {} | undefined]>;
144
646
  seek(request: protos.google.pubsub.v1.ISeekRequest, options: CallOptions, callback: Callback<protos.google.pubsub.v1.ISeekResponse, protos.google.pubsub.v1.ISeekRequest | null | undefined, {} | null | undefined>): void;
145
647
  seek(request: protos.google.pubsub.v1.ISeekRequest, callback: Callback<protos.google.pubsub.v1.ISeekResponse, protos.google.pubsub.v1.ISeekRequest | null | undefined, {} | null | undefined>): void;
@@ -162,13 +664,42 @@ export declare class SubscriberClient {
162
664
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming)
163
665
  * for more details and examples.
164
666
  * @example
667
+ * ```
165
668
  * const stream = client.streamingPull();
166
669
  * stream.on('data', (response) => { ... });
167
670
  * stream.on('end', () => { ... });
168
671
  * stream.write(request);
169
672
  * stream.end();
673
+ * ```
170
674
  */
171
675
  streamingPull(options?: CallOptions): gax.CancellableStream;
676
+ /**
677
+ * Lists matching subscriptions.
678
+ *
679
+ * @param {Object} request
680
+ * The request object that will be sent.
681
+ * @param {string} request.project
682
+ * Required. The name of the project in which to list subscriptions.
683
+ * Format is `projects/{project-id}`.
684
+ * @param {number} request.pageSize
685
+ * Maximum number of subscriptions to return.
686
+ * @param {string} request.pageToken
687
+ * The value returned by the last `ListSubscriptionsResponse`; indicates that
688
+ * this is a continuation of a prior `ListSubscriptions` call, and that the
689
+ * system should return the next page of data.
690
+ * @param {object} [options]
691
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
692
+ * @returns {Promise} - The promise which resolves to an array.
693
+ * The first element of the array is Array of [Subscription]{@link google.pubsub.v1.Subscription}.
694
+ * The client library will perform auto-pagination by default: it will call the API as many
695
+ * times as needed and will merge results from all the pages into this array.
696
+ * Note that it can affect your quota.
697
+ * We recommend using `listSubscriptionsAsync()`
698
+ * method described below for async iteration which you can stop as needed.
699
+ * Please see the
700
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
701
+ * for more details and examples.
702
+ */
172
703
  listSubscriptions(request?: protos.google.pubsub.v1.IListSubscriptionsRequest, options?: CallOptions): Promise<[protos.google.pubsub.v1.ISubscription[], protos.google.pubsub.v1.IListSubscriptionsRequest | null, protos.google.pubsub.v1.IListSubscriptionsResponse]>;
173
704
  listSubscriptions(request: protos.google.pubsub.v1.IListSubscriptionsRequest, options: CallOptions, callback: PaginationCallback<protos.google.pubsub.v1.IListSubscriptionsRequest, protos.google.pubsub.v1.IListSubscriptionsResponse | null | undefined, protos.google.pubsub.v1.ISubscription>): void;
174
705
  listSubscriptions(request: protos.google.pubsub.v1.IListSubscriptionsRequest, callback: PaginationCallback<protos.google.pubsub.v1.IListSubscriptionsRequest, protos.google.pubsub.v1.IListSubscriptionsResponse | null | undefined, protos.google.pubsub.v1.ISubscription>): void;
@@ -224,12 +755,45 @@ export declare class SubscriberClient {
224
755
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
225
756
  * for more details and examples.
226
757
  * @example
758
+ * ```
227
759
  * const iterable = client.listSubscriptionsAsync(request);
228
760
  * for await (const response of iterable) {
229
761
  * // process response
230
762
  * }
763
+ * ```
231
764
  */
232
765
  listSubscriptionsAsync(request?: protos.google.pubsub.v1.IListSubscriptionsRequest, options?: CallOptions): AsyncIterable<protos.google.pubsub.v1.ISubscription>;
766
+ /**
767
+ * Lists the existing snapshots. Snapshots are used in [Seek](
768
+ * https://cloud.google.com/pubsub/docs/replay-overview) operations, which
769
+ * allow you to manage message acknowledgments in bulk. That is, you can set
770
+ * the acknowledgment state of messages in an existing subscription to the
771
+ * state captured by a snapshot.
772
+ *
773
+ * @param {Object} request
774
+ * The request object that will be sent.
775
+ * @param {string} request.project
776
+ * Required. The name of the project in which to list snapshots.
777
+ * Format is `projects/{project-id}`.
778
+ * @param {number} request.pageSize
779
+ * Maximum number of snapshots to return.
780
+ * @param {string} request.pageToken
781
+ * The value returned by the last `ListSnapshotsResponse`; indicates that this
782
+ * is a continuation of a prior `ListSnapshots` call, and that the system
783
+ * should return the next page of data.
784
+ * @param {object} [options]
785
+ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
786
+ * @returns {Promise} - The promise which resolves to an array.
787
+ * The first element of the array is Array of [Snapshot]{@link google.pubsub.v1.Snapshot}.
788
+ * The client library will perform auto-pagination by default: it will call the API as many
789
+ * times as needed and will merge results from all the pages into this array.
790
+ * Note that it can affect your quota.
791
+ * We recommend using `listSnapshotsAsync()`
792
+ * method described below for async iteration which you can stop as needed.
793
+ * Please see the
794
+ * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
795
+ * for more details and examples.
796
+ */
233
797
  listSnapshots(request?: protos.google.pubsub.v1.IListSnapshotsRequest, options?: CallOptions): Promise<[protos.google.pubsub.v1.ISnapshot[], protos.google.pubsub.v1.IListSnapshotsRequest | null, protos.google.pubsub.v1.IListSnapshotsResponse]>;
234
798
  listSnapshots(request: protos.google.pubsub.v1.IListSnapshotsRequest, options: CallOptions, callback: PaginationCallback<protos.google.pubsub.v1.IListSnapshotsRequest, protos.google.pubsub.v1.IListSnapshotsResponse | null | undefined, protos.google.pubsub.v1.ISnapshot>): void;
235
799
  listSnapshots(request: protos.google.pubsub.v1.IListSnapshotsRequest, callback: PaginationCallback<protos.google.pubsub.v1.IListSnapshotsRequest, protos.google.pubsub.v1.IListSnapshotsResponse | null | undefined, protos.google.pubsub.v1.ISnapshot>): void;
@@ -285,10 +849,12 @@ export declare class SubscriberClient {
285
849
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
286
850
  * for more details and examples.
287
851
  * @example
852
+ * ```
288
853
  * const iterable = client.listSnapshotsAsync(request);
289
854
  * for await (const response of iterable) {
290
855
  * // process response
291
856
  * }
857
+ * ```
292
858
  */
293
859
  listSnapshotsAsync(request?: protos.google.pubsub.v1.IListSnapshotsRequest, options?: CallOptions): AsyncIterable<protos.google.pubsub.v1.ISnapshot>;
294
860
  /**