@google-cloud/pubsub 2.18.1 → 2.18.5

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