google-cloud-pubsub 0.33.2 → 0.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -4
  3. data/CHANGELOG.md +45 -0
  4. data/EMULATOR.md +2 -2
  5. data/OVERVIEW.md +81 -43
  6. data/lib/google-cloud-pubsub.rb +10 -7
  7. data/lib/google/cloud/pubsub.rb +38 -21
  8. data/lib/google/cloud/pubsub/async_publisher.rb +8 -6
  9. data/lib/google/cloud/pubsub/batch_publisher.rb +7 -5
  10. data/lib/google/cloud/pubsub/convert.rb +5 -3
  11. data/lib/google/cloud/pubsub/credentials.rb +6 -4
  12. data/lib/google/cloud/pubsub/message.rb +9 -6
  13. data/lib/google/cloud/pubsub/policy.rb +12 -10
  14. data/lib/google/cloud/pubsub/project.rb +30 -28
  15. data/lib/google/cloud/pubsub/publish_result.rb +3 -1
  16. data/lib/google/cloud/pubsub/received_message.rb +11 -10
  17. data/lib/google/cloud/pubsub/service.rb +47 -37
  18. data/lib/google/cloud/pubsub/snapshot.rb +11 -9
  19. data/lib/google/cloud/pubsub/snapshot/list.rb +10 -8
  20. data/lib/google/cloud/pubsub/subscriber.rb +32 -6
  21. data/lib/google/cloud/pubsub/subscriber/enumerator_queue.rb +3 -1
  22. data/lib/google/cloud/pubsub/subscriber/inventory.rb +4 -2
  23. data/lib/google/cloud/pubsub/subscriber/stream.rb +23 -43
  24. data/lib/google/cloud/pubsub/subscriber/timed_unary_buffer.rb +221 -0
  25. data/lib/google/cloud/pubsub/subscription.rb +157 -80
  26. data/lib/google/cloud/pubsub/subscription/list.rb +12 -10
  27. data/lib/google/cloud/pubsub/topic.rb +79 -51
  28. data/lib/google/cloud/pubsub/topic/list.rb +10 -8
  29. data/lib/google/cloud/pubsub/v1/credentials.rb +4 -2
  30. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb +1 -43
  31. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb +1 -108
  32. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +1 -1
  33. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb +1 -1
  34. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +1 -1
  35. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +1 -1
  36. data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +107 -61
  37. data/lib/google/cloud/pubsub/v1/publisher_client.rb +58 -55
  38. data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -4
  39. data/lib/google/cloud/pubsub/v1/subscriber_client.rb +177 -128
  40. data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -4
  41. data/lib/google/cloud/pubsub/version.rb +4 -2
  42. data/lib/google/pubsub/v1/pubsub_pb.rb +48 -40
  43. data/lib/google/pubsub/v1/pubsub_services_pb.rb +201 -161
  44. metadata +6 -7
  45. data/lib/google/cloud/pubsub/subscriber/async_stream_pusher.rb +0 -223
  46. data/lib/google/cloud/pubsub/subscriber/async_unary_pusher.rb +0 -271
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ require "google/cloud/pubsub/v1/credentials"
31
31
 
32
32
  module Google
33
33
  module Cloud
34
- module Pubsub
34
+ module PubSub
35
35
  module V1
36
36
  # The service that an application uses to manipulate topics, and to send
37
37
  # messages to a topic.
@@ -39,7 +39,7 @@ module Google
39
39
  # @!attribute [r] iam_policy_stub
40
40
  # @return [Google::Iam::V1::IAMPolicy::Stub]
41
41
  # @!attribute [r] publisher_stub
42
- # @return [Google::Pubsub::V1::Publisher::Stub]
42
+ # @return [Google::Cloud::PubSub::V1::Publisher::Stub]
43
43
  class PublisherClient
44
44
  # @private
45
45
  attr_reader :iam_policy_stub, :publisher_stub
@@ -164,10 +164,10 @@ module Google
164
164
  require "google/iam/v1/iam_policy_services_pb"
165
165
  require "google/pubsub/v1/pubsub_services_pb"
166
166
 
167
- credentials ||= Google::Cloud::Pubsub::V1::Credentials.default
167
+ credentials ||= Google::Cloud::PubSub::V1::Credentials.default
168
168
 
169
169
  if credentials.is_a?(String) || credentials.is_a?(Hash)
170
- updater_proc = Google::Cloud::Pubsub::V1::Credentials.new(credentials).updater_proc
170
+ updater_proc = Google::Cloud::PubSub::V1::Credentials.new(credentials).updater_proc
171
171
  end
172
172
  if credentials.is_a?(GRPC::Core::Channel)
173
173
  channel = credentials
@@ -231,7 +231,7 @@ module Google
231
231
  updater_proc: updater_proc,
232
232
  scopes: scopes,
233
233
  interceptors: interceptors,
234
- &Google::Pubsub::V1::Publisher::Stub.method(:new)
234
+ &Google::Cloud::PubSub::V1::Publisher::Stub.method(:new)
235
235
  )
236
236
 
237
237
  @create_topic = Google::Gax.create_api_call(
@@ -289,7 +289,8 @@ module Google
289
289
  # Service calls
290
290
 
291
291
  # Creates the given topic with the given name. See the
292
- # <a href="/pubsub/docs/admin#resource_names"> resource name rules</a>.
292
+ # <a href="https://cloud.google.com/pubsub/docs/admin#resource_names">
293
+ # resource name rules</a>.
293
294
  #
294
295
  # @param name [String]
295
296
  # The name of the topic. It must have the format
@@ -299,29 +300,30 @@ module Google
299
300
  # signs (`%`). It must be between 3 and 255 characters in length, and it
300
301
  # must not start with `"goog"`.
301
302
  # @param labels [Hash{String => String}]
302
- # User labels.
303
- # @param message_storage_policy [Google::Pubsub::V1::MessageStoragePolicy | Hash]
303
+ # See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
304
+ # managing labels</a>.
305
+ # @param message_storage_policy [Google::Cloud::PubSub::V1::MessageStoragePolicy | Hash]
304
306
  # Policy constraining how messages published to the topic may be stored. It
305
307
  # is determined when the topic is created based on the policy configured at
306
308
  # the project level. It must not be set by the caller in the request to
307
309
  # CreateTopic or to UpdateTopic. This field will be populated in the
308
310
  # responses for GetTopic, CreateTopic, and UpdateTopic: if not present in the
309
311
  # response, then no constraints are in effect.
310
- # A hash of the same form as `Google::Pubsub::V1::MessageStoragePolicy`
312
+ # A hash of the same form as `Google::Cloud::PubSub::V1::MessageStoragePolicy`
311
313
  # can also be provided.
312
314
  # @param options [Google::Gax::CallOptions]
313
315
  # Overrides the default settings for this call, e.g, timeout,
314
316
  # retries, etc.
315
317
  # @yield [result, operation] Access the result along with the RPC operation
316
- # @yieldparam result [Google::Pubsub::V1::Topic]
318
+ # @yieldparam result [Google::Cloud::PubSub::V1::Topic]
317
319
  # @yieldparam operation [GRPC::ActiveCall::Operation]
318
- # @return [Google::Pubsub::V1::Topic]
320
+ # @return [Google::Cloud::PubSub::V1::Topic]
319
321
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
320
322
  # @example
321
323
  # require "google/cloud/pubsub"
322
324
  #
323
- # publisher_client = Google::Cloud::Pubsub::Publisher.new(version: :v1)
324
- # formatted_name = Google::Cloud::Pubsub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
325
+ # publisher_client = Google::Cloud::PubSub::Publisher.new(version: :v1)
326
+ # formatted_name = Google::Cloud::PubSub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
325
327
  # response = publisher_client.create_topic(formatted_name)
326
328
 
327
329
  def create_topic \
@@ -335,16 +337,16 @@ module Google
335
337
  labels: labels,
336
338
  message_storage_policy: message_storage_policy
337
339
  }.delete_if { |_, v| v.nil? }
338
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::Topic)
340
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::Topic)
339
341
  @create_topic.call(req, options, &block)
340
342
  end
341
343
 
342
344
  # Updates an existing topic. Note that certain properties of a
343
345
  # topic are not modifiable.
344
346
  #
345
- # @param topic [Google::Pubsub::V1::Topic | Hash]
347
+ # @param topic [Google::Cloud::PubSub::V1::Topic | Hash]
346
348
  # The updated topic object.
347
- # A hash of the same form as `Google::Pubsub::V1::Topic`
349
+ # A hash of the same form as `Google::Cloud::PubSub::V1::Topic`
348
350
  # can also be provided.
349
351
  # @param update_mask [Google::Protobuf::FieldMask | Hash]
350
352
  # Indicates which fields in the provided topic to update. Must be specified
@@ -358,14 +360,14 @@ module Google
358
360
  # Overrides the default settings for this call, e.g, timeout,
359
361
  # retries, etc.
360
362
  # @yield [result, operation] Access the result along with the RPC operation
361
- # @yieldparam result [Google::Pubsub::V1::Topic]
363
+ # @yieldparam result [Google::Cloud::PubSub::V1::Topic]
362
364
  # @yieldparam operation [GRPC::ActiveCall::Operation]
363
- # @return [Google::Pubsub::V1::Topic]
365
+ # @return [Google::Cloud::PubSub::V1::Topic]
364
366
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
365
367
  # @example
366
368
  # require "google/cloud/pubsub"
367
369
  #
368
- # publisher_client = Google::Cloud::Pubsub::Publisher.new(version: :v1)
370
+ # publisher_client = Google::Cloud::PubSub::Publisher.new(version: :v1)
369
371
  #
370
372
  # # TODO: Initialize `topic`:
371
373
  # topic = {}
@@ -383,34 +385,33 @@ module Google
383
385
  topic: topic,
384
386
  update_mask: update_mask
385
387
  }.delete_if { |_, v| v.nil? }
386
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::UpdateTopicRequest)
388
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::UpdateTopicRequest)
387
389
  @update_topic.call(req, options, &block)
388
390
  end
389
391
 
390
392
  # Adds one or more messages to the topic. Returns `NOT_FOUND` if the topic
391
- # does not exist. The message payload must not be empty; it must contain
392
- # either a non-empty data field, or at least one attribute.
393
+ # does not exist.
393
394
  #
394
395
  # @param topic [String]
395
396
  # The messages in the request will be published on this topic.
396
397
  # Format is `projects/{project}/topics/{topic}`.
397
- # @param messages [Array<Google::Pubsub::V1::PubsubMessage | Hash>]
398
+ # @param messages [Array<Google::Cloud::PubSub::V1::PubsubMessage | Hash>]
398
399
  # The messages to publish.
399
- # A hash of the same form as `Google::Pubsub::V1::PubsubMessage`
400
+ # A hash of the same form as `Google::Cloud::PubSub::V1::PubsubMessage`
400
401
  # can also be provided.
401
402
  # @param options [Google::Gax::CallOptions]
402
403
  # Overrides the default settings for this call, e.g, timeout,
403
404
  # retries, etc.
404
405
  # @yield [result, operation] Access the result along with the RPC operation
405
- # @yieldparam result [Google::Pubsub::V1::PublishResponse]
406
+ # @yieldparam result [Google::Cloud::PubSub::V1::PublishResponse]
406
407
  # @yieldparam operation [GRPC::ActiveCall::Operation]
407
- # @return [Google::Pubsub::V1::PublishResponse]
408
+ # @return [Google::Cloud::PubSub::V1::PublishResponse]
408
409
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
409
410
  # @example
410
411
  # require "google/cloud/pubsub"
411
412
  #
412
- # publisher_client = Google::Cloud::Pubsub::Publisher.new(version: :v1)
413
- # formatted_topic = Google::Cloud::Pubsub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
413
+ # publisher_client = Google::Cloud::PubSub::Publisher.new(version: :v1)
414
+ # formatted_topic = Google::Cloud::PubSub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
414
415
  # data = ''
415
416
  # messages_element = { data: data }
416
417
  # messages = [messages_element]
@@ -425,7 +426,7 @@ module Google
425
426
  topic: topic,
426
427
  messages: messages
427
428
  }.delete_if { |_, v| v.nil? }
428
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::PublishRequest)
429
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::PublishRequest)
429
430
  @publish.call(req, options, &block)
430
431
  end
431
432
 
@@ -438,15 +439,15 @@ module Google
438
439
  # Overrides the default settings for this call, e.g, timeout,
439
440
  # retries, etc.
440
441
  # @yield [result, operation] Access the result along with the RPC operation
441
- # @yieldparam result [Google::Pubsub::V1::Topic]
442
+ # @yieldparam result [Google::Cloud::PubSub::V1::Topic]
442
443
  # @yieldparam operation [GRPC::ActiveCall::Operation]
443
- # @return [Google::Pubsub::V1::Topic]
444
+ # @return [Google::Cloud::PubSub::V1::Topic]
444
445
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
445
446
  # @example
446
447
  # require "google/cloud/pubsub"
447
448
  #
448
- # publisher_client = Google::Cloud::Pubsub::Publisher.new(version: :v1)
449
- # formatted_topic = Google::Cloud::Pubsub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
449
+ # publisher_client = Google::Cloud::PubSub::Publisher.new(version: :v1)
450
+ # formatted_topic = Google::Cloud::PubSub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
450
451
  # response = publisher_client.get_topic(formatted_topic)
451
452
 
452
453
  def get_topic \
@@ -456,15 +457,15 @@ module Google
456
457
  req = {
457
458
  topic: topic
458
459
  }.delete_if { |_, v| v.nil? }
459
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::GetTopicRequest)
460
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::GetTopicRequest)
460
461
  @get_topic.call(req, options, &block)
461
462
  end
462
463
 
463
464
  # Lists matching topics.
464
465
  #
465
466
  # @param project [String]
466
- # The name of the cloud project that topics belong to.
467
- # Format is `projects/{project}`.
467
+ # The name of the project in which to list topics.
468
+ # Format is `projects/{project-id}`.
468
469
  # @param page_size [Integer]
469
470
  # The maximum number of resources contained in the underlying API
470
471
  # response. If page streaming is performed per-resource, this
@@ -475,10 +476,10 @@ module Google
475
476
  # Overrides the default settings for this call, e.g, timeout,
476
477
  # retries, etc.
477
478
  # @yield [result, operation] Access the result along with the RPC operation
478
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Pubsub::V1::Topic>]
479
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::PubSub::V1::Topic>]
479
480
  # @yieldparam operation [GRPC::ActiveCall::Operation]
480
- # @return [Google::Gax::PagedEnumerable<Google::Pubsub::V1::Topic>]
481
- # An enumerable of Google::Pubsub::V1::Topic instances.
481
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::PubSub::V1::Topic>]
482
+ # An enumerable of Google::Cloud::PubSub::V1::Topic instances.
482
483
  # See Google::Gax::PagedEnumerable documentation for other
483
484
  # operations such as per-page iteration or access to the response
484
485
  # object.
@@ -486,8 +487,8 @@ module Google
486
487
  # @example
487
488
  # require "google/cloud/pubsub"
488
489
  #
489
- # publisher_client = Google::Cloud::Pubsub::Publisher.new(version: :v1)
490
- # formatted_project = Google::Cloud::Pubsub::V1::PublisherClient.project_path("[PROJECT]")
490
+ # publisher_client = Google::Cloud::PubSub::Publisher.new(version: :v1)
491
+ # formatted_project = Google::Cloud::PubSub::V1::PublisherClient.project_path("[PROJECT]")
491
492
  #
492
493
  # # Iterate over all results.
493
494
  # publisher_client.list_topics(formatted_project).each do |element|
@@ -511,7 +512,7 @@ module Google
511
512
  project: project,
512
513
  page_size: page_size
513
514
  }.delete_if { |_, v| v.nil? }
514
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::ListTopicsRequest)
515
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::ListTopicsRequest)
515
516
  @list_topics.call(req, options, &block)
516
517
  end
517
518
 
@@ -541,8 +542,8 @@ module Google
541
542
  # @example
542
543
  # require "google/cloud/pubsub"
543
544
  #
544
- # publisher_client = Google::Cloud::Pubsub::Publisher.new(version: :v1)
545
- # formatted_topic = Google::Cloud::Pubsub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
545
+ # publisher_client = Google::Cloud::PubSub::Publisher.new(version: :v1)
546
+ # formatted_topic = Google::Cloud::PubSub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
546
547
  #
547
548
  # # Iterate over all results.
548
549
  # publisher_client.list_topic_subscriptions(formatted_topic).each do |element|
@@ -566,7 +567,7 @@ module Google
566
567
  topic: topic,
567
568
  page_size: page_size
568
569
  }.delete_if { |_, v| v.nil? }
569
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::ListTopicSubscriptionsRequest)
570
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::ListTopicSubscriptionsRequest)
570
571
  @list_topic_subscriptions.call(req, options, &block)
571
572
  end
572
573
 
@@ -589,8 +590,8 @@ module Google
589
590
  # @example
590
591
  # require "google/cloud/pubsub"
591
592
  #
592
- # publisher_client = Google::Cloud::Pubsub::Publisher.new(version: :v1)
593
- # formatted_topic = Google::Cloud::Pubsub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
593
+ # publisher_client = Google::Cloud::PubSub::Publisher.new(version: :v1)
594
+ # formatted_topic = Google::Cloud::PubSub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
594
595
  # publisher_client.delete_topic(formatted_topic)
595
596
 
596
597
  def delete_topic \
@@ -600,7 +601,7 @@ module Google
600
601
  req = {
601
602
  topic: topic
602
603
  }.delete_if { |_, v| v.nil? }
603
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::DeleteTopicRequest)
604
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::DeleteTopicRequest)
604
605
  @delete_topic.call(req, options, &block)
605
606
  nil
606
607
  end
@@ -630,8 +631,8 @@ module Google
630
631
  # @example
631
632
  # require "google/cloud/pubsub"
632
633
  #
633
- # publisher_client = Google::Cloud::Pubsub::Publisher.new(version: :v1)
634
- # formatted_resource = Google::Cloud::Pubsub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
634
+ # publisher_client = Google::Cloud::PubSub::Publisher.new(version: :v1)
635
+ # formatted_resource = Google::Cloud::PubSub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
635
636
  #
636
637
  # # TODO: Initialize `policy`:
637
638
  # policy = {}
@@ -669,8 +670,8 @@ module Google
669
670
  # @example
670
671
  # require "google/cloud/pubsub"
671
672
  #
672
- # publisher_client = Google::Cloud::Pubsub::Publisher.new(version: :v1)
673
- # formatted_resource = Google::Cloud::Pubsub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
673
+ # publisher_client = Google::Cloud::PubSub::Publisher.new(version: :v1)
674
+ # formatted_resource = Google::Cloud::PubSub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
674
675
  # response = publisher_client.get_iam_policy(formatted_resource)
675
676
 
676
677
  def get_iam_policy \
@@ -708,8 +709,8 @@ module Google
708
709
  # @example
709
710
  # require "google/cloud/pubsub"
710
711
  #
711
- # publisher_client = Google::Cloud::Pubsub::Publisher.new(version: :v1)
712
- # formatted_resource = Google::Cloud::Pubsub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
712
+ # publisher_client = Google::Cloud::PubSub::Publisher.new(version: :v1)
713
+ # formatted_resource = Google::Cloud::PubSub::V1::PublisherClient.topic_path("[PROJECT]", "[TOPIC]")
713
714
  #
714
715
  # # TODO: Initialize `permissions`:
715
716
  # permissions = []
@@ -730,5 +731,7 @@ module Google
730
731
  end
731
732
  end
732
733
  end
734
+
735
+ Pubsub = PubSub unless const_defined? :Pubsub
733
736
  end
734
737
  end
@@ -6,10 +6,6 @@
6
6
  "DEADLINE_EXCEEDED",
7
7
  "UNAVAILABLE"
8
8
  ],
9
- "http_get": [
10
- "DEADLINE_EXCEEDED",
11
- "UNAVAILABLE"
12
- ],
13
9
  "non_idempotent": [],
14
10
  "one_plus_delivery": [
15
11
  "ABORTED",
@@ -1,4 +1,4 @@
1
- # Copyright 2018 Google LLC
1
+ # Copyright 2019 Google LLC
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -31,7 +31,7 @@ require "google/cloud/pubsub/v1/credentials"
31
31
 
32
32
  module Google
33
33
  module Cloud
34
- module Pubsub
34
+ module PubSub
35
35
  module V1
36
36
  # The service that an application uses to manipulate subscriptions and to
37
37
  # consume messages from a subscription via the `Pull` method or by
@@ -40,7 +40,7 @@ module Google
40
40
  # @!attribute [r] iam_policy_stub
41
41
  # @return [Google::Iam::V1::IAMPolicy::Stub]
42
42
  # @!attribute [r] subscriber_stub
43
- # @return [Google::Pubsub::V1::Subscriber::Stub]
43
+ # @return [Google::Cloud::PubSub::V1::Subscriber::Stub]
44
44
  class SubscriberClient
45
45
  # @private
46
46
  attr_reader :iam_policy_stub, :subscriber_stub
@@ -188,10 +188,10 @@ module Google
188
188
  require "google/iam/v1/iam_policy_services_pb"
189
189
  require "google/pubsub/v1/pubsub_services_pb"
190
190
 
191
- credentials ||= Google::Cloud::Pubsub::V1::Credentials.default
191
+ credentials ||= Google::Cloud::PubSub::V1::Credentials.default
192
192
 
193
193
  if credentials.is_a?(String) || credentials.is_a?(Hash)
194
- updater_proc = Google::Cloud::Pubsub::V1::Credentials.new(credentials).updater_proc
194
+ updater_proc = Google::Cloud::PubSub::V1::Credentials.new(credentials).updater_proc
195
195
  end
196
196
  if credentials.is_a?(GRPC::Core::Channel)
197
197
  channel = credentials
@@ -254,7 +254,7 @@ module Google
254
254
  updater_proc: updater_proc,
255
255
  scopes: scopes,
256
256
  interceptors: interceptors,
257
- &Google::Pubsub::V1::Subscriber::Stub.method(:new)
257
+ &Google::Cloud::PubSub::V1::Subscriber::Stub.method(:new)
258
258
  )
259
259
 
260
260
  @create_subscription = Google::Gax.create_api_call(
@@ -352,14 +352,15 @@ module Google
352
352
  # Service calls
353
353
 
354
354
  # Creates a subscription to a given topic. See the
355
- # <a href="/pubsub/docs/admin#resource_names"> resource name rules</a>.
355
+ # <a href="https://cloud.google.com/pubsub/docs/admin#resource_names">
356
+ # resource name rules</a>.
356
357
  # If the subscription already exists, returns `ALREADY_EXISTS`.
357
358
  # If the corresponding topic doesn't exist, returns `NOT_FOUND`.
358
359
  #
359
360
  # If the name is not provided in the request, the server will assign a random
360
361
  # name for this subscription on the same project as the topic, conforming
361
362
  # to the
362
- # [resource name format](https://cloud.google.com/pubsub/docs/overview#names).
363
+ # [resource name format](https://cloud.google.com/pubsub/docs/admin#resource_names).
363
364
  # The generated name is populated in the returned Subscription object.
364
365
  # Note that for REST API requests, you must specify a name in the request.
365
366
  #
@@ -375,18 +376,18 @@ module Google
375
376
  # Format is `projects/{project}/topics/{topic}`.
376
377
  # The value of this field will be `_deleted-topic_` if the topic has been
377
378
  # deleted.
378
- # @param push_config [Google::Pubsub::V1::PushConfig | Hash]
379
+ # @param push_config [Google::Cloud::PubSub::V1::PushConfig | Hash]
379
380
  # If push delivery is used with this subscription, this field is
380
381
  # used to configure it. An empty `pushConfig` signifies that the subscriber
381
382
  # will pull and ack messages using API methods.
382
- # A hash of the same form as `Google::Pubsub::V1::PushConfig`
383
+ # A hash of the same form as `Google::Cloud::PubSub::V1::PushConfig`
383
384
  # can also be provided.
384
385
  # @param ack_deadline_seconds [Integer]
385
- # This value is the maximum time after a subscriber receives a message
386
- # before the subscriber should acknowledge the message. After message
387
- # delivery but before the ack deadline expires and before the message is
388
- # acknowledged, it is an outstanding message and will not be delivered
389
- # again during that time (on a best-effort basis).
386
+ # The approximate amount of time (on a best-effort basis) Pub/Sub waits for
387
+ # the subscriber to acknowledge receipt before resending the message. In the
388
+ # interval after the message is delivered and before it is acknowledged, it
389
+ # is considered to be <i>outstanding</i>. During that time period, the
390
+ # message will not be redelivered (on a best-effort basis).
390
391
  #
391
392
  # For pull subscriptions, this value is used as the initial value for the ack
392
393
  # deadline. To override this value for a given message, call
@@ -406,8 +407,11 @@ module Google
406
407
  # Indicates whether to retain acknowledged messages. If true, then
407
408
  # messages are not expunged from the subscription's backlog, even if they are
408
409
  # acknowledged, until they fall out of the `message_retention_duration`
409
- # window.<br><br>
410
- # <b>ALPHA:</b> This feature is part of an alpha release. This API might be
410
+ # window. This must be true if you would like to
411
+ # <a href="https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time">
412
+ # Seek to a timestamp</a>.
413
+ # <br><br>
414
+ # <b>BETA:</b> This feature is part of a beta release. This API might be
411
415
  # changed in backward-incompatible ways and is not recommended for production
412
416
  # use. It is not subject to any SLA or deprecation policy.
413
417
  # @param message_retention_duration [Google::Protobuf::Duration | Hash]
@@ -417,27 +421,40 @@ module Google
417
421
  # of acknowledged messages, and thus configures how far back in time a `Seek`
418
422
  # can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
419
423
  # minutes.<br><br>
420
- # <b>ALPHA:</b> This feature is part of an alpha release. This API might be
424
+ # <b>BETA:</b> This feature is part of a beta release. This API might be
421
425
  # changed in backward-incompatible ways and is not recommended for production
422
426
  # use. It is not subject to any SLA or deprecation policy.
423
427
  # A hash of the same form as `Google::Protobuf::Duration`
424
428
  # can also be provided.
425
429
  # @param labels [Hash{String => String}]
426
- # User labels.
430
+ # See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
431
+ # managing labels</a>.
432
+ # @param expiration_policy [Google::Cloud::PubSub::V1::ExpirationPolicy | Hash]
433
+ # A policy that specifies the conditions for this subscription's expiration.
434
+ # A subscription is considered active as long as any connected subscriber is
435
+ # successfully consuming messages from the subscription or is issuing
436
+ # operations on the subscription. If `expiration_policy` is not set, a
437
+ # *default policy* with `ttl` of 31 days will be used. The minimum allowed
438
+ # value for `expiration_policy.ttl` is 1 day.
439
+ # <b>BETA:</b> This feature is part of a beta release. This API might be
440
+ # changed in backward-incompatible ways and is not recommended for production
441
+ # use. It is not subject to any SLA or deprecation policy.
442
+ # A hash of the same form as `Google::Cloud::PubSub::V1::ExpirationPolicy`
443
+ # can also be provided.
427
444
  # @param options [Google::Gax::CallOptions]
428
445
  # Overrides the default settings for this call, e.g, timeout,
429
446
  # retries, etc.
430
447
  # @yield [result, operation] Access the result along with the RPC operation
431
- # @yieldparam result [Google::Pubsub::V1::Subscription]
448
+ # @yieldparam result [Google::Cloud::PubSub::V1::Subscription]
432
449
  # @yieldparam operation [GRPC::ActiveCall::Operation]
433
- # @return [Google::Pubsub::V1::Subscription]
450
+ # @return [Google::Cloud::PubSub::V1::Subscription]
434
451
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
435
452
  # @example
436
453
  # require "google/cloud/pubsub"
437
454
  #
438
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
439
- # formatted_name = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
440
- # formatted_topic = Google::Cloud::Pubsub::V1::SubscriberClient.topic_path("[PROJECT]", "[TOPIC]")
455
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
456
+ # formatted_name = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
457
+ # formatted_topic = Google::Cloud::PubSub::V1::SubscriberClient.topic_path("[PROJECT]", "[TOPIC]")
441
458
  # response = subscriber_client.create_subscription(formatted_name, formatted_topic)
442
459
 
443
460
  def create_subscription \
@@ -448,6 +465,7 @@ module Google
448
465
  retain_acked_messages: nil,
449
466
  message_retention_duration: nil,
450
467
  labels: nil,
468
+ expiration_policy: nil,
451
469
  options: nil,
452
470
  &block
453
471
  req = {
@@ -457,9 +475,10 @@ module Google
457
475
  ack_deadline_seconds: ack_deadline_seconds,
458
476
  retain_acked_messages: retain_acked_messages,
459
477
  message_retention_duration: message_retention_duration,
460
- labels: labels
478
+ labels: labels,
479
+ expiration_policy: expiration_policy
461
480
  }.delete_if { |_, v| v.nil? }
462
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::Subscription)
481
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::Subscription)
463
482
  @create_subscription.call(req, options, &block)
464
483
  end
465
484
 
@@ -472,15 +491,15 @@ module Google
472
491
  # Overrides the default settings for this call, e.g, timeout,
473
492
  # retries, etc.
474
493
  # @yield [result, operation] Access the result along with the RPC operation
475
- # @yieldparam result [Google::Pubsub::V1::Subscription]
494
+ # @yieldparam result [Google::Cloud::PubSub::V1::Subscription]
476
495
  # @yieldparam operation [GRPC::ActiveCall::Operation]
477
- # @return [Google::Pubsub::V1::Subscription]
496
+ # @return [Google::Cloud::PubSub::V1::Subscription]
478
497
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
479
498
  # @example
480
499
  # require "google/cloud/pubsub"
481
500
  #
482
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
483
- # formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
501
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
502
+ # formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
484
503
  # response = subscriber_client.get_subscription(formatted_subscription)
485
504
 
486
505
  def get_subscription \
@@ -490,16 +509,16 @@ module Google
490
509
  req = {
491
510
  subscription: subscription
492
511
  }.delete_if { |_, v| v.nil? }
493
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::GetSubscriptionRequest)
512
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::GetSubscriptionRequest)
494
513
  @get_subscription.call(req, options, &block)
495
514
  end
496
515
 
497
516
  # Updates an existing subscription. Note that certain properties of a
498
517
  # subscription, such as its topic, are not modifiable.
499
518
  #
500
- # @param subscription [Google::Pubsub::V1::Subscription | Hash]
519
+ # @param subscription [Google::Cloud::PubSub::V1::Subscription | Hash]
501
520
  # The updated subscription object.
502
- # A hash of the same form as `Google::Pubsub::V1::Subscription`
521
+ # A hash of the same form as `Google::Cloud::PubSub::V1::Subscription`
503
522
  # can also be provided.
504
523
  # @param update_mask [Google::Protobuf::FieldMask | Hash]
505
524
  # Indicates which fields in the provided subscription to update.
@@ -510,14 +529,14 @@ module Google
510
529
  # Overrides the default settings for this call, e.g, timeout,
511
530
  # retries, etc.
512
531
  # @yield [result, operation] Access the result along with the RPC operation
513
- # @yieldparam result [Google::Pubsub::V1::Subscription]
532
+ # @yieldparam result [Google::Cloud::PubSub::V1::Subscription]
514
533
  # @yieldparam operation [GRPC::ActiveCall::Operation]
515
- # @return [Google::Pubsub::V1::Subscription]
534
+ # @return [Google::Cloud::PubSub::V1::Subscription]
516
535
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
517
536
  # @example
518
537
  # require "google/cloud/pubsub"
519
538
  #
520
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
539
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
521
540
  # ack_deadline_seconds = 42
522
541
  # subscription = { ack_deadline_seconds: ack_deadline_seconds }
523
542
  # paths_element = "ack_deadline_seconds"
@@ -534,15 +553,15 @@ module Google
534
553
  subscription: subscription,
535
554
  update_mask: update_mask
536
555
  }.delete_if { |_, v| v.nil? }
537
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::UpdateSubscriptionRequest)
556
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::UpdateSubscriptionRequest)
538
557
  @update_subscription.call(req, options, &block)
539
558
  end
540
559
 
541
560
  # Lists matching subscriptions.
542
561
  #
543
562
  # @param project [String]
544
- # The name of the cloud project that subscriptions belong to.
545
- # Format is `projects/{project}`.
563
+ # The name of the project in which to list subscriptions.
564
+ # Format is `projects/{project-id}`.
546
565
  # @param page_size [Integer]
547
566
  # The maximum number of resources contained in the underlying API
548
567
  # response. If page streaming is performed per-resource, this
@@ -553,10 +572,10 @@ module Google
553
572
  # Overrides the default settings for this call, e.g, timeout,
554
573
  # retries, etc.
555
574
  # @yield [result, operation] Access the result along with the RPC operation
556
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Pubsub::V1::Subscription>]
575
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::PubSub::V1::Subscription>]
557
576
  # @yieldparam operation [GRPC::ActiveCall::Operation]
558
- # @return [Google::Gax::PagedEnumerable<Google::Pubsub::V1::Subscription>]
559
- # An enumerable of Google::Pubsub::V1::Subscription instances.
577
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::PubSub::V1::Subscription>]
578
+ # An enumerable of Google::Cloud::PubSub::V1::Subscription instances.
560
579
  # See Google::Gax::PagedEnumerable documentation for other
561
580
  # operations such as per-page iteration or access to the response
562
581
  # object.
@@ -564,8 +583,8 @@ module Google
564
583
  # @example
565
584
  # require "google/cloud/pubsub"
566
585
  #
567
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
568
- # formatted_project = Google::Cloud::Pubsub::V1::SubscriberClient.project_path("[PROJECT]")
586
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
587
+ # formatted_project = Google::Cloud::PubSub::V1::SubscriberClient.project_path("[PROJECT]")
569
588
  #
570
589
  # # Iterate over all results.
571
590
  # subscriber_client.list_subscriptions(formatted_project).each do |element|
@@ -589,7 +608,7 @@ module Google
589
608
  project: project,
590
609
  page_size: page_size
591
610
  }.delete_if { |_, v| v.nil? }
592
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::ListSubscriptionsRequest)
611
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::ListSubscriptionsRequest)
593
612
  @list_subscriptions.call(req, options, &block)
594
613
  end
595
614
 
@@ -612,8 +631,8 @@ module Google
612
631
  # @example
613
632
  # require "google/cloud/pubsub"
614
633
  #
615
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
616
- # formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
634
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
635
+ # formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
617
636
  # subscriber_client.delete_subscription(formatted_subscription)
618
637
 
619
638
  def delete_subscription \
@@ -623,7 +642,7 @@ module Google
623
642
  req = {
624
643
  subscription: subscription
625
644
  }.delete_if { |_, v| v.nil? }
626
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::DeleteSubscriptionRequest)
645
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::DeleteSubscriptionRequest)
627
646
  @delete_subscription.call(req, options, &block)
628
647
  nil
629
648
  end
@@ -643,8 +662,9 @@ module Google
643
662
  # The new ack deadline with respect to the time this request was sent to
644
663
  # the Pub/Sub system. For example, if the value is 10, the new
645
664
  # ack deadline will expire 10 seconds after the `ModifyAckDeadline` call
646
- # was made. Specifying zero may immediately make the message available for
647
- # another pull request.
665
+ # was made. Specifying zero might immediately make the message available for
666
+ # delivery to another subscriber client. This typically results in an
667
+ # increase in the rate of message redeliveries (that is, duplicates).
648
668
  # The minimum deadline you can specify is 0 seconds.
649
669
  # The maximum deadline you can specify is 600 seconds (10 minutes).
650
670
  # @param options [Google::Gax::CallOptions]
@@ -657,8 +677,8 @@ module Google
657
677
  # @example
658
678
  # require "google/cloud/pubsub"
659
679
  #
660
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
661
- # formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
680
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
681
+ # formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
662
682
  #
663
683
  # # TODO: Initialize `ack_ids`:
664
684
  # ack_ids = []
@@ -678,7 +698,7 @@ module Google
678
698
  ack_ids: ack_ids,
679
699
  ack_deadline_seconds: ack_deadline_seconds
680
700
  }.delete_if { |_, v| v.nil? }
681
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::ModifyAckDeadlineRequest)
701
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::ModifyAckDeadlineRequest)
682
702
  @modify_ack_deadline.call(req, options, &block)
683
703
  nil
684
704
  end
@@ -707,8 +727,8 @@ module Google
707
727
  # @example
708
728
  # require "google/cloud/pubsub"
709
729
  #
710
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
711
- # formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
730
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
731
+ # formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
712
732
  #
713
733
  # # TODO: Initialize `ack_ids`:
714
734
  # ack_ids = []
@@ -723,13 +743,12 @@ module Google
723
743
  subscription: subscription,
724
744
  ack_ids: ack_ids
725
745
  }.delete_if { |_, v| v.nil? }
726
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::AcknowledgeRequest)
746
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::AcknowledgeRequest)
727
747
  @acknowledge.call(req, options, &block)
728
748
  nil
729
749
  end
730
750
 
731
- # Pulls messages from the server. Returns an empty list if there are no
732
- # messages available in the backlog. The server may return `UNAVAILABLE` if
751
+ # Pulls messages from the server. The server may return `UNAVAILABLE` if
733
752
  # there are too many concurrent pull requests pending for the given
734
753
  # subscription.
735
754
  #
@@ -743,22 +762,20 @@ module Google
743
762
  # If this field set to true, the system will respond immediately even if
744
763
  # it there are no messages available to return in the `Pull` response.
745
764
  # Otherwise, the system may wait (for a bounded amount of time) until at
746
- # least one message is available, rather than returning no messages. The
747
- # client may cancel the request if it does not wish to wait any longer for
748
- # the response.
765
+ # least one message is available, rather than returning no messages.
749
766
  # @param options [Google::Gax::CallOptions]
750
767
  # Overrides the default settings for this call, e.g, timeout,
751
768
  # retries, etc.
752
769
  # @yield [result, operation] Access the result along with the RPC operation
753
- # @yieldparam result [Google::Pubsub::V1::PullResponse]
770
+ # @yieldparam result [Google::Cloud::PubSub::V1::PullResponse]
754
771
  # @yieldparam operation [GRPC::ActiveCall::Operation]
755
- # @return [Google::Pubsub::V1::PullResponse]
772
+ # @return [Google::Cloud::PubSub::V1::PullResponse]
756
773
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
757
774
  # @example
758
775
  # require "google/cloud/pubsub"
759
776
  #
760
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
761
- # formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
777
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
778
+ # formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
762
779
  #
763
780
  # # TODO: Initialize `max_messages`:
764
781
  # max_messages = 0
@@ -775,7 +792,7 @@ module Google
775
792
  max_messages: max_messages,
776
793
  return_immediately: return_immediately
777
794
  }.delete_if { |_, v| v.nil? }
778
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::PullRequest)
795
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::PullRequest)
779
796
  @pull.call(req, options, &block)
780
797
  end
781
798
 
@@ -787,13 +804,13 @@ module Google
787
804
  # re-establish the stream. Flow control can be achieved by configuring the
788
805
  # underlying RPC channel.
789
806
  #
790
- # @param reqs [Enumerable<Google::Pubsub::V1::StreamingPullRequest>]
807
+ # @param reqs [Enumerable<Google::Cloud::PubSub::V1::StreamingPullRequest>]
791
808
  # The input requests.
792
809
  # @param options [Google::Gax::CallOptions]
793
810
  # Overrides the default settings for this call, e.g, timeout,
794
811
  # retries, etc.
795
- # @return [Enumerable<Google::Pubsub::V1::StreamingPullResponse>]
796
- # An enumerable of Google::Pubsub::V1::StreamingPullResponse instances.
812
+ # @return [Enumerable<Google::Cloud::PubSub::V1::StreamingPullResponse>]
813
+ # An enumerable of Google::Cloud::PubSub::V1::StreamingPullResponse instances.
797
814
  #
798
815
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
799
816
  #
@@ -805,8 +822,8 @@ module Google
805
822
  # @example
806
823
  # require "google/cloud/pubsub"
807
824
  #
808
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
809
- # formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
825
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
826
+ # formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
810
827
  #
811
828
  # # TODO: Initialize `stream_ack_deadline_seconds`:
812
829
  # stream_ack_deadline_seconds = 0
@@ -818,7 +835,7 @@ module Google
818
835
 
819
836
  def streaming_pull reqs, options: nil
820
837
  request_protos = reqs.lazy.map do |req|
821
- Google::Gax::to_proto(req, Google::Pubsub::V1::StreamingPullRequest)
838
+ Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::StreamingPullRequest)
822
839
  end
823
840
  @streaming_pull.call(request_protos, options)
824
841
  end
@@ -833,14 +850,14 @@ module Google
833
850
  # @param subscription [String]
834
851
  # The name of the subscription.
835
852
  # Format is `projects/{project}/subscriptions/{sub}`.
836
- # @param push_config [Google::Pubsub::V1::PushConfig | Hash]
853
+ # @param push_config [Google::Cloud::PubSub::V1::PushConfig | Hash]
837
854
  # The push configuration for future deliveries.
838
855
  #
839
856
  # An empty `pushConfig` indicates that the Pub/Sub system should
840
857
  # stop pushing messages from the given subscription and allow
841
858
  # messages to be pulled and acknowledged - effectively pausing
842
859
  # the subscription if `Pull` or `StreamingPull` is not called.
843
- # A hash of the same form as `Google::Pubsub::V1::PushConfig`
860
+ # A hash of the same form as `Google::Cloud::PubSub::V1::PushConfig`
844
861
  # can also be provided.
845
862
  # @param options [Google::Gax::CallOptions]
846
863
  # Overrides the default settings for this call, e.g, timeout,
@@ -852,8 +869,8 @@ module Google
852
869
  # @example
853
870
  # require "google/cloud/pubsub"
854
871
  #
855
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
856
- # formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
872
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
873
+ # formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
857
874
  #
858
875
  # # TODO: Initialize `push_config`:
859
876
  # push_config = {}
@@ -868,19 +885,24 @@ module Google
868
885
  subscription: subscription,
869
886
  push_config: push_config
870
887
  }.delete_if { |_, v| v.nil? }
871
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::ModifyPushConfigRequest)
888
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::ModifyPushConfigRequest)
872
889
  @modify_push_config.call(req, options, &block)
873
890
  nil
874
891
  end
875
892
 
876
- # Lists the existing snapshots.<br><br>
877
- # <b>ALPHA:</b> This feature is part of an alpha release. This API might be
893
+ # Lists the existing snapshots. Snapshots are used in
894
+ # <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
895
+ # operations, which allow
896
+ # you to manage message acknowledgments in bulk. That is, you can set the
897
+ # acknowledgment state of messages in an existing subscription to the state
898
+ # captured by a snapshot.<br><br>
899
+ # <b>BETA:</b> This feature is part of a beta release. This API might be
878
900
  # changed in backward-incompatible ways and is not recommended for production
879
901
  # use. It is not subject to any SLA or deprecation policy.
880
902
  #
881
903
  # @param project [String]
882
- # The name of the cloud project that snapshots belong to.
883
- # Format is `projects/{project}`.
904
+ # The name of the project in which to list snapshots.
905
+ # Format is `projects/{project-id}`.
884
906
  # @param page_size [Integer]
885
907
  # The maximum number of resources contained in the underlying API
886
908
  # response. If page streaming is performed per-resource, this
@@ -891,10 +913,10 @@ module Google
891
913
  # Overrides the default settings for this call, e.g, timeout,
892
914
  # retries, etc.
893
915
  # @yield [result, operation] Access the result along with the RPC operation
894
- # @yieldparam result [Google::Gax::PagedEnumerable<Google::Pubsub::V1::Snapshot>]
916
+ # @yieldparam result [Google::Gax::PagedEnumerable<Google::Cloud::PubSub::V1::Snapshot>]
895
917
  # @yieldparam operation [GRPC::ActiveCall::Operation]
896
- # @return [Google::Gax::PagedEnumerable<Google::Pubsub::V1::Snapshot>]
897
- # An enumerable of Google::Pubsub::V1::Snapshot instances.
918
+ # @return [Google::Gax::PagedEnumerable<Google::Cloud::PubSub::V1::Snapshot>]
919
+ # An enumerable of Google::Cloud::PubSub::V1::Snapshot instances.
898
920
  # See Google::Gax::PagedEnumerable documentation for other
899
921
  # operations such as per-page iteration or access to the response
900
922
  # object.
@@ -902,8 +924,8 @@ module Google
902
924
  # @example
903
925
  # require "google/cloud/pubsub"
904
926
  #
905
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
906
- # formatted_project = Google::Cloud::Pubsub::V1::SubscriberClient.project_path("[PROJECT]")
927
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
928
+ # formatted_project = Google::Cloud::PubSub::V1::SubscriberClient.project_path("[PROJECT]")
907
929
  #
908
930
  # # Iterate over all results.
909
931
  # subscriber_client.list_snapshots(formatted_project).each do |element|
@@ -927,14 +949,20 @@ module Google
927
949
  project: project,
928
950
  page_size: page_size
929
951
  }.delete_if { |_, v| v.nil? }
930
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::ListSnapshotsRequest)
952
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::ListSnapshotsRequest)
931
953
  @list_snapshots.call(req, options, &block)
932
954
  end
933
955
 
934
- # Creates a snapshot from the requested subscription.<br><br>
935
- # <b>ALPHA:</b> This feature is part of an alpha release. This API might be
956
+ # Creates a snapshot from the requested subscription. Snapshots are used in
957
+ # <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
958
+ # operations, which allow
959
+ # you to manage message acknowledgments in bulk. That is, you can set the
960
+ # acknowledgment state of messages in an existing subscription to the state
961
+ # captured by a snapshot.
962
+ # <br><br>
963
+ # <b>BETA:</b> This feature is part of a beta release. This API might be
936
964
  # changed in backward-incompatible ways and is not recommended for production
937
- # use. It is not subject to any SLA or deprecation policy.
965
+ # use. It is not subject to any SLA or deprecation policy.<br><br>
938
966
  # If the snapshot already exists, returns `ALREADY_EXISTS`.
939
967
  # If the requested subscription doesn't exist, returns `NOT_FOUND`.
940
968
  # If the backlog in the subscription is too old -- and the resulting snapshot
@@ -942,16 +970,18 @@ module Google
942
970
  # See also the `Snapshot.expire_time` field. If the name is not provided in
943
971
  # the request, the server will assign a random
944
972
  # name for this snapshot on the same project as the subscription, conforming
945
- # to the [resource name format](https://cloud.google.com/pubsub/docs/overview#names).
946
- # The generated
947
- # name is populated in the returned Snapshot object. Note that for REST API
948
- # requests, you must specify a name in the request.
973
+ # to the
974
+ # [resource name format](https://cloud.google.com/pubsub/docs/admin#resource_names).
975
+ # The generated name is populated in the returned Snapshot object. Note that
976
+ # for REST API requests, you must specify a name in the request.
949
977
  #
950
978
  # @param name [String]
951
979
  # Optional user-provided name for this snapshot.
952
980
  # If the name is not provided in the request, the server will assign a random
953
981
  # name for this snapshot on the same project as the subscription.
954
- # Note that for REST API requests, you must specify a name.
982
+ # Note that for REST API requests, you must specify a name. See the
983
+ # <a href="https://cloud.google.com/pubsub/docs/admin#resource_names">
984
+ # resource name rules</a>.
955
985
  # Format is `projects/{project}/snapshots/{snap}`.
956
986
  # @param subscription [String]
957
987
  # The subscription whose backlog the snapshot retains.
@@ -964,21 +994,22 @@ module Google
964
994
  # successful completion of the CreateSnapshot request.
965
995
  # Format is `projects/{project}/subscriptions/{sub}`.
966
996
  # @param labels [Hash{String => String}]
967
- # User labels.
997
+ # See <a href="https://cloud.google.com/pubsub/docs/labels"> Creating and
998
+ # managing labels</a>.
968
999
  # @param options [Google::Gax::CallOptions]
969
1000
  # Overrides the default settings for this call, e.g, timeout,
970
1001
  # retries, etc.
971
1002
  # @yield [result, operation] Access the result along with the RPC operation
972
- # @yieldparam result [Google::Pubsub::V1::Snapshot]
1003
+ # @yieldparam result [Google::Cloud::PubSub::V1::Snapshot]
973
1004
  # @yieldparam operation [GRPC::ActiveCall::Operation]
974
- # @return [Google::Pubsub::V1::Snapshot]
1005
+ # @return [Google::Cloud::PubSub::V1::Snapshot]
975
1006
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
976
1007
  # @example
977
1008
  # require "google/cloud/pubsub"
978
1009
  #
979
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
980
- # formatted_name = Google::Cloud::Pubsub::V1::SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
981
- # formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
1010
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
1011
+ # formatted_name = Google::Cloud::PubSub::V1::SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
1012
+ # formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
982
1013
  # response = subscriber_client.create_snapshot(formatted_name, formatted_subscription)
983
1014
 
984
1015
  def create_snapshot \
@@ -992,19 +1023,24 @@ module Google
992
1023
  subscription: subscription,
993
1024
  labels: labels
994
1025
  }.delete_if { |_, v| v.nil? }
995
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::CreateSnapshotRequest)
1026
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::CreateSnapshotRequest)
996
1027
  @create_snapshot.call(req, options, &block)
997
1028
  end
998
1029
 
999
- # Updates an existing snapshot.<br><br>
1000
- # <b>ALPHA:</b> This feature is part of an alpha release. This API might be
1030
+ # Updates an existing snapshot. Snapshots are used in
1031
+ # <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
1032
+ # operations, which allow
1033
+ # you to manage message acknowledgments in bulk. That is, you can set the
1034
+ # acknowledgment state of messages in an existing subscription to the state
1035
+ # captured by a snapshot.<br><br>
1036
+ # <b>BETA:</b> This feature is part of a beta release. This API might be
1001
1037
  # changed in backward-incompatible ways and is not recommended for production
1002
1038
  # use. It is not subject to any SLA or deprecation policy.
1003
1039
  # Note that certain properties of a snapshot are not modifiable.
1004
1040
  #
1005
- # @param snapshot [Google::Pubsub::V1::Snapshot | Hash]
1041
+ # @param snapshot [Google::Cloud::PubSub::V1::Snapshot | Hash]
1006
1042
  # The updated snapshot object.
1007
- # A hash of the same form as `Google::Pubsub::V1::Snapshot`
1043
+ # A hash of the same form as `Google::Cloud::PubSub::V1::Snapshot`
1008
1044
  # can also be provided.
1009
1045
  # @param update_mask [Google::Protobuf::FieldMask | Hash]
1010
1046
  # Indicates which fields in the provided snapshot to update.
@@ -1015,14 +1051,14 @@ module Google
1015
1051
  # Overrides the default settings for this call, e.g, timeout,
1016
1052
  # retries, etc.
1017
1053
  # @yield [result, operation] Access the result along with the RPC operation
1018
- # @yieldparam result [Google::Pubsub::V1::Snapshot]
1054
+ # @yieldparam result [Google::Cloud::PubSub::V1::Snapshot]
1019
1055
  # @yieldparam operation [GRPC::ActiveCall::Operation]
1020
- # @return [Google::Pubsub::V1::Snapshot]
1056
+ # @return [Google::Cloud::PubSub::V1::Snapshot]
1021
1057
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
1022
1058
  # @example
1023
1059
  # require "google/cloud/pubsub"
1024
1060
  #
1025
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
1061
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
1026
1062
  # seconds = 123456
1027
1063
  # expire_time = { seconds: seconds }
1028
1064
  # snapshot = { expire_time: expire_time }
@@ -1040,12 +1076,17 @@ module Google
1040
1076
  snapshot: snapshot,
1041
1077
  update_mask: update_mask
1042
1078
  }.delete_if { |_, v| v.nil? }
1043
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::UpdateSnapshotRequest)
1079
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::UpdateSnapshotRequest)
1044
1080
  @update_snapshot.call(req, options, &block)
1045
1081
  end
1046
1082
 
1047
- # Removes an existing snapshot. <br><br>
1048
- # <b>ALPHA:</b> This feature is part of an alpha release. This API might be
1083
+ # Removes an existing snapshot. Snapshots are used in
1084
+ # <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
1085
+ # operations, which allow
1086
+ # you to manage message acknowledgments in bulk. That is, you can set the
1087
+ # acknowledgment state of messages in an existing subscription to the state
1088
+ # captured by a snapshot.<br><br>
1089
+ # <b>BETA:</b> This feature is part of a beta release. This API might be
1049
1090
  # changed in backward-incompatible ways and is not recommended for production
1050
1091
  # use. It is not subject to any SLA or deprecation policy.
1051
1092
  # When the snapshot is deleted, all messages retained in the snapshot
@@ -1066,8 +1107,8 @@ module Google
1066
1107
  # @example
1067
1108
  # require "google/cloud/pubsub"
1068
1109
  #
1069
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
1070
- # formatted_snapshot = Google::Cloud::Pubsub::V1::SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
1110
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
1111
+ # formatted_snapshot = Google::Cloud::PubSub::V1::SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
1071
1112
  # subscriber_client.delete_snapshot(formatted_snapshot)
1072
1113
 
1073
1114
  def delete_snapshot \
@@ -1077,14 +1118,20 @@ module Google
1077
1118
  req = {
1078
1119
  snapshot: snapshot
1079
1120
  }.delete_if { |_, v| v.nil? }
1080
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::DeleteSnapshotRequest)
1121
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::DeleteSnapshotRequest)
1081
1122
  @delete_snapshot.call(req, options, &block)
1082
1123
  nil
1083
1124
  end
1084
1125
 
1085
1126
  # Seeks an existing subscription to a point in time or to a given snapshot,
1086
- # whichever is provided in the request.<br><br>
1087
- # <b>ALPHA:</b> This feature is part of an alpha release. This API might be
1127
+ # whichever is provided in the request. Snapshots are used in
1128
+ # <a href="https://cloud.google.com/pubsub/docs/replay-overview">Seek</a>
1129
+ # operations, which allow
1130
+ # you to manage message acknowledgments in bulk. That is, you can set the
1131
+ # acknowledgment state of messages in an existing subscription to the state
1132
+ # captured by a snapshot. Note that both the subscription and the snapshot
1133
+ # must be on the same topic.<br><br>
1134
+ # <b>BETA:</b> This feature is part of a beta release. This API might be
1088
1135
  # changed in backward-incompatible ways and is not recommended for production
1089
1136
  # use. It is not subject to any SLA or deprecation policy.
1090
1137
  #
@@ -1112,15 +1159,15 @@ module Google
1112
1159
  # Overrides the default settings for this call, e.g, timeout,
1113
1160
  # retries, etc.
1114
1161
  # @yield [result, operation] Access the result along with the RPC operation
1115
- # @yieldparam result [Google::Pubsub::V1::SeekResponse]
1162
+ # @yieldparam result [Google::Cloud::PubSub::V1::SeekResponse]
1116
1163
  # @yieldparam operation [GRPC::ActiveCall::Operation]
1117
- # @return [Google::Pubsub::V1::SeekResponse]
1164
+ # @return [Google::Cloud::PubSub::V1::SeekResponse]
1118
1165
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
1119
1166
  # @example
1120
1167
  # require "google/cloud/pubsub"
1121
1168
  #
1122
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
1123
- # formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
1169
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
1170
+ # formatted_subscription = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
1124
1171
  # response = subscriber_client.seek(formatted_subscription)
1125
1172
 
1126
1173
  def seek \
@@ -1134,7 +1181,7 @@ module Google
1134
1181
  time: time,
1135
1182
  snapshot: snapshot
1136
1183
  }.delete_if { |_, v| v.nil? }
1137
- req = Google::Gax::to_proto(req, Google::Pubsub::V1::SeekRequest)
1184
+ req = Google::Gax::to_proto(req, Google::Cloud::PubSub::V1::SeekRequest)
1138
1185
  @seek.call(req, options, &block)
1139
1186
  end
1140
1187
 
@@ -1163,8 +1210,8 @@ module Google
1163
1210
  # @example
1164
1211
  # require "google/cloud/pubsub"
1165
1212
  #
1166
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
1167
- # formatted_resource = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
1213
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
1214
+ # formatted_resource = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
1168
1215
  #
1169
1216
  # # TODO: Initialize `policy`:
1170
1217
  # policy = {}
@@ -1202,8 +1249,8 @@ module Google
1202
1249
  # @example
1203
1250
  # require "google/cloud/pubsub"
1204
1251
  #
1205
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
1206
- # formatted_resource = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
1252
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
1253
+ # formatted_resource = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
1207
1254
  # response = subscriber_client.get_iam_policy(formatted_resource)
1208
1255
 
1209
1256
  def get_iam_policy \
@@ -1241,8 +1288,8 @@ module Google
1241
1288
  # @example
1242
1289
  # require "google/cloud/pubsub"
1243
1290
  #
1244
- # subscriber_client = Google::Cloud::Pubsub::Subscriber.new(version: :v1)
1245
- # formatted_resource = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
1291
+ # subscriber_client = Google::Cloud::PubSub::Subscriber.new(version: :v1)
1292
+ # formatted_resource = Google::Cloud::PubSub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
1246
1293
  #
1247
1294
  # # TODO: Initialize `permissions`:
1248
1295
  # permissions = []
@@ -1263,5 +1310,7 @@ module Google
1263
1310
  end
1264
1311
  end
1265
1312
  end
1313
+
1314
+ Pubsub = PubSub unless const_defined? :Pubsub
1266
1315
  end
1267
1316
  end