google-cloud-pubsub-v1 0.5.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -42,13 +42,12 @@ module Google
|
|
42
42
|
# See {::Google::Cloud::PubSub::V1::Publisher::Client::Configuration}
|
43
43
|
# for a description of the configuration fields.
|
44
44
|
#
|
45
|
-
#
|
45
|
+
# @example
|
46
46
|
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
# end
|
47
|
+
# # Modify the configuration for all Publisher clients
|
48
|
+
# ::Google::Cloud::PubSub::V1::Publisher::Client.configure do |config|
|
49
|
+
# config.timeout = 10.0
|
50
|
+
# end
|
52
51
|
#
|
53
52
|
# @yield [config] Configure the Client client.
|
54
53
|
# @yieldparam config [Client::Configuration]
|
@@ -140,19 +139,15 @@ module Google
|
|
140
139
|
##
|
141
140
|
# Create a new Publisher client object.
|
142
141
|
#
|
143
|
-
#
|
144
|
-
#
|
145
|
-
# To create a new Publisher client with the default
|
146
|
-
# configuration:
|
147
|
-
#
|
148
|
-
# client = ::Google::Cloud::PubSub::V1::Publisher::Client.new
|
142
|
+
# @example
|
149
143
|
#
|
150
|
-
#
|
151
|
-
#
|
144
|
+
# # Create a client using the default configuration
|
145
|
+
# client = ::Google::Cloud::PubSub::V1::Publisher::Client.new
|
152
146
|
#
|
153
|
-
#
|
154
|
-
#
|
155
|
-
#
|
147
|
+
# # Create a client using a custom configuration
|
148
|
+
# client = ::Google::Cloud::PubSub::V1::Publisher::Client.new do |config|
|
149
|
+
# config.timeout = 10.0
|
150
|
+
# end
|
156
151
|
#
|
157
152
|
# @yield [config] Configure the Publisher client.
|
158
153
|
# @yieldparam config [Client::Configuration]
|
@@ -172,10 +167,9 @@ module Google
|
|
172
167
|
|
173
168
|
# Create credentials
|
174
169
|
credentials = @config.credentials
|
175
|
-
# Use self-signed JWT if the
|
170
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
176
171
|
# but only if the default endpoint does not have a region prefix.
|
177
|
-
enable_self_signed_jwt = @config.
|
178
|
-
@config.endpoint == Client.configure.endpoint &&
|
172
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
179
173
|
!@config.endpoint.split(".").first.include?("-")
|
180
174
|
credentials ||= Credentials.default scope: @config.scope,
|
181
175
|
enable_self_signed_jwt: enable_self_signed_jwt
|
@@ -210,7 +204,7 @@ module Google
|
|
210
204
|
# @param options [::Gapic::CallOptions, ::Hash]
|
211
205
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
212
206
|
#
|
213
|
-
# @overload create_topic(name: nil, labels: nil, message_storage_policy: nil, kms_key_name: nil, schema_settings: nil, satisfies_pzs: nil)
|
207
|
+
# @overload create_topic(name: nil, labels: nil, message_storage_policy: nil, kms_key_name: nil, schema_settings: nil, satisfies_pzs: nil, message_retention_duration: nil)
|
214
208
|
# Pass arguments to `create_topic` via keyword arguments. Note that at
|
215
209
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
216
210
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -239,6 +233,15 @@ module Google
|
|
239
233
|
# @param satisfies_pzs [::Boolean]
|
240
234
|
# Reserved for future use. This field is set only in responses from the
|
241
235
|
# server; it is ignored if it is set in any requests.
|
236
|
+
# @param message_retention_duration [::Google::Protobuf::Duration, ::Hash]
|
237
|
+
# Indicates the minimum duration to retain a message after it is published to
|
238
|
+
# the topic. If this field is set, messages published to the topic in the
|
239
|
+
# last `message_retention_duration` are always available to subscribers. For
|
240
|
+
# instance, it allows any attached subscription to [seek to a
|
241
|
+
# timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
|
242
|
+
# that is up to `message_retention_duration` in the past. If this field is
|
243
|
+
# not set, message retention is controlled by settings on individual
|
244
|
+
# subscriptions. Cannot be more than 7 days or less than 10 minutes.
|
242
245
|
#
|
243
246
|
# @yield [response, operation] Access the result along with the RPC operation
|
244
247
|
# @yieldparam response [::Google::Cloud::PubSub::V1::Topic]
|
@@ -248,6 +251,21 @@ module Google
|
|
248
251
|
#
|
249
252
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
250
253
|
#
|
254
|
+
# @example Basic example
|
255
|
+
# require "google/cloud/pubsub/v1"
|
256
|
+
#
|
257
|
+
# # Create a client object. The client can be reused for multiple calls.
|
258
|
+
# client = Google::Cloud::PubSub::V1::Publisher::Client.new
|
259
|
+
#
|
260
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
261
|
+
# request = Google::Cloud::PubSub::V1::Topic.new
|
262
|
+
#
|
263
|
+
# # Call the create_topic method.
|
264
|
+
# result = client.create_topic request
|
265
|
+
#
|
266
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Topic.
|
267
|
+
# p result
|
268
|
+
#
|
251
269
|
def create_topic request, options = nil
|
252
270
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
253
271
|
|
@@ -265,16 +283,20 @@ module Google
|
|
265
283
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
266
284
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
267
285
|
|
268
|
-
header_params = {
|
269
|
-
|
270
|
-
|
286
|
+
header_params = {}
|
287
|
+
if request.name
|
288
|
+
header_params["name"] = request.name
|
289
|
+
end
|
290
|
+
|
271
291
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
272
292
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
273
293
|
|
274
294
|
options.apply_defaults timeout: @config.rpcs.create_topic.timeout,
|
275
295
|
metadata: metadata,
|
276
296
|
retry_policy: @config.rpcs.create_topic.retry_policy
|
277
|
-
|
297
|
+
|
298
|
+
options.apply_defaults timeout: @config.timeout,
|
299
|
+
metadata: @config.metadata,
|
278
300
|
retry_policy: @config.retry_policy
|
279
301
|
|
280
302
|
@publisher_stub.call_rpc :create_topic, request, options: options do |response, operation|
|
@@ -321,6 +343,21 @@ module Google
|
|
321
343
|
#
|
322
344
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
323
345
|
#
|
346
|
+
# @example Basic example
|
347
|
+
# require "google/cloud/pubsub/v1"
|
348
|
+
#
|
349
|
+
# # Create a client object. The client can be reused for multiple calls.
|
350
|
+
# client = Google::Cloud::PubSub::V1::Publisher::Client.new
|
351
|
+
#
|
352
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
353
|
+
# request = Google::Cloud::PubSub::V1::UpdateTopicRequest.new
|
354
|
+
#
|
355
|
+
# # Call the update_topic method.
|
356
|
+
# result = client.update_topic request
|
357
|
+
#
|
358
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Topic.
|
359
|
+
# p result
|
360
|
+
#
|
324
361
|
def update_topic request, options = nil
|
325
362
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
326
363
|
|
@@ -338,16 +375,20 @@ module Google
|
|
338
375
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
339
376
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
340
377
|
|
341
|
-
header_params = {
|
342
|
-
|
343
|
-
|
378
|
+
header_params = {}
|
379
|
+
if request.topic&.name
|
380
|
+
header_params["topic.name"] = request.topic.name
|
381
|
+
end
|
382
|
+
|
344
383
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
345
384
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
346
385
|
|
347
386
|
options.apply_defaults timeout: @config.rpcs.update_topic.timeout,
|
348
387
|
metadata: metadata,
|
349
388
|
retry_policy: @config.rpcs.update_topic.retry_policy
|
350
|
-
|
389
|
+
|
390
|
+
options.apply_defaults timeout: @config.timeout,
|
391
|
+
metadata: @config.metadata,
|
351
392
|
retry_policy: @config.retry_policy
|
352
393
|
|
353
394
|
@publisher_stub.call_rpc :update_topic, request, options: options do |response, operation|
|
@@ -391,6 +432,21 @@ module Google
|
|
391
432
|
#
|
392
433
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
393
434
|
#
|
435
|
+
# @example Basic example
|
436
|
+
# require "google/cloud/pubsub/v1"
|
437
|
+
#
|
438
|
+
# # Create a client object. The client can be reused for multiple calls.
|
439
|
+
# client = Google::Cloud::PubSub::V1::Publisher::Client.new
|
440
|
+
#
|
441
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
442
|
+
# request = Google::Cloud::PubSub::V1::PublishRequest.new
|
443
|
+
#
|
444
|
+
# # Call the publish method.
|
445
|
+
# result = client.publish request
|
446
|
+
#
|
447
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::PublishResponse.
|
448
|
+
# p result
|
449
|
+
#
|
394
450
|
def publish request, options = nil
|
395
451
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
396
452
|
|
@@ -408,16 +464,20 @@ module Google
|
|
408
464
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
409
465
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
410
466
|
|
411
|
-
header_params = {
|
412
|
-
|
413
|
-
|
467
|
+
header_params = {}
|
468
|
+
if request.topic
|
469
|
+
header_params["topic"] = request.topic
|
470
|
+
end
|
471
|
+
|
414
472
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
415
473
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
416
474
|
|
417
475
|
options.apply_defaults timeout: @config.rpcs.publish.timeout,
|
418
476
|
metadata: metadata,
|
419
477
|
retry_policy: @config.rpcs.publish.retry_policy
|
420
|
-
|
478
|
+
|
479
|
+
options.apply_defaults timeout: @config.timeout,
|
480
|
+
metadata: @config.metadata,
|
421
481
|
retry_policy: @config.retry_policy
|
422
482
|
|
423
483
|
@publisher_stub.call_rpc :publish, request, options: options do |response, operation|
|
@@ -458,6 +518,21 @@ module Google
|
|
458
518
|
#
|
459
519
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
460
520
|
#
|
521
|
+
# @example Basic example
|
522
|
+
# require "google/cloud/pubsub/v1"
|
523
|
+
#
|
524
|
+
# # Create a client object. The client can be reused for multiple calls.
|
525
|
+
# client = Google::Cloud::PubSub::V1::Publisher::Client.new
|
526
|
+
#
|
527
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
528
|
+
# request = Google::Cloud::PubSub::V1::GetTopicRequest.new
|
529
|
+
#
|
530
|
+
# # Call the get_topic method.
|
531
|
+
# result = client.get_topic request
|
532
|
+
#
|
533
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Topic.
|
534
|
+
# p result
|
535
|
+
#
|
461
536
|
def get_topic request, options = nil
|
462
537
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
463
538
|
|
@@ -475,16 +550,20 @@ module Google
|
|
475
550
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
476
551
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
477
552
|
|
478
|
-
header_params = {
|
479
|
-
|
480
|
-
|
553
|
+
header_params = {}
|
554
|
+
if request.topic
|
555
|
+
header_params["topic"] = request.topic
|
556
|
+
end
|
557
|
+
|
481
558
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
482
559
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
483
560
|
|
484
561
|
options.apply_defaults timeout: @config.rpcs.get_topic.timeout,
|
485
562
|
metadata: metadata,
|
486
563
|
retry_policy: @config.rpcs.get_topic.retry_policy
|
487
|
-
|
564
|
+
|
565
|
+
options.apply_defaults timeout: @config.timeout,
|
566
|
+
metadata: @config.metadata,
|
488
567
|
retry_policy: @config.retry_policy
|
489
568
|
|
490
569
|
@publisher_stub.call_rpc :get_topic, request, options: options do |response, operation|
|
@@ -531,6 +610,27 @@ module Google
|
|
531
610
|
#
|
532
611
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
533
612
|
#
|
613
|
+
# @example Basic example
|
614
|
+
# require "google/cloud/pubsub/v1"
|
615
|
+
#
|
616
|
+
# # Create a client object. The client can be reused for multiple calls.
|
617
|
+
# client = Google::Cloud::PubSub::V1::Publisher::Client.new
|
618
|
+
#
|
619
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
620
|
+
# request = Google::Cloud::PubSub::V1::ListTopicsRequest.new
|
621
|
+
#
|
622
|
+
# # Call the list_topics method.
|
623
|
+
# result = client.list_topics request
|
624
|
+
#
|
625
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can
|
626
|
+
# # iterate over all elements by calling #each, and the enumerable
|
627
|
+
# # will lazily make API calls to fetch subsequent pages. Other
|
628
|
+
# # methods are also available for managing paging directly.
|
629
|
+
# result.each do |response|
|
630
|
+
# # Each element is of type ::Google::Cloud::PubSub::V1::Topic.
|
631
|
+
# p response
|
632
|
+
# end
|
633
|
+
#
|
534
634
|
def list_topics request, options = nil
|
535
635
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
536
636
|
|
@@ -548,16 +648,20 @@ module Google
|
|
548
648
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
549
649
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
550
650
|
|
551
|
-
header_params = {
|
552
|
-
|
553
|
-
|
651
|
+
header_params = {}
|
652
|
+
if request.project
|
653
|
+
header_params["project"] = request.project
|
654
|
+
end
|
655
|
+
|
554
656
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
555
657
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
556
658
|
|
557
659
|
options.apply_defaults timeout: @config.rpcs.list_topics.timeout,
|
558
660
|
metadata: metadata,
|
559
661
|
retry_policy: @config.rpcs.list_topics.retry_policy
|
560
|
-
|
662
|
+
|
663
|
+
options.apply_defaults timeout: @config.timeout,
|
664
|
+
metadata: @config.metadata,
|
561
665
|
retry_policy: @config.retry_policy
|
562
666
|
|
563
667
|
@publisher_stub.call_rpc :list_topics, request, options: options do |response, operation|
|
@@ -605,6 +709,21 @@ module Google
|
|
605
709
|
#
|
606
710
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
607
711
|
#
|
712
|
+
# @example Basic example
|
713
|
+
# require "google/cloud/pubsub/v1"
|
714
|
+
#
|
715
|
+
# # Create a client object. The client can be reused for multiple calls.
|
716
|
+
# client = Google::Cloud::PubSub::V1::Publisher::Client.new
|
717
|
+
#
|
718
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
719
|
+
# request = Google::Cloud::PubSub::V1::ListTopicSubscriptionsRequest.new
|
720
|
+
#
|
721
|
+
# # Call the list_topic_subscriptions method.
|
722
|
+
# result = client.list_topic_subscriptions request
|
723
|
+
#
|
724
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::ListTopicSubscriptionsResponse.
|
725
|
+
# p result
|
726
|
+
#
|
608
727
|
def list_topic_subscriptions request, options = nil
|
609
728
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
610
729
|
|
@@ -622,16 +741,20 @@ module Google
|
|
622
741
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
623
742
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
624
743
|
|
625
|
-
header_params = {
|
626
|
-
|
627
|
-
|
744
|
+
header_params = {}
|
745
|
+
if request.topic
|
746
|
+
header_params["topic"] = request.topic
|
747
|
+
end
|
748
|
+
|
628
749
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
629
750
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
630
751
|
|
631
752
|
options.apply_defaults timeout: @config.rpcs.list_topic_subscriptions.timeout,
|
632
753
|
metadata: metadata,
|
633
754
|
retry_policy: @config.rpcs.list_topic_subscriptions.retry_policy
|
634
|
-
|
755
|
+
|
756
|
+
options.apply_defaults timeout: @config.timeout,
|
757
|
+
metadata: @config.metadata,
|
635
758
|
retry_policy: @config.retry_policy
|
636
759
|
|
637
760
|
@publisher_stub.call_rpc :list_topic_subscriptions, request, options: options do |response, operation|
|
@@ -682,6 +805,21 @@ module Google
|
|
682
805
|
#
|
683
806
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
684
807
|
#
|
808
|
+
# @example Basic example
|
809
|
+
# require "google/cloud/pubsub/v1"
|
810
|
+
#
|
811
|
+
# # Create a client object. The client can be reused for multiple calls.
|
812
|
+
# client = Google::Cloud::PubSub::V1::Publisher::Client.new
|
813
|
+
#
|
814
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
815
|
+
# request = Google::Cloud::PubSub::V1::ListTopicSnapshotsRequest.new
|
816
|
+
#
|
817
|
+
# # Call the list_topic_snapshots method.
|
818
|
+
# result = client.list_topic_snapshots request
|
819
|
+
#
|
820
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::ListTopicSnapshotsResponse.
|
821
|
+
# p result
|
822
|
+
#
|
685
823
|
def list_topic_snapshots request, options = nil
|
686
824
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
687
825
|
|
@@ -699,16 +837,20 @@ module Google
|
|
699
837
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
700
838
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
701
839
|
|
702
|
-
header_params = {
|
703
|
-
|
704
|
-
|
840
|
+
header_params = {}
|
841
|
+
if request.topic
|
842
|
+
header_params["topic"] = request.topic
|
843
|
+
end
|
844
|
+
|
705
845
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
706
846
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
707
847
|
|
708
848
|
options.apply_defaults timeout: @config.rpcs.list_topic_snapshots.timeout,
|
709
849
|
metadata: metadata,
|
710
850
|
retry_policy: @config.rpcs.list_topic_snapshots.retry_policy
|
711
|
-
|
851
|
+
|
852
|
+
options.apply_defaults timeout: @config.timeout,
|
853
|
+
metadata: @config.metadata,
|
712
854
|
retry_policy: @config.retry_policy
|
713
855
|
|
714
856
|
@publisher_stub.call_rpc :list_topic_snapshots, request, options: options do |response, operation|
|
@@ -753,6 +895,21 @@ module Google
|
|
753
895
|
#
|
754
896
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
755
897
|
#
|
898
|
+
# @example Basic example
|
899
|
+
# require "google/cloud/pubsub/v1"
|
900
|
+
#
|
901
|
+
# # Create a client object. The client can be reused for multiple calls.
|
902
|
+
# client = Google::Cloud::PubSub::V1::Publisher::Client.new
|
903
|
+
#
|
904
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
905
|
+
# request = Google::Cloud::PubSub::V1::DeleteTopicRequest.new
|
906
|
+
#
|
907
|
+
# # Call the delete_topic method.
|
908
|
+
# result = client.delete_topic request
|
909
|
+
#
|
910
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
911
|
+
# p result
|
912
|
+
#
|
756
913
|
def delete_topic request, options = nil
|
757
914
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
758
915
|
|
@@ -770,16 +927,20 @@ module Google
|
|
770
927
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
771
928
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
772
929
|
|
773
|
-
header_params = {
|
774
|
-
|
775
|
-
|
930
|
+
header_params = {}
|
931
|
+
if request.topic
|
932
|
+
header_params["topic"] = request.topic
|
933
|
+
end
|
934
|
+
|
776
935
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
777
936
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
778
937
|
|
779
938
|
options.apply_defaults timeout: @config.rpcs.delete_topic.timeout,
|
780
939
|
metadata: metadata,
|
781
940
|
retry_policy: @config.rpcs.delete_topic.retry_policy
|
782
|
-
|
941
|
+
|
942
|
+
options.apply_defaults timeout: @config.timeout,
|
943
|
+
metadata: @config.metadata,
|
783
944
|
retry_policy: @config.retry_policy
|
784
945
|
|
785
946
|
@publisher_stub.call_rpc :delete_topic, request, options: options do |response, operation|
|
@@ -823,6 +984,21 @@ module Google
|
|
823
984
|
#
|
824
985
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
825
986
|
#
|
987
|
+
# @example Basic example
|
988
|
+
# require "google/cloud/pubsub/v1"
|
989
|
+
#
|
990
|
+
# # Create a client object. The client can be reused for multiple calls.
|
991
|
+
# client = Google::Cloud::PubSub::V1::Publisher::Client.new
|
992
|
+
#
|
993
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
994
|
+
# request = Google::Cloud::PubSub::V1::DetachSubscriptionRequest.new
|
995
|
+
#
|
996
|
+
# # Call the detach_subscription method.
|
997
|
+
# result = client.detach_subscription request
|
998
|
+
#
|
999
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::DetachSubscriptionResponse.
|
1000
|
+
# p result
|
1001
|
+
#
|
826
1002
|
def detach_subscription request, options = nil
|
827
1003
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
828
1004
|
|
@@ -840,16 +1016,20 @@ module Google
|
|
840
1016
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
841
1017
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
842
1018
|
|
843
|
-
header_params = {
|
844
|
-
|
845
|
-
|
1019
|
+
header_params = {}
|
1020
|
+
if request.subscription
|
1021
|
+
header_params["subscription"] = request.subscription
|
1022
|
+
end
|
1023
|
+
|
846
1024
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
847
1025
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
848
1026
|
|
849
1027
|
options.apply_defaults timeout: @config.rpcs.detach_subscription.timeout,
|
850
1028
|
metadata: metadata,
|
851
1029
|
retry_policy: @config.rpcs.detach_subscription.retry_policy
|
852
|
-
|
1030
|
+
|
1031
|
+
options.apply_defaults timeout: @config.timeout,
|
1032
|
+
metadata: @config.metadata,
|
853
1033
|
retry_policy: @config.retry_policy
|
854
1034
|
|
855
1035
|
@publisher_stub.call_rpc :detach_subscription, request, options: options do |response, operation|
|
@@ -873,22 +1053,21 @@ module Google
|
|
873
1053
|
# Configuration can be applied globally to all clients, or to a single client
|
874
1054
|
# on construction.
|
875
1055
|
#
|
876
|
-
#
|
877
|
-
#
|
878
|
-
#
|
879
|
-
# to 20 seconds,
|
880
|
-
#
|
881
|
-
#
|
882
|
-
#
|
883
|
-
#
|
884
|
-
#
|
885
|
-
#
|
886
|
-
#
|
887
|
-
#
|
888
|
-
#
|
889
|
-
#
|
890
|
-
#
|
891
|
-
# end
|
1056
|
+
# @example
|
1057
|
+
#
|
1058
|
+
# # Modify the global config, setting the timeout for
|
1059
|
+
# # create_topic to 20 seconds,
|
1060
|
+
# # and all remaining timeouts to 10 seconds.
|
1061
|
+
# ::Google::Cloud::PubSub::V1::Publisher::Client.configure do |config|
|
1062
|
+
# config.timeout = 10.0
|
1063
|
+
# config.rpcs.create_topic.timeout = 20.0
|
1064
|
+
# end
|
1065
|
+
#
|
1066
|
+
# # Apply the above configuration only to a new client.
|
1067
|
+
# client = ::Google::Cloud::PubSub::V1::Publisher::Client.new do |config|
|
1068
|
+
# config.timeout = 10.0
|
1069
|
+
# config.rpcs.create_topic.timeout = 20.0
|
1070
|
+
# end
|
892
1071
|
#
|
893
1072
|
# @!attribute [rw] endpoint
|
894
1073
|
# The hostname or hostname:port of the service endpoint.
|