google-cloud-pubsub-v1 0.5.0 → 0.6.1
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.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +3 -3
- data/lib/google/cloud/pubsub/v1/iam_policy/client.rb +98 -48
- data/lib/google/cloud/pubsub/v1/publisher/client.rb +252 -73
- data/lib/google/cloud/pubsub/v1/schema_service/client.rb +173 -60
- data/lib/google/cloud/pubsub/v1/subscriber/client.rb +416 -99
- data/lib/google/cloud/pubsub/v1/version.rb +1 -1
- data/lib/google/pubsub/v1/pubsub_pb.rb +4 -2
- data/lib/google/pubsub/v1/schema_pb.rb +2 -2
- data/proto_docs/google/api/field_behavior.rb +7 -1
- data/proto_docs/google/pubsub/v1/pubsub.rb +21 -2
- data/proto_docs/google/pubsub/v1/schema.rb +2 -0
- data/proto_docs/google/type/expr.rb +35 -12
- metadata +4 -5
- data/lib/google/iam/v1/iam_policy_services_pb.rb +0 -81
@@ -43,13 +43,12 @@ module Google
|
|
43
43
|
# See {::Google::Cloud::PubSub::V1::Subscriber::Client::Configuration}
|
44
44
|
# for a description of the configuration fields.
|
45
45
|
#
|
46
|
-
#
|
46
|
+
# @example
|
47
47
|
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
# end
|
48
|
+
# # Modify the configuration for all Subscriber clients
|
49
|
+
# ::Google::Cloud::PubSub::V1::Subscriber::Client.configure do |config|
|
50
|
+
# config.timeout = 10.0
|
51
|
+
# end
|
53
52
|
#
|
54
53
|
# @yield [config] Configure the Client client.
|
55
54
|
# @yieldparam config [Client::Configuration]
|
@@ -176,19 +175,15 @@ module Google
|
|
176
175
|
##
|
177
176
|
# Create a new Subscriber client object.
|
178
177
|
#
|
179
|
-
#
|
180
|
-
#
|
181
|
-
# To create a new Subscriber client with the default
|
182
|
-
# configuration:
|
183
|
-
#
|
184
|
-
# client = ::Google::Cloud::PubSub::V1::Subscriber::Client.new
|
178
|
+
# @example
|
185
179
|
#
|
186
|
-
#
|
187
|
-
#
|
180
|
+
# # Create a client using the default configuration
|
181
|
+
# client = ::Google::Cloud::PubSub::V1::Subscriber::Client.new
|
188
182
|
#
|
189
|
-
#
|
190
|
-
#
|
191
|
-
#
|
183
|
+
# # Create a client using a custom configuration
|
184
|
+
# client = ::Google::Cloud::PubSub::V1::Subscriber::Client.new do |config|
|
185
|
+
# config.timeout = 10.0
|
186
|
+
# end
|
192
187
|
#
|
193
188
|
# @yield [config] Configure the Subscriber client.
|
194
189
|
# @yieldparam config [Client::Configuration]
|
@@ -208,10 +203,9 @@ module Google
|
|
208
203
|
|
209
204
|
# Create credentials
|
210
205
|
credentials = @config.credentials
|
211
|
-
# Use self-signed JWT if the
|
206
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
212
207
|
# but only if the default endpoint does not have a region prefix.
|
213
|
-
enable_self_signed_jwt = @config.
|
214
|
-
@config.endpoint == Client.configure.endpoint &&
|
208
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
215
209
|
!@config.endpoint.split(".").first.include?("-")
|
216
210
|
credentials ||= Credentials.default scope: @config.scope,
|
217
211
|
enable_self_signed_jwt: enable_self_signed_jwt
|
@@ -300,8 +294,9 @@ module Google
|
|
300
294
|
# Indicates whether to retain acknowledged messages. If true, then
|
301
295
|
# messages are not expunged from the subscription's backlog, even if they are
|
302
296
|
# acknowledged, until they fall out of the `message_retention_duration`
|
303
|
-
# window. This must be true if you would like to [Seek to a timestamp]
|
304
|
-
# (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
|
297
|
+
# window. This must be true if you would like to [`Seek` to a timestamp]
|
298
|
+
# (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in
|
299
|
+
# the past to replay previously-acknowledged messages.
|
305
300
|
# @param message_retention_duration [::Google::Protobuf::Duration, ::Hash]
|
306
301
|
# How long to retain unacknowledged messages in the subscription's backlog,
|
307
302
|
# from the moment a message is published.
|
@@ -362,6 +357,21 @@ module Google
|
|
362
357
|
#
|
363
358
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
364
359
|
#
|
360
|
+
# @example Basic example
|
361
|
+
# require "google/cloud/pubsub/v1"
|
362
|
+
#
|
363
|
+
# # Create a client object. The client can be reused for multiple calls.
|
364
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
365
|
+
#
|
366
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
367
|
+
# request = Google::Cloud::PubSub::V1::Subscription.new
|
368
|
+
#
|
369
|
+
# # Call the create_subscription method.
|
370
|
+
# result = client.create_subscription request
|
371
|
+
#
|
372
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Subscription.
|
373
|
+
# p result
|
374
|
+
#
|
365
375
|
def create_subscription request, options = nil
|
366
376
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
367
377
|
|
@@ -379,16 +389,20 @@ module Google
|
|
379
389
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
380
390
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
381
391
|
|
382
|
-
header_params = {
|
383
|
-
|
384
|
-
|
392
|
+
header_params = {}
|
393
|
+
if request.name
|
394
|
+
header_params["name"] = request.name
|
395
|
+
end
|
396
|
+
|
385
397
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
386
398
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
387
399
|
|
388
400
|
options.apply_defaults timeout: @config.rpcs.create_subscription.timeout,
|
389
401
|
metadata: metadata,
|
390
402
|
retry_policy: @config.rpcs.create_subscription.retry_policy
|
391
|
-
|
403
|
+
|
404
|
+
options.apply_defaults timeout: @config.timeout,
|
405
|
+
metadata: @config.metadata,
|
392
406
|
retry_policy: @config.retry_policy
|
393
407
|
|
394
408
|
@subscriber_stub.call_rpc :create_subscription, request, options: options do |response, operation|
|
@@ -429,6 +443,21 @@ module Google
|
|
429
443
|
#
|
430
444
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
431
445
|
#
|
446
|
+
# @example Basic example
|
447
|
+
# require "google/cloud/pubsub/v1"
|
448
|
+
#
|
449
|
+
# # Create a client object. The client can be reused for multiple calls.
|
450
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
451
|
+
#
|
452
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
453
|
+
# request = Google::Cloud::PubSub::V1::GetSubscriptionRequest.new
|
454
|
+
#
|
455
|
+
# # Call the get_subscription method.
|
456
|
+
# result = client.get_subscription request
|
457
|
+
#
|
458
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Subscription.
|
459
|
+
# p result
|
460
|
+
#
|
432
461
|
def get_subscription request, options = nil
|
433
462
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
434
463
|
|
@@ -446,16 +475,20 @@ module Google
|
|
446
475
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
447
476
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
448
477
|
|
449
|
-
header_params = {
|
450
|
-
|
451
|
-
|
478
|
+
header_params = {}
|
479
|
+
if request.subscription
|
480
|
+
header_params["subscription"] = request.subscription
|
481
|
+
end
|
482
|
+
|
452
483
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
453
484
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
454
485
|
|
455
486
|
options.apply_defaults timeout: @config.rpcs.get_subscription.timeout,
|
456
487
|
metadata: metadata,
|
457
488
|
retry_policy: @config.rpcs.get_subscription.retry_policy
|
458
|
-
|
489
|
+
|
490
|
+
options.apply_defaults timeout: @config.timeout,
|
491
|
+
metadata: @config.metadata,
|
459
492
|
retry_policy: @config.retry_policy
|
460
493
|
|
461
494
|
@subscriber_stub.call_rpc :get_subscription, request, options: options do |response, operation|
|
@@ -499,6 +532,21 @@ module Google
|
|
499
532
|
#
|
500
533
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
501
534
|
#
|
535
|
+
# @example Basic example
|
536
|
+
# require "google/cloud/pubsub/v1"
|
537
|
+
#
|
538
|
+
# # Create a client object. The client can be reused for multiple calls.
|
539
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
540
|
+
#
|
541
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
542
|
+
# request = Google::Cloud::PubSub::V1::UpdateSubscriptionRequest.new
|
543
|
+
#
|
544
|
+
# # Call the update_subscription method.
|
545
|
+
# result = client.update_subscription request
|
546
|
+
#
|
547
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Subscription.
|
548
|
+
# p result
|
549
|
+
#
|
502
550
|
def update_subscription request, options = nil
|
503
551
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
504
552
|
|
@@ -516,16 +564,20 @@ module Google
|
|
516
564
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
517
565
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
518
566
|
|
519
|
-
header_params = {
|
520
|
-
|
521
|
-
|
567
|
+
header_params = {}
|
568
|
+
if request.subscription&.name
|
569
|
+
header_params["subscription.name"] = request.subscription.name
|
570
|
+
end
|
571
|
+
|
522
572
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
523
573
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
524
574
|
|
525
575
|
options.apply_defaults timeout: @config.rpcs.update_subscription.timeout,
|
526
576
|
metadata: metadata,
|
527
577
|
retry_policy: @config.rpcs.update_subscription.retry_policy
|
528
|
-
|
578
|
+
|
579
|
+
options.apply_defaults timeout: @config.timeout,
|
580
|
+
metadata: @config.metadata,
|
529
581
|
retry_policy: @config.retry_policy
|
530
582
|
|
531
583
|
@subscriber_stub.call_rpc :update_subscription, request, options: options do |response, operation|
|
@@ -572,6 +624,27 @@ module Google
|
|
572
624
|
#
|
573
625
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
574
626
|
#
|
627
|
+
# @example Basic example
|
628
|
+
# require "google/cloud/pubsub/v1"
|
629
|
+
#
|
630
|
+
# # Create a client object. The client can be reused for multiple calls.
|
631
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
632
|
+
#
|
633
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
634
|
+
# request = Google::Cloud::PubSub::V1::ListSubscriptionsRequest.new
|
635
|
+
#
|
636
|
+
# # Call the list_subscriptions method.
|
637
|
+
# result = client.list_subscriptions request
|
638
|
+
#
|
639
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
640
|
+
# # iterate over all elements by calling #each, and the enumerable
|
641
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
642
|
+
# # methods are also available for managing paging directly.
|
643
|
+
# result.each do |response|
|
644
|
+
# # Each element is of type ::Google::Cloud::PubSub::V1::Subscription.
|
645
|
+
# p response
|
646
|
+
# end
|
647
|
+
#
|
575
648
|
def list_subscriptions request, options = nil
|
576
649
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
577
650
|
|
@@ -589,16 +662,20 @@ module Google
|
|
589
662
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
590
663
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
591
664
|
|
592
|
-
header_params = {
|
593
|
-
|
594
|
-
|
665
|
+
header_params = {}
|
666
|
+
if request.project
|
667
|
+
header_params["project"] = request.project
|
668
|
+
end
|
669
|
+
|
595
670
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
596
671
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
597
672
|
|
598
673
|
options.apply_defaults timeout: @config.rpcs.list_subscriptions.timeout,
|
599
674
|
metadata: metadata,
|
600
675
|
retry_policy: @config.rpcs.list_subscriptions.retry_policy
|
601
|
-
|
676
|
+
|
677
|
+
options.apply_defaults timeout: @config.timeout,
|
678
|
+
metadata: @config.metadata,
|
602
679
|
retry_policy: @config.retry_policy
|
603
680
|
|
604
681
|
@subscriber_stub.call_rpc :list_subscriptions, request, options: options do |response, operation|
|
@@ -644,6 +721,21 @@ module Google
|
|
644
721
|
#
|
645
722
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
646
723
|
#
|
724
|
+
# @example Basic example
|
725
|
+
# require "google/cloud/pubsub/v1"
|
726
|
+
#
|
727
|
+
# # Create a client object. The client can be reused for multiple calls.
|
728
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
729
|
+
#
|
730
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
731
|
+
# request = Google::Cloud::PubSub::V1::DeleteSubscriptionRequest.new
|
732
|
+
#
|
733
|
+
# # Call the delete_subscription method.
|
734
|
+
# result = client.delete_subscription request
|
735
|
+
#
|
736
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
737
|
+
# p result
|
738
|
+
#
|
647
739
|
def delete_subscription request, options = nil
|
648
740
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
649
741
|
|
@@ -661,16 +753,20 @@ module Google
|
|
661
753
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
662
754
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
663
755
|
|
664
|
-
header_params = {
|
665
|
-
|
666
|
-
|
756
|
+
header_params = {}
|
757
|
+
if request.subscription
|
758
|
+
header_params["subscription"] = request.subscription
|
759
|
+
end
|
760
|
+
|
667
761
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
668
762
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
669
763
|
|
670
764
|
options.apply_defaults timeout: @config.rpcs.delete_subscription.timeout,
|
671
765
|
metadata: metadata,
|
672
766
|
retry_policy: @config.rpcs.delete_subscription.retry_policy
|
673
|
-
|
767
|
+
|
768
|
+
options.apply_defaults timeout: @config.timeout,
|
769
|
+
metadata: @config.metadata,
|
674
770
|
retry_policy: @config.retry_policy
|
675
771
|
|
676
772
|
@subscriber_stub.call_rpc :delete_subscription, request, options: options do |response, operation|
|
@@ -726,6 +822,21 @@ module Google
|
|
726
822
|
#
|
727
823
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
728
824
|
#
|
825
|
+
# @example Basic example
|
826
|
+
# require "google/cloud/pubsub/v1"
|
827
|
+
#
|
828
|
+
# # Create a client object. The client can be reused for multiple calls.
|
829
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
830
|
+
#
|
831
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
832
|
+
# request = Google::Cloud::PubSub::V1::ModifyAckDeadlineRequest.new
|
833
|
+
#
|
834
|
+
# # Call the modify_ack_deadline method.
|
835
|
+
# result = client.modify_ack_deadline request
|
836
|
+
#
|
837
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
838
|
+
# p result
|
839
|
+
#
|
729
840
|
def modify_ack_deadline request, options = nil
|
730
841
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
731
842
|
|
@@ -743,16 +854,20 @@ module Google
|
|
743
854
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
744
855
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
745
856
|
|
746
|
-
header_params = {
|
747
|
-
|
748
|
-
|
857
|
+
header_params = {}
|
858
|
+
if request.subscription
|
859
|
+
header_params["subscription"] = request.subscription
|
860
|
+
end
|
861
|
+
|
749
862
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
750
863
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
751
864
|
|
752
865
|
options.apply_defaults timeout: @config.rpcs.modify_ack_deadline.timeout,
|
753
866
|
metadata: metadata,
|
754
867
|
retry_policy: @config.rpcs.modify_ack_deadline.retry_policy
|
755
|
-
|
868
|
+
|
869
|
+
options.apply_defaults timeout: @config.timeout,
|
870
|
+
metadata: @config.metadata,
|
756
871
|
retry_policy: @config.retry_policy
|
757
872
|
|
758
873
|
@subscriber_stub.call_rpc :modify_ack_deadline, request, options: options do |response, operation|
|
@@ -803,6 +918,21 @@ module Google
|
|
803
918
|
#
|
804
919
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
805
920
|
#
|
921
|
+
# @example Basic example
|
922
|
+
# require "google/cloud/pubsub/v1"
|
923
|
+
#
|
924
|
+
# # Create a client object. The client can be reused for multiple calls.
|
925
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
926
|
+
#
|
927
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
928
|
+
# request = Google::Cloud::PubSub::V1::AcknowledgeRequest.new
|
929
|
+
#
|
930
|
+
# # Call the acknowledge method.
|
931
|
+
# result = client.acknowledge request
|
932
|
+
#
|
933
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
934
|
+
# p result
|
935
|
+
#
|
806
936
|
def acknowledge request, options = nil
|
807
937
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
808
938
|
|
@@ -820,16 +950,20 @@ module Google
|
|
820
950
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
821
951
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
822
952
|
|
823
|
-
header_params = {
|
824
|
-
|
825
|
-
|
953
|
+
header_params = {}
|
954
|
+
if request.subscription
|
955
|
+
header_params["subscription"] = request.subscription
|
956
|
+
end
|
957
|
+
|
826
958
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
827
959
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
828
960
|
|
829
961
|
options.apply_defaults timeout: @config.rpcs.acknowledge.timeout,
|
830
962
|
metadata: metadata,
|
831
963
|
retry_policy: @config.rpcs.acknowledge.retry_policy
|
832
|
-
|
964
|
+
|
965
|
+
options.apply_defaults timeout: @config.timeout,
|
966
|
+
metadata: @config.metadata,
|
833
967
|
retry_policy: @config.retry_policy
|
834
968
|
|
835
969
|
@subscriber_stub.call_rpc :acknowledge, request, options: options do |response, operation|
|
@@ -884,6 +1018,21 @@ module Google
|
|
884
1018
|
#
|
885
1019
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
886
1020
|
#
|
1021
|
+
# @example Basic example
|
1022
|
+
# require "google/cloud/pubsub/v1"
|
1023
|
+
#
|
1024
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1025
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
1026
|
+
#
|
1027
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1028
|
+
# request = Google::Cloud::PubSub::V1::PullRequest.new
|
1029
|
+
#
|
1030
|
+
# # Call the pull method.
|
1031
|
+
# result = client.pull request
|
1032
|
+
#
|
1033
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::PullResponse.
|
1034
|
+
# p result
|
1035
|
+
#
|
887
1036
|
def pull request, options = nil
|
888
1037
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
889
1038
|
|
@@ -901,16 +1050,20 @@ module Google
|
|
901
1050
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
902
1051
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
903
1052
|
|
904
|
-
header_params = {
|
905
|
-
|
906
|
-
|
1053
|
+
header_params = {}
|
1054
|
+
if request.subscription
|
1055
|
+
header_params["subscription"] = request.subscription
|
1056
|
+
end
|
1057
|
+
|
907
1058
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
908
1059
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
909
1060
|
|
910
1061
|
options.apply_defaults timeout: @config.rpcs.pull.timeout,
|
911
1062
|
metadata: metadata,
|
912
1063
|
retry_policy: @config.rpcs.pull.retry_policy
|
913
|
-
|
1064
|
+
|
1065
|
+
options.apply_defaults timeout: @config.timeout,
|
1066
|
+
metadata: @config.metadata,
|
914
1067
|
retry_policy: @config.retry_policy
|
915
1068
|
|
916
1069
|
@subscriber_stub.call_rpc :pull, request, options: options do |response, operation|
|
@@ -943,6 +1096,30 @@ module Google
|
|
943
1096
|
#
|
944
1097
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
945
1098
|
#
|
1099
|
+
# @example Basic example
|
1100
|
+
# require "google/cloud/pubsub/v1"
|
1101
|
+
#
|
1102
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1103
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
1104
|
+
#
|
1105
|
+
# # Create an input stream
|
1106
|
+
# input = Gapic::StreamInput.new
|
1107
|
+
#
|
1108
|
+
# # Call the streaming_pull method to start streaming.
|
1109
|
+
# output = client.streaming_pull input
|
1110
|
+
#
|
1111
|
+
# # Send requests on the stream. For each request, pass in keyword
|
1112
|
+
# # arguments to set fields. Be sure to close the stream when done.
|
1113
|
+
# input << Google::Cloud::PubSub::V1::StreamingPullRequest.new
|
1114
|
+
# input << Google::Cloud::PubSub::V1::StreamingPullRequest.new
|
1115
|
+
# input.close
|
1116
|
+
#
|
1117
|
+
# # Handle streamed responses. These may be interleaved with inputs.
|
1118
|
+
# # Each response is of type ::Google::Cloud::PubSub::V1::StreamingPullResponse.
|
1119
|
+
# output.each do |response|
|
1120
|
+
# p response
|
1121
|
+
# end
|
1122
|
+
#
|
946
1123
|
def streaming_pull request, options = nil
|
947
1124
|
unless request.is_a? ::Enumerable
|
948
1125
|
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
@@ -968,7 +1145,9 @@ module Google
|
|
968
1145
|
options.apply_defaults timeout: @config.rpcs.streaming_pull.timeout,
|
969
1146
|
metadata: metadata,
|
970
1147
|
retry_policy: @config.rpcs.streaming_pull.retry_policy
|
971
|
-
|
1148
|
+
|
1149
|
+
options.apply_defaults timeout: @config.timeout,
|
1150
|
+
metadata: @config.metadata,
|
972
1151
|
retry_policy: @config.retry_policy
|
973
1152
|
|
974
1153
|
@subscriber_stub.call_rpc :streaming_pull, request, options: options do |response, operation|
|
@@ -1021,6 +1200,21 @@ module Google
|
|
1021
1200
|
#
|
1022
1201
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1023
1202
|
#
|
1203
|
+
# @example Basic example
|
1204
|
+
# require "google/cloud/pubsub/v1"
|
1205
|
+
#
|
1206
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1207
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
1208
|
+
#
|
1209
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1210
|
+
# request = Google::Cloud::PubSub::V1::ModifyPushConfigRequest.new
|
1211
|
+
#
|
1212
|
+
# # Call the modify_push_config method.
|
1213
|
+
# result = client.modify_push_config request
|
1214
|
+
#
|
1215
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
1216
|
+
# p result
|
1217
|
+
#
|
1024
1218
|
def modify_push_config request, options = nil
|
1025
1219
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1026
1220
|
|
@@ -1038,16 +1232,20 @@ module Google
|
|
1038
1232
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1039
1233
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1040
1234
|
|
1041
|
-
header_params = {
|
1042
|
-
|
1043
|
-
|
1235
|
+
header_params = {}
|
1236
|
+
if request.subscription
|
1237
|
+
header_params["subscription"] = request.subscription
|
1238
|
+
end
|
1239
|
+
|
1044
1240
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1045
1241
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1046
1242
|
|
1047
1243
|
options.apply_defaults timeout: @config.rpcs.modify_push_config.timeout,
|
1048
1244
|
metadata: metadata,
|
1049
1245
|
retry_policy: @config.rpcs.modify_push_config.retry_policy
|
1050
|
-
|
1246
|
+
|
1247
|
+
options.apply_defaults timeout: @config.timeout,
|
1248
|
+
metadata: @config.metadata,
|
1051
1249
|
retry_policy: @config.retry_policy
|
1052
1250
|
|
1053
1251
|
@subscriber_stub.call_rpc :modify_push_config, request, options: options do |response, operation|
|
@@ -1092,6 +1290,21 @@ module Google
|
|
1092
1290
|
#
|
1093
1291
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1094
1292
|
#
|
1293
|
+
# @example Basic example
|
1294
|
+
# require "google/cloud/pubsub/v1"
|
1295
|
+
#
|
1296
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1297
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
1298
|
+
#
|
1299
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1300
|
+
# request = Google::Cloud::PubSub::V1::GetSnapshotRequest.new
|
1301
|
+
#
|
1302
|
+
# # Call the get_snapshot method.
|
1303
|
+
# result = client.get_snapshot request
|
1304
|
+
#
|
1305
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Snapshot.
|
1306
|
+
# p result
|
1307
|
+
#
|
1095
1308
|
def get_snapshot request, options = nil
|
1096
1309
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1097
1310
|
|
@@ -1109,16 +1322,20 @@ module Google
|
|
1109
1322
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1110
1323
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1111
1324
|
|
1112
|
-
header_params = {
|
1113
|
-
|
1114
|
-
|
1325
|
+
header_params = {}
|
1326
|
+
if request.snapshot
|
1327
|
+
header_params["snapshot"] = request.snapshot
|
1328
|
+
end
|
1329
|
+
|
1115
1330
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1116
1331
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1117
1332
|
|
1118
1333
|
options.apply_defaults timeout: @config.rpcs.get_snapshot.timeout,
|
1119
1334
|
metadata: metadata,
|
1120
1335
|
retry_policy: @config.rpcs.get_snapshot.retry_policy
|
1121
|
-
|
1336
|
+
|
1337
|
+
options.apply_defaults timeout: @config.timeout,
|
1338
|
+
metadata: @config.metadata,
|
1122
1339
|
retry_policy: @config.retry_policy
|
1123
1340
|
|
1124
1341
|
@subscriber_stub.call_rpc :get_snapshot, request, options: options do |response, operation|
|
@@ -1169,6 +1386,27 @@ module Google
|
|
1169
1386
|
#
|
1170
1387
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1171
1388
|
#
|
1389
|
+
# @example Basic example
|
1390
|
+
# require "google/cloud/pubsub/v1"
|
1391
|
+
#
|
1392
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1393
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
1394
|
+
#
|
1395
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1396
|
+
# request = Google::Cloud::PubSub::V1::ListSnapshotsRequest.new
|
1397
|
+
#
|
1398
|
+
# # Call the list_snapshots method.
|
1399
|
+
# result = client.list_snapshots request
|
1400
|
+
#
|
1401
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
1402
|
+
# # iterate over all elements by calling #each, and the enumerable
|
1403
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
1404
|
+
# # methods are also available for managing paging directly.
|
1405
|
+
# result.each do |response|
|
1406
|
+
# # Each element is of type ::Google::Cloud::PubSub::V1::Snapshot.
|
1407
|
+
# p response
|
1408
|
+
# end
|
1409
|
+
#
|
1172
1410
|
def list_snapshots request, options = nil
|
1173
1411
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1174
1412
|
|
@@ -1186,16 +1424,20 @@ module Google
|
|
1186
1424
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1187
1425
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1188
1426
|
|
1189
|
-
header_params = {
|
1190
|
-
|
1191
|
-
|
1427
|
+
header_params = {}
|
1428
|
+
if request.project
|
1429
|
+
header_params["project"] = request.project
|
1430
|
+
end
|
1431
|
+
|
1192
1432
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1193
1433
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1194
1434
|
|
1195
1435
|
options.apply_defaults timeout: @config.rpcs.list_snapshots.timeout,
|
1196
1436
|
metadata: metadata,
|
1197
1437
|
retry_policy: @config.rpcs.list_snapshots.retry_policy
|
1198
|
-
|
1438
|
+
|
1439
|
+
options.apply_defaults timeout: @config.timeout,
|
1440
|
+
metadata: @config.metadata,
|
1199
1441
|
retry_policy: @config.retry_policy
|
1200
1442
|
|
1201
1443
|
@subscriber_stub.call_rpc :list_snapshots, request, options: options do |response, operation|
|
@@ -1269,6 +1511,21 @@ module Google
|
|
1269
1511
|
#
|
1270
1512
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1271
1513
|
#
|
1514
|
+
# @example Basic example
|
1515
|
+
# require "google/cloud/pubsub/v1"
|
1516
|
+
#
|
1517
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1518
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
1519
|
+
#
|
1520
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1521
|
+
# request = Google::Cloud::PubSub::V1::CreateSnapshotRequest.new
|
1522
|
+
#
|
1523
|
+
# # Call the create_snapshot method.
|
1524
|
+
# result = client.create_snapshot request
|
1525
|
+
#
|
1526
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Snapshot.
|
1527
|
+
# p result
|
1528
|
+
#
|
1272
1529
|
def create_snapshot request, options = nil
|
1273
1530
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1274
1531
|
|
@@ -1286,16 +1543,20 @@ module Google
|
|
1286
1543
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1287
1544
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1288
1545
|
|
1289
|
-
header_params = {
|
1290
|
-
|
1291
|
-
|
1546
|
+
header_params = {}
|
1547
|
+
if request.name
|
1548
|
+
header_params["name"] = request.name
|
1549
|
+
end
|
1550
|
+
|
1292
1551
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1293
1552
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1294
1553
|
|
1295
1554
|
options.apply_defaults timeout: @config.rpcs.create_snapshot.timeout,
|
1296
1555
|
metadata: metadata,
|
1297
1556
|
retry_policy: @config.rpcs.create_snapshot.retry_policy
|
1298
|
-
|
1557
|
+
|
1558
|
+
options.apply_defaults timeout: @config.timeout,
|
1559
|
+
metadata: @config.metadata,
|
1299
1560
|
retry_policy: @config.retry_policy
|
1300
1561
|
|
1301
1562
|
@subscriber_stub.call_rpc :create_snapshot, request, options: options do |response, operation|
|
@@ -1343,6 +1604,21 @@ module Google
|
|
1343
1604
|
#
|
1344
1605
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1345
1606
|
#
|
1607
|
+
# @example Basic example
|
1608
|
+
# require "google/cloud/pubsub/v1"
|
1609
|
+
#
|
1610
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1611
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
1612
|
+
#
|
1613
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1614
|
+
# request = Google::Cloud::PubSub::V1::UpdateSnapshotRequest.new
|
1615
|
+
#
|
1616
|
+
# # Call the update_snapshot method.
|
1617
|
+
# result = client.update_snapshot request
|
1618
|
+
#
|
1619
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Snapshot.
|
1620
|
+
# p result
|
1621
|
+
#
|
1346
1622
|
def update_snapshot request, options = nil
|
1347
1623
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1348
1624
|
|
@@ -1360,16 +1636,20 @@ module Google
|
|
1360
1636
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1361
1637
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1362
1638
|
|
1363
|
-
header_params = {
|
1364
|
-
|
1365
|
-
|
1639
|
+
header_params = {}
|
1640
|
+
if request.snapshot&.name
|
1641
|
+
header_params["snapshot.name"] = request.snapshot.name
|
1642
|
+
end
|
1643
|
+
|
1366
1644
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1367
1645
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1368
1646
|
|
1369
1647
|
options.apply_defaults timeout: @config.rpcs.update_snapshot.timeout,
|
1370
1648
|
metadata: metadata,
|
1371
1649
|
retry_policy: @config.rpcs.update_snapshot.retry_policy
|
1372
|
-
|
1650
|
+
|
1651
|
+
options.apply_defaults timeout: @config.timeout,
|
1652
|
+
metadata: @config.metadata,
|
1373
1653
|
retry_policy: @config.retry_policy
|
1374
1654
|
|
1375
1655
|
@subscriber_stub.call_rpc :update_snapshot, request, options: options do |response, operation|
|
@@ -1418,6 +1698,21 @@ module Google
|
|
1418
1698
|
#
|
1419
1699
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1420
1700
|
#
|
1701
|
+
# @example Basic example
|
1702
|
+
# require "google/cloud/pubsub/v1"
|
1703
|
+
#
|
1704
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1705
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
1706
|
+
#
|
1707
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1708
|
+
# request = Google::Cloud::PubSub::V1::DeleteSnapshotRequest.new
|
1709
|
+
#
|
1710
|
+
# # Call the delete_snapshot method.
|
1711
|
+
# result = client.delete_snapshot request
|
1712
|
+
#
|
1713
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
1714
|
+
# p result
|
1715
|
+
#
|
1421
1716
|
def delete_snapshot request, options = nil
|
1422
1717
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1423
1718
|
|
@@ -1435,16 +1730,20 @@ module Google
|
|
1435
1730
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1436
1731
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1437
1732
|
|
1438
|
-
header_params = {
|
1439
|
-
|
1440
|
-
|
1733
|
+
header_params = {}
|
1734
|
+
if request.snapshot
|
1735
|
+
header_params["snapshot"] = request.snapshot
|
1736
|
+
end
|
1737
|
+
|
1441
1738
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1442
1739
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1443
1740
|
|
1444
1741
|
options.apply_defaults timeout: @config.rpcs.delete_snapshot.timeout,
|
1445
1742
|
metadata: metadata,
|
1446
1743
|
retry_policy: @config.rpcs.delete_snapshot.retry_policy
|
1447
|
-
|
1744
|
+
|
1745
|
+
options.apply_defaults timeout: @config.timeout,
|
1746
|
+
metadata: @config.metadata,
|
1448
1747
|
retry_policy: @config.retry_policy
|
1449
1748
|
|
1450
1749
|
@subscriber_stub.call_rpc :delete_snapshot, request, options: options do |response, operation|
|
@@ -1506,6 +1805,21 @@ module Google
|
|
1506
1805
|
#
|
1507
1806
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1508
1807
|
#
|
1808
|
+
# @example Basic example
|
1809
|
+
# require "google/cloud/pubsub/v1"
|
1810
|
+
#
|
1811
|
+
# # Create a client object. The client can be reused for multiple calls.
|
1812
|
+
# client = Google::Cloud::PubSub::V1::Subscriber::Client.new
|
1813
|
+
#
|
1814
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
1815
|
+
# request = Google::Cloud::PubSub::V1::SeekRequest.new
|
1816
|
+
#
|
1817
|
+
# # Call the seek method.
|
1818
|
+
# result = client.seek request
|
1819
|
+
#
|
1820
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::SeekResponse.
|
1821
|
+
# p result
|
1822
|
+
#
|
1509
1823
|
def seek request, options = nil
|
1510
1824
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1511
1825
|
|
@@ -1523,16 +1837,20 @@ module Google
|
|
1523
1837
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1524
1838
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1525
1839
|
|
1526
|
-
header_params = {
|
1527
|
-
|
1528
|
-
|
1840
|
+
header_params = {}
|
1841
|
+
if request.subscription
|
1842
|
+
header_params["subscription"] = request.subscription
|
1843
|
+
end
|
1844
|
+
|
1529
1845
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1530
1846
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1531
1847
|
|
1532
1848
|
options.apply_defaults timeout: @config.rpcs.seek.timeout,
|
1533
1849
|
metadata: metadata,
|
1534
1850
|
retry_policy: @config.rpcs.seek.retry_policy
|
1535
|
-
|
1851
|
+
|
1852
|
+
options.apply_defaults timeout: @config.timeout,
|
1853
|
+
metadata: @config.metadata,
|
1536
1854
|
retry_policy: @config.retry_policy
|
1537
1855
|
|
1538
1856
|
@subscriber_stub.call_rpc :seek, request, options: options do |response, operation|
|
@@ -1556,22 +1874,21 @@ module Google
|
|
1556
1874
|
# Configuration can be applied globally to all clients, or to a single client
|
1557
1875
|
# on construction.
|
1558
1876
|
#
|
1559
|
-
#
|
1560
|
-
#
|
1561
|
-
#
|
1562
|
-
# to 20 seconds,
|
1563
|
-
#
|
1564
|
-
#
|
1565
|
-
#
|
1566
|
-
#
|
1567
|
-
#
|
1568
|
-
#
|
1569
|
-
#
|
1570
|
-
#
|
1571
|
-
#
|
1572
|
-
#
|
1573
|
-
#
|
1574
|
-
# end
|
1877
|
+
# @example
|
1878
|
+
#
|
1879
|
+
# # Modify the global config, setting the timeout for
|
1880
|
+
# # create_subscription to 20 seconds,
|
1881
|
+
# # and all remaining timeouts to 10 seconds.
|
1882
|
+
# ::Google::Cloud::PubSub::V1::Subscriber::Client.configure do |config|
|
1883
|
+
# config.timeout = 10.0
|
1884
|
+
# config.rpcs.create_subscription.timeout = 20.0
|
1885
|
+
# end
|
1886
|
+
#
|
1887
|
+
# # Apply the above configuration only to a new client.
|
1888
|
+
# client = ::Google::Cloud::PubSub::V1::Subscriber::Client.new do |config|
|
1889
|
+
# config.timeout = 10.0
|
1890
|
+
# config.rpcs.create_subscription.timeout = 20.0
|
1891
|
+
# end
|
1575
1892
|
#
|
1576
1893
|
# @!attribute [rw] endpoint
|
1577
1894
|
# The hostname or hostname:port of the service endpoint.
|