@google-cloud/pubsub 2.16.6 → 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 (62) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +54 -53
  3. package/build/protos/protos.d.ts +2 -1
  4. package/build/protos/protos.js +7 -0
  5. package/build/protos/protos.json +14 -1
  6. package/build/src/iam.d.ts +180 -0
  7. package/build/src/iam.js +11 -176
  8. package/build/src/iam.js.map +1 -1
  9. package/build/src/index.d.ts +13 -4
  10. package/build/src/index.js +12 -4
  11. package/build/src/index.js.map +1 -1
  12. package/build/src/lease-manager.d.ts +7 -2
  13. package/build/src/lease-manager.js +19 -4
  14. package/build/src/lease-manager.js.map +1 -1
  15. package/build/src/publisher/flow-control.d.ts +90 -0
  16. package/build/src/publisher/flow-control.js +145 -0
  17. package/build/src/publisher/flow-control.js.map +1 -0
  18. package/build/src/publisher/flow-publisher.d.ts +95 -0
  19. package/build/src/publisher/flow-publisher.js +133 -0
  20. package/build/src/publisher/flow-publisher.js.map +1 -0
  21. package/build/src/publisher/index.d.ts +33 -5
  22. package/build/src/publisher/index.js +16 -39
  23. package/build/src/publisher/index.js.map +1 -1
  24. package/build/src/publisher/message-batch.d.ts +1 -1
  25. package/build/src/publisher/message-batch.js +4 -3
  26. package/build/src/publisher/message-batch.js.map +1 -1
  27. package/build/src/publisher/message-queues.js.map +1 -1
  28. package/build/src/publisher/pubsub-message.d.ts +52 -0
  29. package/build/src/publisher/pubsub-message.js +56 -0
  30. package/build/src/publisher/pubsub-message.js.map +1 -0
  31. package/build/src/pubsub.d.ts +354 -4
  32. package/build/src/pubsub.js +28 -322
  33. package/build/src/pubsub.js.map +1 -1
  34. package/build/src/schema.d.ts +9 -4
  35. package/build/src/schema.js +9 -4
  36. package/build/src/schema.js.map +1 -1
  37. package/build/src/snapshot.d.ts +87 -0
  38. package/build/src/snapshot.js +7 -83
  39. package/build/src/snapshot.js.map +1 -1
  40. package/build/src/subscriber.d.ts +6 -0
  41. package/build/src/subscriber.js +6 -0
  42. package/build/src/subscriber.js.map +1 -1
  43. package/build/src/subscription.d.ts +439 -9
  44. package/build/src/subscription.js +38 -404
  45. package/build/src/subscription.js.map +1 -1
  46. package/build/src/topic.d.ts +481 -1
  47. package/build/src/topic.js +51 -430
  48. package/build/src/topic.js.map +1 -1
  49. package/build/src/util.d.ts +2 -1
  50. package/build/src/util.js +2 -2
  51. package/build/src/util.js.map +1 -1
  52. package/build/src/v1/publisher_client.d.ts +262 -0
  53. package/build/src/v1/publisher_client.js +11 -244
  54. package/build/src/v1/publisher_client.js.map +1 -1
  55. package/build/src/v1/publisher_client_config.json +2 -2
  56. package/build/src/v1/schema_service_client.d.ts +165 -0
  57. package/build/src/v1/schema_service_client.js +7 -153
  58. package/build/src/v1/schema_service_client.js.map +1 -1
  59. package/build/src/v1/subscriber_client.d.ts +566 -0
  60. package/build/src/v1/subscriber_client.js +11 -534
  61. package/build/src/v1/subscriber_client.js.map +1 -1
  62. package/package.json +2 -2
@@ -100,6 +100,10 @@ class SubscriberClient {
100
100
  this._opts = opts;
101
101
  // Save the auth object to the client, for use by other methods.
102
102
  this.auth = this._gaxGrpc.auth;
103
+ // Set useJWTAccessWithScope on the auth object.
104
+ this.auth.useJWTAccessWithScope = true;
105
+ // Set defaultServicePath on the auth object.
106
+ this.auth.defaultServicePath = staticMembers.servicePath;
103
107
  // Set the default scopes in auth client if needed.
104
108
  if (servicePath === staticMembers.servicePath) {
105
109
  this.auth.defaultScopes = staticMembers.scopes;
@@ -248,10 +252,6 @@ class SubscriberClient {
248
252
  'https://www.googleapis.com/auth/pubsub',
249
253
  ];
250
254
  }
251
- /**
252
- * Return the project ID used by this class.
253
- * @returns {Promise} A promise that resolves to string containing the project ID.
254
- */
255
255
  getProjectId(callback) {
256
256
  if (callback) {
257
257
  this.auth.getProjectId(callback);
@@ -259,132 +259,6 @@ class SubscriberClient {
259
259
  }
260
260
  return this.auth.getProjectId();
261
261
  }
262
- /**
263
- * Creates a subscription to a given topic. See the [resource name rules]
264
- * (https://cloud.google.com/pubsub/docs/admin#resource_names).
265
- * If the subscription already exists, returns `ALREADY_EXISTS`.
266
- * If the corresponding topic doesn't exist, returns `NOT_FOUND`.
267
- *
268
- * If the name is not provided in the request, the server will assign a random
269
- * name for this subscription on the same project as the topic, conforming
270
- * to the [resource name format]
271
- * (https://cloud.google.com/pubsub/docs/admin#resource_names). The generated
272
- * name is populated in the returned Subscription object. Note that for REST
273
- * API requests, you must specify a name in the request.
274
- *
275
- * @param {Object} request
276
- * The request object that will be sent.
277
- * @param {string} request.name
278
- * Required. The name of the subscription. It must have the format
279
- * `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
280
- * start with a letter, and contain only letters (`[A-Za-z]`), numbers
281
- * (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
282
- * plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
283
- * in length, and it must not start with `"goog"`.
284
- * @param {string} request.topic
285
- * Required. The name of the topic from which this subscription is receiving
286
- * messages. Format is `projects/{project}/topics/{topic}`. The value of this
287
- * field will be `_deleted-topic_` if the topic has been deleted.
288
- * @param {google.pubsub.v1.PushConfig} request.pushConfig
289
- * If push delivery is used with this subscription, this field is
290
- * used to configure it. An empty `pushConfig` signifies that the subscriber
291
- * will pull and ack messages using API methods.
292
- * @param {number} request.ackDeadlineSeconds
293
- * The approximate amount of time (on a best-effort basis) Pub/Sub waits for
294
- * the subscriber to acknowledge receipt before resending the message. In the
295
- * interval after the message is delivered and before it is acknowledged, it
296
- * is considered to be <i>outstanding</i>. During that time period, the
297
- * message will not be redelivered (on a best-effort basis).
298
- *
299
- * For pull subscriptions, this value is used as the initial value for the ack
300
- * deadline. To override this value for a given message, call
301
- * `ModifyAckDeadline` with the corresponding `ack_id` if using
302
- * non-streaming pull or send the `ack_id` in a
303
- * `StreamingModifyAckDeadlineRequest` if using streaming pull.
304
- * The minimum custom deadline you can specify is 10 seconds.
305
- * The maximum custom deadline you can specify is 600 seconds (10 minutes).
306
- * If this parameter is 0, a default value of 10 seconds is used.
307
- *
308
- * For push delivery, this value is also used to set the request timeout for
309
- * the call to the push endpoint.
310
- *
311
- * If the subscriber never acknowledges the message, the Pub/Sub
312
- * system will eventually redeliver the message.
313
- * @param {boolean} request.retainAckedMessages
314
- * Indicates whether to retain acknowledged messages. If true, then
315
- * messages are not expunged from the subscription's backlog, even if they are
316
- * acknowledged, until they fall out of the `message_retention_duration`
317
- * window. This must be true if you would like to [`Seek` to a timestamp]
318
- * (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in
319
- * the past to replay previously-acknowledged messages.
320
- * @param {google.protobuf.Duration} request.messageRetentionDuration
321
- * How long to retain unacknowledged messages in the subscription's backlog,
322
- * from the moment a message is published.
323
- * If `retain_acked_messages` is true, then this also configures the retention
324
- * of acknowledged messages, and thus configures how far back in time a `Seek`
325
- * can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
326
- * minutes.
327
- * @param {number[]} request.labels
328
- * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
329
- * managing labels</a>.
330
- * @param {boolean} request.enableMessageOrdering
331
- * If true, messages published with the same `ordering_key` in `PubsubMessage`
332
- * will be delivered to the subscribers in the order in which they
333
- * are received by the Pub/Sub system. Otherwise, they may be delivered in
334
- * any order.
335
- * @param {google.pubsub.v1.ExpirationPolicy} request.expirationPolicy
336
- * A policy that specifies the conditions for this subscription's expiration.
337
- * A subscription is considered active as long as any connected subscriber is
338
- * successfully consuming messages from the subscription or is issuing
339
- * operations on the subscription. If `expiration_policy` is not set, a
340
- * *default policy* with `ttl` of 31 days will be used. The minimum allowed
341
- * value for `expiration_policy.ttl` is 1 day.
342
- * @param {string} request.filter
343
- * An expression written in the Pub/Sub [filter
344
- * language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
345
- * then only `PubsubMessage`s whose `attributes` field matches the filter are
346
- * delivered on this subscription. If empty, then no messages are filtered
347
- * out.
348
- * @param {google.pubsub.v1.DeadLetterPolicy} request.deadLetterPolicy
349
- * A policy that specifies the conditions for dead lettering messages in
350
- * this subscription. If dead_letter_policy is not set, dead lettering
351
- * is disabled.
352
- *
353
- * The Cloud Pub/Sub service account associated with this subscriptions's
354
- * parent project (i.e.,
355
- * service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
356
- * permission to Acknowledge() messages on this subscription.
357
- * @param {google.pubsub.v1.RetryPolicy} request.retryPolicy
358
- * A policy that specifies how Pub/Sub retries message delivery for this
359
- * subscription.
360
- *
361
- * If not set, the default retry policy is applied. This generally implies
362
- * that messages will be retried as soon as possible for healthy subscribers.
363
- * RetryPolicy will be triggered on NACKs or acknowledgement deadline
364
- * exceeded events for a given message.
365
- * @param {boolean} request.detached
366
- * Indicates whether the subscription is detached from its topic. Detached
367
- * subscriptions don't receive messages from their topic and don't retain any
368
- * backlog. `Pull` and `StreamingPull` requests will return
369
- * FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
370
- * the endpoint will not be made.
371
- * @param {google.protobuf.Duration} request.topicMessageRetentionDuration
372
- * Output only. Indicates the minimum duration for which a message is retained
373
- * after it is published to the subscription's topic. If this field is set,
374
- * messages published to the subscription's topic in the last
375
- * `topic_message_retention_duration` are always available to subscribers. See
376
- * the `message_retention_duration` field in `Topic`. This field is set only
377
- * in responses from the server; it is ignored if it is set in any requests.
378
- * @param {object} [options]
379
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
380
- * @returns {Promise} - The promise which resolves to an array.
381
- * The first element of the array is an object representing [Subscription]{@link google.pubsub.v1.Subscription}.
382
- * Please see the
383
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
384
- * for more details and examples.
385
- * @example
386
- * const [response] = await client.createSubscription(request);
387
- */
388
262
  createSubscription(request, optionsOrCallback, callback) {
389
263
  request = request || {};
390
264
  let options;
@@ -405,24 +279,6 @@ class SubscriberClient {
405
279
  this.initialize();
406
280
  return this.innerApiCalls.createSubscription(request, options, callback);
407
281
  }
408
- /**
409
- * Gets the configuration details of a subscription.
410
- *
411
- * @param {Object} request
412
- * The request object that will be sent.
413
- * @param {string} request.subscription
414
- * Required. The name of the subscription to get.
415
- * Format is `projects/{project}/subscriptions/{sub}`.
416
- * @param {object} [options]
417
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
418
- * @returns {Promise} - The promise which resolves to an array.
419
- * The first element of the array is an object representing [Subscription]{@link google.pubsub.v1.Subscription}.
420
- * Please see the
421
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
422
- * for more details and examples.
423
- * @example
424
- * const [response] = await client.getSubscription(request);
425
- */
426
282
  getSubscription(request, optionsOrCallback, callback) {
427
283
  request = request || {};
428
284
  let options;
@@ -443,27 +299,6 @@ class SubscriberClient {
443
299
  this.initialize();
444
300
  return this.innerApiCalls.getSubscription(request, options, callback);
445
301
  }
446
- /**
447
- * Updates an existing subscription. Note that certain properties of a
448
- * subscription, such as its topic, are not modifiable.
449
- *
450
- * @param {Object} request
451
- * The request object that will be sent.
452
- * @param {google.pubsub.v1.Subscription} request.subscription
453
- * Required. The updated subscription object.
454
- * @param {google.protobuf.FieldMask} request.updateMask
455
- * Required. Indicates which fields in the provided subscription to update.
456
- * Must be specified and non-empty.
457
- * @param {object} [options]
458
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
459
- * @returns {Promise} - The promise which resolves to an array.
460
- * The first element of the array is an object representing [Subscription]{@link google.pubsub.v1.Subscription}.
461
- * Please see the
462
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
463
- * for more details and examples.
464
- * @example
465
- * const [response] = await client.updateSubscription(request);
466
- */
467
302
  updateSubscription(request, optionsOrCallback, callback) {
468
303
  request = request || {};
469
304
  let options;
@@ -484,28 +319,6 @@ class SubscriberClient {
484
319
  this.initialize();
485
320
  return this.innerApiCalls.updateSubscription(request, options, callback);
486
321
  }
487
- /**
488
- * Deletes an existing subscription. All messages retained in the subscription
489
- * are immediately dropped. Calls to `Pull` after deletion will return
490
- * `NOT_FOUND`. After a subscription is deleted, a new one may be created with
491
- * the same name, but the new one has no association with the old
492
- * subscription or its topic unless the same topic is specified.
493
- *
494
- * @param {Object} request
495
- * The request object that will be sent.
496
- * @param {string} request.subscription
497
- * Required. The subscription to delete.
498
- * Format is `projects/{project}/subscriptions/{sub}`.
499
- * @param {object} [options]
500
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
501
- * @returns {Promise} - The promise which resolves to an array.
502
- * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
503
- * Please see the
504
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
505
- * for more details and examples.
506
- * @example
507
- * const [response] = await client.deleteSubscription(request);
508
- */
509
322
  deleteSubscription(request, optionsOrCallback, callback) {
510
323
  request = request || {};
511
324
  let options;
@@ -526,39 +339,6 @@ class SubscriberClient {
526
339
  this.initialize();
527
340
  return this.innerApiCalls.deleteSubscription(request, options, callback);
528
341
  }
529
- /**
530
- * Modifies the ack deadline for a specific message. This method is useful
531
- * to indicate that more time is needed to process a message by the
532
- * subscriber, or to make the message available for redelivery if the
533
- * processing was interrupted. Note that this does not modify the
534
- * subscription-level `ackDeadlineSeconds` used for subsequent messages.
535
- *
536
- * @param {Object} request
537
- * The request object that will be sent.
538
- * @param {string} request.subscription
539
- * Required. The name of the subscription.
540
- * Format is `projects/{project}/subscriptions/{sub}`.
541
- * @param {string[]} request.ackIds
542
- * Required. List of acknowledgment IDs.
543
- * @param {number} request.ackDeadlineSeconds
544
- * Required. The new ack deadline with respect to the time this request was
545
- * sent to the Pub/Sub system. For example, if the value is 10, the new ack
546
- * deadline will expire 10 seconds after the `ModifyAckDeadline` call was
547
- * made. Specifying zero might immediately make the message available for
548
- * delivery to another subscriber client. This typically results in an
549
- * increase in the rate of message redeliveries (that is, duplicates).
550
- * The minimum deadline you can specify is 0 seconds.
551
- * The maximum deadline you can specify is 600 seconds (10 minutes).
552
- * @param {object} [options]
553
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
554
- * @returns {Promise} - The promise which resolves to an array.
555
- * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
556
- * Please see the
557
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
558
- * for more details and examples.
559
- * @example
560
- * const [response] = await client.modifyAckDeadline(request);
561
- */
562
342
  modifyAckDeadline(request, optionsOrCallback, callback) {
563
343
  request = request || {};
564
344
  let options;
@@ -579,34 +359,6 @@ class SubscriberClient {
579
359
  this.initialize();
580
360
  return this.innerApiCalls.modifyAckDeadline(request, options, callback);
581
361
  }
582
- /**
583
- * Acknowledges the messages associated with the `ack_ids` in the
584
- * `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages
585
- * from the subscription.
586
- *
587
- * Acknowledging a message whose ack deadline has expired may succeed,
588
- * but such a message may be redelivered later. Acknowledging a message more
589
- * than once will not result in an error.
590
- *
591
- * @param {Object} request
592
- * The request object that will be sent.
593
- * @param {string} request.subscription
594
- * Required. The subscription whose message is being acknowledged.
595
- * Format is `projects/{project}/subscriptions/{sub}`.
596
- * @param {string[]} request.ackIds
597
- * Required. The acknowledgment ID for the messages being acknowledged that
598
- * was returned by the Pub/Sub system in the `Pull` response. Must not be
599
- * empty.
600
- * @param {object} [options]
601
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
602
- * @returns {Promise} - The promise which resolves to an array.
603
- * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
604
- * Please see the
605
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
606
- * for more details and examples.
607
- * @example
608
- * const [response] = await client.acknowledge(request);
609
- */
610
362
  acknowledge(request, optionsOrCallback, callback) {
611
363
  request = request || {};
612
364
  let options;
@@ -627,38 +379,6 @@ class SubscriberClient {
627
379
  this.initialize();
628
380
  return this.innerApiCalls.acknowledge(request, options, callback);
629
381
  }
630
- /**
631
- * Pulls messages from the server. The server may return `UNAVAILABLE` if
632
- * there are too many concurrent pull requests pending for the given
633
- * subscription.
634
- *
635
- * @param {Object} request
636
- * The request object that will be sent.
637
- * @param {string} request.subscription
638
- * Required. The subscription from which messages should be pulled.
639
- * Format is `projects/{project}/subscriptions/{sub}`.
640
- * @param {boolean} [request.returnImmediately]
641
- * Optional. If this field set to true, the system will respond immediately
642
- * even if it there are no messages available to return in the `Pull`
643
- * response. Otherwise, the system may wait (for a bounded amount of time)
644
- * until at least one message is available, rather than returning no messages.
645
- * Warning: setting this field to `true` is discouraged because it adversely
646
- * impacts the performance of `Pull` operations. We recommend that users do
647
- * not set this field.
648
- * @param {number} request.maxMessages
649
- * Required. The maximum number of messages to return for this request. Must
650
- * be a positive integer. The Pub/Sub system may return fewer than the number
651
- * specified.
652
- * @param {object} [options]
653
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
654
- * @returns {Promise} - The promise which resolves to an array.
655
- * The first element of the array is an object representing [PullResponse]{@link google.pubsub.v1.PullResponse}.
656
- * Please see the
657
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
658
- * for more details and examples.
659
- * @example
660
- * const [response] = await client.pull(request);
661
- */
662
382
  pull(request, optionsOrCallback, callback) {
663
383
  request = request || {};
664
384
  let options;
@@ -679,36 +399,6 @@ class SubscriberClient {
679
399
  this.initialize();
680
400
  return this.innerApiCalls.pull(request, options, callback);
681
401
  }
682
- /**
683
- * Modifies the `PushConfig` for a specified subscription.
684
- *
685
- * This may be used to change a push subscription to a pull one (signified by
686
- * an empty `PushConfig`) or vice versa, or change the endpoint URL and other
687
- * attributes of a push subscription. Messages will accumulate for delivery
688
- * continuously through the call regardless of changes to the `PushConfig`.
689
- *
690
- * @param {Object} request
691
- * The request object that will be sent.
692
- * @param {string} request.subscription
693
- * Required. The name of the subscription.
694
- * Format is `projects/{project}/subscriptions/{sub}`.
695
- * @param {google.pubsub.v1.PushConfig} request.pushConfig
696
- * Required. The push configuration for future deliveries.
697
- *
698
- * An empty `pushConfig` indicates that the Pub/Sub system should
699
- * stop pushing messages from the given subscription and allow
700
- * messages to be pulled and acknowledged - effectively pausing
701
- * the subscription if `Pull` or `StreamingPull` is not called.
702
- * @param {object} [options]
703
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
704
- * @returns {Promise} - The promise which resolves to an array.
705
- * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
706
- * Please see the
707
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
708
- * for more details and examples.
709
- * @example
710
- * const [response] = await client.modifyPushConfig(request);
711
- */
712
402
  modifyPushConfig(request, optionsOrCallback, callback) {
713
403
  request = request || {};
714
404
  let options;
@@ -729,28 +419,6 @@ class SubscriberClient {
729
419
  this.initialize();
730
420
  return this.innerApiCalls.modifyPushConfig(request, options, callback);
731
421
  }
732
- /**
733
- * Gets the configuration details of a snapshot. Snapshots are used in
734
- * <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
735
- * operations, which allow you to manage message acknowledgments in bulk. That
736
- * is, you can set the acknowledgment state of messages in an existing
737
- * subscription to the state captured by a snapshot.
738
- *
739
- * @param {Object} request
740
- * The request object that will be sent.
741
- * @param {string} request.snapshot
742
- * Required. The name of the snapshot to get.
743
- * Format is `projects/{project}/snapshots/{snap}`.
744
- * @param {object} [options]
745
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
746
- * @returns {Promise} - The promise which resolves to an array.
747
- * The first element of the array is an object representing [Snapshot]{@link google.pubsub.v1.Snapshot}.
748
- * Please see the
749
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
750
- * for more details and examples.
751
- * @example
752
- * const [response] = await client.getSnapshot(request);
753
- */
754
422
  getSnapshot(request, optionsOrCallback, callback) {
755
423
  request = request || {};
756
424
  let options;
@@ -771,56 +439,6 @@ class SubscriberClient {
771
439
  this.initialize();
772
440
  return this.innerApiCalls.getSnapshot(request, options, callback);
773
441
  }
774
- /**
775
- * Creates a snapshot from the requested subscription. Snapshots are used in
776
- * [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
777
- * which allow you to manage message acknowledgments in bulk. That is, you can
778
- * set the acknowledgment state of messages in an existing subscription to the
779
- * state captured by a snapshot.
780
- * If the snapshot already exists, returns `ALREADY_EXISTS`.
781
- * If the requested subscription doesn't exist, returns `NOT_FOUND`.
782
- * If the backlog in the subscription is too old -- and the resulting snapshot
783
- * would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.
784
- * See also the `Snapshot.expire_time` field. If the name is not provided in
785
- * the request, the server will assign a random
786
- * name for this snapshot on the same project as the subscription, conforming
787
- * to the [resource name format]
788
- * (https://cloud.google.com/pubsub/docs/admin#resource_names). The
789
- * generated name is populated in the returned Snapshot object. Note that for
790
- * REST API requests, you must specify a name in the request.
791
- *
792
- * @param {Object} request
793
- * The request object that will be sent.
794
- * @param {string} request.name
795
- * Required. User-provided name for this snapshot. If the name is not provided
796
- * in the request, the server will assign a random name for this snapshot on
797
- * the same project as the subscription. Note that for REST API requests, you
798
- * must specify a name. See the <a
799
- * href="https://cloud.google.com/pubsub/docs/admin#resource_names"> resource
800
- * name rules</a>. Format is `projects/{project}/snapshots/{snap}`.
801
- * @param {string} request.subscription
802
- * Required. The subscription whose backlog the snapshot retains.
803
- * Specifically, the created snapshot is guaranteed to retain:
804
- * (a) The existing backlog on the subscription. More precisely, this is
805
- * defined as the messages in the subscription's backlog that are
806
- * unacknowledged upon the successful completion of the
807
- * `CreateSnapshot` request; as well as:
808
- * (b) Any messages published to the subscription's topic following the
809
- * successful completion of the CreateSnapshot request.
810
- * Format is `projects/{project}/subscriptions/{sub}`.
811
- * @param {number[]} request.labels
812
- * See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
813
- * managing labels</a>.
814
- * @param {object} [options]
815
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
816
- * @returns {Promise} - The promise which resolves to an array.
817
- * The first element of the array is an object representing [Snapshot]{@link google.pubsub.v1.Snapshot}.
818
- * Please see the
819
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
820
- * for more details and examples.
821
- * @example
822
- * const [response] = await client.createSnapshot(request);
823
- */
824
442
  createSnapshot(request, optionsOrCallback, callback) {
825
443
  request = request || {};
826
444
  let options;
@@ -841,31 +459,6 @@ class SubscriberClient {
841
459
  this.initialize();
842
460
  return this.innerApiCalls.createSnapshot(request, options, callback);
843
461
  }
844
- /**
845
- * Updates an existing snapshot. Snapshots are used in
846
- * <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
847
- * operations, which allow
848
- * you to manage message acknowledgments in bulk. That is, you can set the
849
- * acknowledgment state of messages in an existing subscription to the state
850
- * captured by a snapshot.
851
- *
852
- * @param {Object} request
853
- * The request object that will be sent.
854
- * @param {google.pubsub.v1.Snapshot} request.snapshot
855
- * Required. The updated snapshot object.
856
- * @param {google.protobuf.FieldMask} request.updateMask
857
- * Required. Indicates which fields in the provided snapshot to update.
858
- * Must be specified and non-empty.
859
- * @param {object} [options]
860
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
861
- * @returns {Promise} - The promise which resolves to an array.
862
- * The first element of the array is an object representing [Snapshot]{@link google.pubsub.v1.Snapshot}.
863
- * Please see the
864
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
865
- * for more details and examples.
866
- * @example
867
- * const [response] = await client.updateSnapshot(request);
868
- */
869
462
  updateSnapshot(request, optionsOrCallback, callback) {
870
463
  request = request || {};
871
464
  let options;
@@ -886,32 +479,6 @@ class SubscriberClient {
886
479
  this.initialize();
887
480
  return this.innerApiCalls.updateSnapshot(request, options, callback);
888
481
  }
889
- /**
890
- * Removes an existing snapshot. Snapshots are used in [Seek]
891
- * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which
892
- * allow you to manage message acknowledgments in bulk. That is, you can set
893
- * the acknowledgment state of messages in an existing subscription to the
894
- * state captured by a snapshot.
895
- * When the snapshot is deleted, all messages retained in the snapshot
896
- * are immediately dropped. After a snapshot is deleted, a new one may be
897
- * created with the same name, but the new one has no association with the old
898
- * snapshot or its subscription, unless the same subscription is specified.
899
- *
900
- * @param {Object} request
901
- * The request object that will be sent.
902
- * @param {string} request.snapshot
903
- * Required. The name of the snapshot to delete.
904
- * Format is `projects/{project}/snapshots/{snap}`.
905
- * @param {object} [options]
906
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
907
- * @returns {Promise} - The promise which resolves to an array.
908
- * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
909
- * Please see the
910
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
911
- * for more details and examples.
912
- * @example
913
- * const [response] = await client.deleteSnapshot(request);
914
- */
915
482
  deleteSnapshot(request, optionsOrCallback, callback) {
916
483
  request = request || {};
917
484
  let options;
@@ -932,45 +499,6 @@ class SubscriberClient {
932
499
  this.initialize();
933
500
  return this.innerApiCalls.deleteSnapshot(request, options, callback);
934
501
  }
935
- /**
936
- * Seeks an existing subscription to a point in time or to a given snapshot,
937
- * whichever is provided in the request. Snapshots are used in [Seek]
938
- * (https://cloud.google.com/pubsub/docs/replay-overview) operations, which
939
- * allow you to manage message acknowledgments in bulk. That is, you can set
940
- * the acknowledgment state of messages in an existing subscription to the
941
- * state captured by a snapshot. Note that both the subscription and the
942
- * snapshot must be on the same topic.
943
- *
944
- * @param {Object} request
945
- * The request object that will be sent.
946
- * @param {string} request.subscription
947
- * Required. The subscription to affect.
948
- * @param {google.protobuf.Timestamp} request.time
949
- * The time to seek to.
950
- * Messages retained in the subscription that were published before this
951
- * time are marked as acknowledged, and messages retained in the
952
- * subscription that were published after this time are marked as
953
- * unacknowledged. Note that this operation affects only those messages
954
- * retained in the subscription (configured by the combination of
955
- * `message_retention_duration` and `retain_acked_messages`). For example,
956
- * if `time` corresponds to a point before the message retention
957
- * window (or to a point before the system's notion of the subscription
958
- * creation time), only retained messages will be marked as unacknowledged,
959
- * and already-expunged messages will not be restored.
960
- * @param {string} request.snapshot
961
- * The snapshot to seek to. The snapshot's topic must be the same as that of
962
- * the provided subscription.
963
- * Format is `projects/{project}/snapshots/{snap}`.
964
- * @param {object} [options]
965
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
966
- * @returns {Promise} - The promise which resolves to an array.
967
- * The first element of the array is an object representing [SeekResponse]{@link google.pubsub.v1.SeekResponse}.
968
- * Please see the
969
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
970
- * for more details and examples.
971
- * @example
972
- * const [response] = await client.seek(request);
973
- */
974
502
  seek(request, optionsOrCallback, callback) {
975
503
  request = request || {};
976
504
  let options;
@@ -1010,43 +538,18 @@ class SubscriberClient {
1010
538
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming)
1011
539
  * for more details and examples.
1012
540
  * @example
541
+ * ```
1013
542
  * const stream = client.streamingPull();
1014
543
  * stream.on('data', (response) => { ... });
1015
544
  * stream.on('end', () => { ... });
1016
545
  * stream.write(request);
1017
546
  * stream.end();
547
+ * ```
1018
548
  */
1019
549
  streamingPull(options) {
1020
550
  this.initialize();
1021
551
  return this.innerApiCalls.streamingPull(options);
1022
552
  }
1023
- /**
1024
- * Lists matching subscriptions.
1025
- *
1026
- * @param {Object} request
1027
- * The request object that will be sent.
1028
- * @param {string} request.project
1029
- * Required. The name of the project in which to list subscriptions.
1030
- * Format is `projects/{project-id}`.
1031
- * @param {number} request.pageSize
1032
- * Maximum number of subscriptions to return.
1033
- * @param {string} request.pageToken
1034
- * The value returned by the last `ListSubscriptionsResponse`; indicates that
1035
- * this is a continuation of a prior `ListSubscriptions` call, and that the
1036
- * system should return the next page of data.
1037
- * @param {object} [options]
1038
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1039
- * @returns {Promise} - The promise which resolves to an array.
1040
- * The first element of the array is Array of [Subscription]{@link google.pubsub.v1.Subscription}.
1041
- * The client library will perform auto-pagination by default: it will call the API as many
1042
- * times as needed and will merge results from all the pages into this array.
1043
- * Note that it can affect your quota.
1044
- * We recommend using `listSubscriptionsAsync()`
1045
- * method described below for async iteration which you can stop as needed.
1046
- * Please see the
1047
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1048
- * for more details and examples.
1049
- */
1050
553
  listSubscriptions(request, optionsOrCallback, callback) {
1051
554
  request = request || {};
1052
555
  let options;
@@ -1131,10 +634,12 @@ class SubscriberClient {
1131
634
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1132
635
  * for more details and examples.
1133
636
  * @example
637
+ * ```
1134
638
  * const iterable = client.listSubscriptionsAsync(request);
1135
639
  * for await (const response of iterable) {
1136
640
  * // process response
1137
641
  * }
642
+ * ```
1138
643
  */
1139
644
  listSubscriptionsAsync(request, options) {
1140
645
  request = request || {};
@@ -1150,37 +655,6 @@ class SubscriberClient {
1150
655
  this.initialize();
1151
656
  return this.descriptors.page.listSubscriptions.asyncIterate(this.innerApiCalls['listSubscriptions'], request, callSettings);
1152
657
  }
1153
- /**
1154
- * Lists the existing snapshots. Snapshots are used in [Seek](
1155
- * https://cloud.google.com/pubsub/docs/replay-overview) operations, which
1156
- * allow you to manage message acknowledgments in bulk. That is, you can set
1157
- * the acknowledgment state of messages in an existing subscription to the
1158
- * state captured by a snapshot.
1159
- *
1160
- * @param {Object} request
1161
- * The request object that will be sent.
1162
- * @param {string} request.project
1163
- * Required. The name of the project in which to list snapshots.
1164
- * Format is `projects/{project-id}`.
1165
- * @param {number} request.pageSize
1166
- * Maximum number of snapshots to return.
1167
- * @param {string} request.pageToken
1168
- * The value returned by the last `ListSnapshotsResponse`; indicates that this
1169
- * is a continuation of a prior `ListSnapshots` call, and that the system
1170
- * should return the next page of data.
1171
- * @param {object} [options]
1172
- * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
1173
- * @returns {Promise} - The promise which resolves to an array.
1174
- * The first element of the array is Array of [Snapshot]{@link google.pubsub.v1.Snapshot}.
1175
- * The client library will perform auto-pagination by default: it will call the API as many
1176
- * times as needed and will merge results from all the pages into this array.
1177
- * Note that it can affect your quota.
1178
- * We recommend using `listSnapshotsAsync()`
1179
- * method described below for async iteration which you can stop as needed.
1180
- * Please see the
1181
- * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1182
- * for more details and examples.
1183
- */
1184
658
  listSnapshots(request, optionsOrCallback, callback) {
1185
659
  request = request || {};
1186
660
  let options;
@@ -1265,10 +739,12 @@ class SubscriberClient {
1265
739
  * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
1266
740
  * for more details and examples.
1267
741
  * @example
742
+ * ```
1268
743
  * const iterable = client.listSnapshotsAsync(request);
1269
744
  * for await (const response of iterable) {
1270
745
  * // process response
1271
746
  * }
747
+ * ```
1272
748
  */
1273
749
  listSnapshotsAsync(request, options) {
1274
750
  request = request || {};
@@ -1551,6 +1027,7 @@ class SubscriberClient {
1551
1027
  return this.subscriberStub.then(stub => {
1552
1028
  this._terminated = true;
1553
1029
  stub.close();
1030
+ this.iamClient.close();
1554
1031
  });
1555
1032
  }
1556
1033
  return Promise.resolve();