google-cloud-pubsub-v1 0.1.2 → 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 +14 -14
- data/LICENSE.md +188 -190
- data/README.md +69 -5
- data/lib/google/cloud/pubsub/v1/iam_policy/client.rb +108 -52
- data/lib/google/cloud/pubsub/v1/publisher/client.rb +284 -121
- data/lib/google/cloud/pubsub/v1/publisher/paths.rb +18 -1
- data/lib/google/cloud/pubsub/v1/schema_service/client.rb +898 -0
- data/lib/google/cloud/pubsub/v1/schema_service/credentials.rb +52 -0
- data/lib/google/cloud/pubsub/v1/schema_service/paths.rb +64 -0
- data/lib/google/cloud/pubsub/v1/schema_service.rb +49 -0
- data/lib/google/cloud/pubsub/v1/subscriber/client.rb +457 -182
- data/lib/google/cloud/pubsub/v1/subscriber/paths.rb +1 -1
- data/lib/google/cloud/pubsub/v1/version.rb +1 -1
- data/lib/google/cloud/pubsub/v1.rb +5 -1
- data/lib/google/pubsub/v1/pubsub_pb.rb +17 -2
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +31 -31
- data/lib/google/pubsub/v1/schema_pb.rb +95 -0
- data/lib/google/pubsub/v1/schema_services_pb.rb +55 -0
- data/proto_docs/google/api/field_behavior.rb +12 -0
- data/proto_docs/google/api/resource.rb +50 -14
- data/proto_docs/google/protobuf/timestamp.rb +10 -1
- data/proto_docs/google/pubsub/v1/pubsub.rb +55 -2
- data/proto_docs/google/pubsub/v1/schema.rb +218 -0
- data/proto_docs/google/type/expr.rb +35 -12
- metadata +28 -14
- 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]
|
@@ -62,137 +61,89 @@ module Google
|
|
62
61
|
parent_config = while namespace.any?
|
63
62
|
parent_name = namespace.join "::"
|
64
63
|
parent_const = const_get parent_name
|
65
|
-
break parent_const.configure if parent_const
|
64
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
66
65
|
namespace.pop
|
67
66
|
end
|
68
67
|
default_config = Client::Configuration.new parent_config
|
69
68
|
|
70
69
|
default_config.rpcs.create_subscription.timeout = 60.0
|
71
70
|
default_config.rpcs.create_subscription.retry_policy = {
|
72
|
-
initial_delay: 0.1,
|
73
|
-
max_delay: 60.0,
|
74
|
-
multiplier: 1.3,
|
75
|
-
retry_codes: [2, 10, 14]
|
71
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
76
72
|
}
|
77
73
|
|
78
74
|
default_config.rpcs.get_subscription.timeout = 60.0
|
79
75
|
default_config.rpcs.get_subscription.retry_policy = {
|
80
|
-
initial_delay: 0.1,
|
81
|
-
max_delay: 60.0,
|
82
|
-
multiplier: 1.3,
|
83
|
-
retry_codes: [2, 10, 14]
|
76
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
84
77
|
}
|
85
78
|
|
86
79
|
default_config.rpcs.update_subscription.timeout = 60.0
|
87
80
|
default_config.rpcs.update_subscription.retry_policy = {
|
88
|
-
initial_delay: 0.1,
|
89
|
-
max_delay: 60.0,
|
90
|
-
multiplier: 1.3,
|
91
|
-
retry_codes: [14]
|
81
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
92
82
|
}
|
93
83
|
|
94
84
|
default_config.rpcs.list_subscriptions.timeout = 60.0
|
95
85
|
default_config.rpcs.list_subscriptions.retry_policy = {
|
96
|
-
initial_delay: 0.1,
|
97
|
-
max_delay: 60.0,
|
98
|
-
multiplier: 1.3,
|
99
|
-
retry_codes: [2, 10, 14]
|
86
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
100
87
|
}
|
101
88
|
|
102
89
|
default_config.rpcs.delete_subscription.timeout = 60.0
|
103
90
|
default_config.rpcs.delete_subscription.retry_policy = {
|
104
|
-
initial_delay: 0.1,
|
105
|
-
max_delay: 60.0,
|
106
|
-
multiplier: 1.3,
|
107
|
-
retry_codes: [14]
|
91
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
108
92
|
}
|
109
93
|
|
110
94
|
default_config.rpcs.modify_ack_deadline.timeout = 60.0
|
111
95
|
default_config.rpcs.modify_ack_deadline.retry_policy = {
|
112
|
-
initial_delay: 0.1,
|
113
|
-
max_delay: 60.0,
|
114
|
-
multiplier: 1.3,
|
115
|
-
retry_codes: [14]
|
96
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
116
97
|
}
|
117
98
|
|
118
99
|
default_config.rpcs.acknowledge.timeout = 60.0
|
119
100
|
default_config.rpcs.acknowledge.retry_policy = {
|
120
|
-
initial_delay: 0.1,
|
121
|
-
max_delay: 60.0,
|
122
|
-
multiplier: 1.3,
|
123
|
-
retry_codes: [14]
|
101
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
124
102
|
}
|
125
103
|
|
126
104
|
default_config.rpcs.pull.timeout = 60.0
|
127
105
|
default_config.rpcs.pull.retry_policy = {
|
128
|
-
initial_delay: 0.1,
|
129
|
-
max_delay: 60.0,
|
130
|
-
multiplier: 1.3,
|
131
|
-
retry_codes: [2, 10, 14]
|
106
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
132
107
|
}
|
133
108
|
|
134
109
|
default_config.rpcs.streaming_pull.timeout = 900.0
|
135
110
|
default_config.rpcs.streaming_pull.retry_policy = {
|
136
|
-
initial_delay: 0.1,
|
137
|
-
max_delay: 60.0,
|
138
|
-
multiplier: 1.3,
|
139
|
-
retry_codes: [4, 8, 10, 13, 14]
|
111
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [4, 8, 10, 13, 14]
|
140
112
|
}
|
141
113
|
|
142
114
|
default_config.rpcs.modify_push_config.timeout = 60.0
|
143
115
|
default_config.rpcs.modify_push_config.retry_policy = {
|
144
|
-
initial_delay: 0.1,
|
145
|
-
max_delay: 60.0,
|
146
|
-
multiplier: 1.3,
|
147
|
-
retry_codes: [14]
|
116
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
148
117
|
}
|
149
118
|
|
150
119
|
default_config.rpcs.get_snapshot.timeout = 60.0
|
151
120
|
default_config.rpcs.get_snapshot.retry_policy = {
|
152
|
-
initial_delay: 0.1,
|
153
|
-
max_delay: 60.0,
|
154
|
-
multiplier: 1.3,
|
155
|
-
retry_codes: [2, 10, 14]
|
121
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
156
122
|
}
|
157
123
|
|
158
124
|
default_config.rpcs.list_snapshots.timeout = 60.0
|
159
125
|
default_config.rpcs.list_snapshots.retry_policy = {
|
160
|
-
initial_delay: 0.1,
|
161
|
-
max_delay: 60.0,
|
162
|
-
multiplier: 1.3,
|
163
|
-
retry_codes: [2, 10, 14]
|
126
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
164
127
|
}
|
165
128
|
|
166
129
|
default_config.rpcs.create_snapshot.timeout = 60.0
|
167
130
|
default_config.rpcs.create_snapshot.retry_policy = {
|
168
|
-
initial_delay: 0.1,
|
169
|
-
max_delay: 60.0,
|
170
|
-
multiplier: 1.3,
|
171
|
-
retry_codes: [14]
|
131
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
172
132
|
}
|
173
133
|
|
174
134
|
default_config.rpcs.update_snapshot.timeout = 60.0
|
175
135
|
default_config.rpcs.update_snapshot.retry_policy = {
|
176
|
-
initial_delay: 0.1,
|
177
|
-
max_delay: 60.0,
|
178
|
-
multiplier: 1.3,
|
179
|
-
retry_codes: [14]
|
136
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
180
137
|
}
|
181
138
|
|
182
139
|
default_config.rpcs.delete_snapshot.timeout = 60.0
|
183
140
|
default_config.rpcs.delete_snapshot.retry_policy = {
|
184
|
-
initial_delay: 0.1,
|
185
|
-
max_delay: 60.0,
|
186
|
-
multiplier: 1.3,
|
187
|
-
retry_codes: [14]
|
141
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
188
142
|
}
|
189
143
|
|
190
144
|
default_config.rpcs.seek.timeout = 60.0
|
191
145
|
default_config.rpcs.seek.retry_policy = {
|
192
|
-
initial_delay: 0.1,
|
193
|
-
max_delay: 60.0,
|
194
|
-
multiplier: 1.3,
|
195
|
-
retry_codes: [2, 10, 14]
|
146
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
196
147
|
}
|
197
148
|
|
198
149
|
default_config
|
@@ -224,19 +175,15 @@ module Google
|
|
224
175
|
##
|
225
176
|
# Create a new Subscriber client object.
|
226
177
|
#
|
227
|
-
#
|
228
|
-
#
|
229
|
-
# To create a new Subscriber client with the default
|
230
|
-
# configuration:
|
231
|
-
#
|
232
|
-
# client = ::Google::Cloud::PubSub::V1::Subscriber::Client.new
|
178
|
+
# @example
|
233
179
|
#
|
234
|
-
#
|
235
|
-
#
|
180
|
+
# # Create a client using the default configuration
|
181
|
+
# client = ::Google::Cloud::PubSub::V1::Subscriber::Client.new
|
236
182
|
#
|
237
|
-
#
|
238
|
-
#
|
239
|
-
#
|
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
|
240
187
|
#
|
241
188
|
# @yield [config] Configure the Subscriber client.
|
242
189
|
# @yieldparam config [Client::Configuration]
|
@@ -256,8 +203,13 @@ module Google
|
|
256
203
|
|
257
204
|
# Create credentials
|
258
205
|
credentials = @config.credentials
|
259
|
-
|
260
|
-
if
|
206
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
207
|
+
# but only if the default endpoint does not have a region prefix.
|
208
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
209
|
+
!@config.endpoint.split(".").first.include?("-")
|
210
|
+
credentials ||= Credentials.default scope: @config.scope,
|
211
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
212
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
261
213
|
credentials = Credentials.new credentials, scope: @config.scope
|
262
214
|
end
|
263
215
|
@quota_project_id = @config.quota_project
|
@@ -342,8 +294,9 @@ module Google
|
|
342
294
|
# Indicates whether to retain acknowledged messages. If true, then
|
343
295
|
# messages are not expunged from the subscription's backlog, even if they are
|
344
296
|
# acknowledged, until they fall out of the `message_retention_duration`
|
345
|
-
# window. This must be true if you would like to [Seek to a timestamp]
|
346
|
-
# (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.
|
347
300
|
# @param message_retention_duration [::Google::Protobuf::Duration, ::Hash]
|
348
301
|
# How long to retain unacknowledged messages in the subscription's backlog,
|
349
302
|
# from the moment a message is published.
|
@@ -404,6 +357,21 @@ module Google
|
|
404
357
|
#
|
405
358
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
406
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
|
+
#
|
407
375
|
def create_subscription request, options = nil
|
408
376
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
409
377
|
|
@@ -421,16 +389,20 @@ module Google
|
|
421
389
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
422
390
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
423
391
|
|
424
|
-
header_params = {
|
425
|
-
|
426
|
-
|
392
|
+
header_params = {}
|
393
|
+
if request.name
|
394
|
+
header_params["name"] = request.name
|
395
|
+
end
|
396
|
+
|
427
397
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
428
398
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
429
399
|
|
430
400
|
options.apply_defaults timeout: @config.rpcs.create_subscription.timeout,
|
431
401
|
metadata: metadata,
|
432
402
|
retry_policy: @config.rpcs.create_subscription.retry_policy
|
433
|
-
|
403
|
+
|
404
|
+
options.apply_defaults timeout: @config.timeout,
|
405
|
+
metadata: @config.metadata,
|
434
406
|
retry_policy: @config.retry_policy
|
435
407
|
|
436
408
|
@subscriber_stub.call_rpc :create_subscription, request, options: options do |response, operation|
|
@@ -471,6 +443,21 @@ module Google
|
|
471
443
|
#
|
472
444
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
473
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
|
+
#
|
474
461
|
def get_subscription request, options = nil
|
475
462
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
476
463
|
|
@@ -488,16 +475,20 @@ module Google
|
|
488
475
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
489
476
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
490
477
|
|
491
|
-
header_params = {
|
492
|
-
|
493
|
-
|
478
|
+
header_params = {}
|
479
|
+
if request.subscription
|
480
|
+
header_params["subscription"] = request.subscription
|
481
|
+
end
|
482
|
+
|
494
483
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
495
484
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
496
485
|
|
497
486
|
options.apply_defaults timeout: @config.rpcs.get_subscription.timeout,
|
498
487
|
metadata: metadata,
|
499
488
|
retry_policy: @config.rpcs.get_subscription.retry_policy
|
500
|
-
|
489
|
+
|
490
|
+
options.apply_defaults timeout: @config.timeout,
|
491
|
+
metadata: @config.metadata,
|
501
492
|
retry_policy: @config.retry_policy
|
502
493
|
|
503
494
|
@subscriber_stub.call_rpc :get_subscription, request, options: options do |response, operation|
|
@@ -541,6 +532,21 @@ module Google
|
|
541
532
|
#
|
542
533
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
543
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
|
+
#
|
544
550
|
def update_subscription request, options = nil
|
545
551
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
546
552
|
|
@@ -558,16 +564,20 @@ module Google
|
|
558
564
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
559
565
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
560
566
|
|
561
|
-
header_params = {
|
562
|
-
|
563
|
-
|
567
|
+
header_params = {}
|
568
|
+
if request.subscription&.name
|
569
|
+
header_params["subscription.name"] = request.subscription.name
|
570
|
+
end
|
571
|
+
|
564
572
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
565
573
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
566
574
|
|
567
575
|
options.apply_defaults timeout: @config.rpcs.update_subscription.timeout,
|
568
576
|
metadata: metadata,
|
569
577
|
retry_policy: @config.rpcs.update_subscription.retry_policy
|
570
|
-
|
578
|
+
|
579
|
+
options.apply_defaults timeout: @config.timeout,
|
580
|
+
metadata: @config.metadata,
|
571
581
|
retry_policy: @config.retry_policy
|
572
582
|
|
573
583
|
@subscriber_stub.call_rpc :update_subscription, request, options: options do |response, operation|
|
@@ -614,6 +624,27 @@ module Google
|
|
614
624
|
#
|
615
625
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
616
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
|
+
#
|
617
648
|
def list_subscriptions request, options = nil
|
618
649
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
619
650
|
|
@@ -631,16 +662,20 @@ module Google
|
|
631
662
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
632
663
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
633
664
|
|
634
|
-
header_params = {
|
635
|
-
|
636
|
-
|
665
|
+
header_params = {}
|
666
|
+
if request.project
|
667
|
+
header_params["project"] = request.project
|
668
|
+
end
|
669
|
+
|
637
670
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
638
671
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
639
672
|
|
640
673
|
options.apply_defaults timeout: @config.rpcs.list_subscriptions.timeout,
|
641
674
|
metadata: metadata,
|
642
675
|
retry_policy: @config.rpcs.list_subscriptions.retry_policy
|
643
|
-
|
676
|
+
|
677
|
+
options.apply_defaults timeout: @config.timeout,
|
678
|
+
metadata: @config.metadata,
|
644
679
|
retry_policy: @config.retry_policy
|
645
680
|
|
646
681
|
@subscriber_stub.call_rpc :list_subscriptions, request, options: options do |response, operation|
|
@@ -686,6 +721,21 @@ module Google
|
|
686
721
|
#
|
687
722
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
688
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
|
+
#
|
689
739
|
def delete_subscription request, options = nil
|
690
740
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
691
741
|
|
@@ -703,16 +753,20 @@ module Google
|
|
703
753
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
704
754
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
705
755
|
|
706
|
-
header_params = {
|
707
|
-
|
708
|
-
|
756
|
+
header_params = {}
|
757
|
+
if request.subscription
|
758
|
+
header_params["subscription"] = request.subscription
|
759
|
+
end
|
760
|
+
|
709
761
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
710
762
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
711
763
|
|
712
764
|
options.apply_defaults timeout: @config.rpcs.delete_subscription.timeout,
|
713
765
|
metadata: metadata,
|
714
766
|
retry_policy: @config.rpcs.delete_subscription.retry_policy
|
715
|
-
|
767
|
+
|
768
|
+
options.apply_defaults timeout: @config.timeout,
|
769
|
+
metadata: @config.metadata,
|
716
770
|
retry_policy: @config.retry_policy
|
717
771
|
|
718
772
|
@subscriber_stub.call_rpc :delete_subscription, request, options: options do |response, operation|
|
@@ -768,6 +822,21 @@ module Google
|
|
768
822
|
#
|
769
823
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
770
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
|
+
#
|
771
840
|
def modify_ack_deadline request, options = nil
|
772
841
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
773
842
|
|
@@ -785,16 +854,20 @@ module Google
|
|
785
854
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
786
855
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
787
856
|
|
788
|
-
header_params = {
|
789
|
-
|
790
|
-
|
857
|
+
header_params = {}
|
858
|
+
if request.subscription
|
859
|
+
header_params["subscription"] = request.subscription
|
860
|
+
end
|
861
|
+
|
791
862
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
792
863
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
793
864
|
|
794
865
|
options.apply_defaults timeout: @config.rpcs.modify_ack_deadline.timeout,
|
795
866
|
metadata: metadata,
|
796
867
|
retry_policy: @config.rpcs.modify_ack_deadline.retry_policy
|
797
|
-
|
868
|
+
|
869
|
+
options.apply_defaults timeout: @config.timeout,
|
870
|
+
metadata: @config.metadata,
|
798
871
|
retry_policy: @config.retry_policy
|
799
872
|
|
800
873
|
@subscriber_stub.call_rpc :modify_ack_deadline, request, options: options do |response, operation|
|
@@ -845,6 +918,21 @@ module Google
|
|
845
918
|
#
|
846
919
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
847
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
|
+
#
|
848
936
|
def acknowledge request, options = nil
|
849
937
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
850
938
|
|
@@ -862,16 +950,20 @@ module Google
|
|
862
950
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
863
951
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
864
952
|
|
865
|
-
header_params = {
|
866
|
-
|
867
|
-
|
953
|
+
header_params = {}
|
954
|
+
if request.subscription
|
955
|
+
header_params["subscription"] = request.subscription
|
956
|
+
end
|
957
|
+
|
868
958
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
869
959
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
870
960
|
|
871
961
|
options.apply_defaults timeout: @config.rpcs.acknowledge.timeout,
|
872
962
|
metadata: metadata,
|
873
963
|
retry_policy: @config.rpcs.acknowledge.retry_policy
|
874
|
-
|
964
|
+
|
965
|
+
options.apply_defaults timeout: @config.timeout,
|
966
|
+
metadata: @config.metadata,
|
875
967
|
retry_policy: @config.retry_policy
|
876
968
|
|
877
969
|
@subscriber_stub.call_rpc :acknowledge, request, options: options do |response, operation|
|
@@ -926,6 +1018,21 @@ module Google
|
|
926
1018
|
#
|
927
1019
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
928
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
|
+
#
|
929
1036
|
def pull request, options = nil
|
930
1037
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
931
1038
|
|
@@ -943,16 +1050,20 @@ module Google
|
|
943
1050
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
944
1051
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
945
1052
|
|
946
|
-
header_params = {
|
947
|
-
|
948
|
-
|
1053
|
+
header_params = {}
|
1054
|
+
if request.subscription
|
1055
|
+
header_params["subscription"] = request.subscription
|
1056
|
+
end
|
1057
|
+
|
949
1058
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
950
1059
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
951
1060
|
|
952
1061
|
options.apply_defaults timeout: @config.rpcs.pull.timeout,
|
953
1062
|
metadata: metadata,
|
954
1063
|
retry_policy: @config.rpcs.pull.retry_policy
|
955
|
-
|
1064
|
+
|
1065
|
+
options.apply_defaults timeout: @config.timeout,
|
1066
|
+
metadata: @config.metadata,
|
956
1067
|
retry_policy: @config.retry_policy
|
957
1068
|
|
958
1069
|
@subscriber_stub.call_rpc :pull, request, options: options do |response, operation|
|
@@ -985,6 +1096,30 @@ module Google
|
|
985
1096
|
#
|
986
1097
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
987
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
|
+
#
|
988
1123
|
def streaming_pull request, options = nil
|
989
1124
|
unless request.is_a? ::Enumerable
|
990
1125
|
raise ::ArgumentError, "request must be an Enumerable" unless request.respond_to? :to_enum
|
@@ -1010,7 +1145,9 @@ module Google
|
|
1010
1145
|
options.apply_defaults timeout: @config.rpcs.streaming_pull.timeout,
|
1011
1146
|
metadata: metadata,
|
1012
1147
|
retry_policy: @config.rpcs.streaming_pull.retry_policy
|
1013
|
-
|
1148
|
+
|
1149
|
+
options.apply_defaults timeout: @config.timeout,
|
1150
|
+
metadata: @config.metadata,
|
1014
1151
|
retry_policy: @config.retry_policy
|
1015
1152
|
|
1016
1153
|
@subscriber_stub.call_rpc :streaming_pull, request, options: options do |response, operation|
|
@@ -1063,6 +1200,21 @@ module Google
|
|
1063
1200
|
#
|
1064
1201
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1065
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
|
+
#
|
1066
1218
|
def modify_push_config request, options = nil
|
1067
1219
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1068
1220
|
|
@@ -1080,16 +1232,20 @@ module Google
|
|
1080
1232
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1081
1233
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1082
1234
|
|
1083
|
-
header_params = {
|
1084
|
-
|
1085
|
-
|
1235
|
+
header_params = {}
|
1236
|
+
if request.subscription
|
1237
|
+
header_params["subscription"] = request.subscription
|
1238
|
+
end
|
1239
|
+
|
1086
1240
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1087
1241
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1088
1242
|
|
1089
1243
|
options.apply_defaults timeout: @config.rpcs.modify_push_config.timeout,
|
1090
1244
|
metadata: metadata,
|
1091
1245
|
retry_policy: @config.rpcs.modify_push_config.retry_policy
|
1092
|
-
|
1246
|
+
|
1247
|
+
options.apply_defaults timeout: @config.timeout,
|
1248
|
+
metadata: @config.metadata,
|
1093
1249
|
retry_policy: @config.retry_policy
|
1094
1250
|
|
1095
1251
|
@subscriber_stub.call_rpc :modify_push_config, request, options: options do |response, operation|
|
@@ -1134,6 +1290,21 @@ module Google
|
|
1134
1290
|
#
|
1135
1291
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1136
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
|
+
#
|
1137
1308
|
def get_snapshot request, options = nil
|
1138
1309
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1139
1310
|
|
@@ -1151,16 +1322,20 @@ module Google
|
|
1151
1322
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1152
1323
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1153
1324
|
|
1154
|
-
header_params = {
|
1155
|
-
|
1156
|
-
|
1325
|
+
header_params = {}
|
1326
|
+
if request.snapshot
|
1327
|
+
header_params["snapshot"] = request.snapshot
|
1328
|
+
end
|
1329
|
+
|
1157
1330
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1158
1331
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1159
1332
|
|
1160
1333
|
options.apply_defaults timeout: @config.rpcs.get_snapshot.timeout,
|
1161
1334
|
metadata: metadata,
|
1162
1335
|
retry_policy: @config.rpcs.get_snapshot.retry_policy
|
1163
|
-
|
1336
|
+
|
1337
|
+
options.apply_defaults timeout: @config.timeout,
|
1338
|
+
metadata: @config.metadata,
|
1164
1339
|
retry_policy: @config.retry_policy
|
1165
1340
|
|
1166
1341
|
@subscriber_stub.call_rpc :get_snapshot, request, options: options do |response, operation|
|
@@ -1211,6 +1386,27 @@ module Google
|
|
1211
1386
|
#
|
1212
1387
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1213
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
|
+
#
|
1214
1410
|
def list_snapshots request, options = nil
|
1215
1411
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1216
1412
|
|
@@ -1228,16 +1424,20 @@ module Google
|
|
1228
1424
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1229
1425
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1230
1426
|
|
1231
|
-
header_params = {
|
1232
|
-
|
1233
|
-
|
1427
|
+
header_params = {}
|
1428
|
+
if request.project
|
1429
|
+
header_params["project"] = request.project
|
1430
|
+
end
|
1431
|
+
|
1234
1432
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1235
1433
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1236
1434
|
|
1237
1435
|
options.apply_defaults timeout: @config.rpcs.list_snapshots.timeout,
|
1238
1436
|
metadata: metadata,
|
1239
1437
|
retry_policy: @config.rpcs.list_snapshots.retry_policy
|
1240
|
-
|
1438
|
+
|
1439
|
+
options.apply_defaults timeout: @config.timeout,
|
1440
|
+
metadata: @config.metadata,
|
1241
1441
|
retry_policy: @config.retry_policy
|
1242
1442
|
|
1243
1443
|
@subscriber_stub.call_rpc :list_snapshots, request, options: options do |response, operation|
|
@@ -1311,6 +1511,21 @@ module Google
|
|
1311
1511
|
#
|
1312
1512
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1313
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
|
+
#
|
1314
1529
|
def create_snapshot request, options = nil
|
1315
1530
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1316
1531
|
|
@@ -1328,16 +1543,20 @@ module Google
|
|
1328
1543
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1329
1544
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1330
1545
|
|
1331
|
-
header_params = {
|
1332
|
-
|
1333
|
-
|
1546
|
+
header_params = {}
|
1547
|
+
if request.name
|
1548
|
+
header_params["name"] = request.name
|
1549
|
+
end
|
1550
|
+
|
1334
1551
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1335
1552
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1336
1553
|
|
1337
1554
|
options.apply_defaults timeout: @config.rpcs.create_snapshot.timeout,
|
1338
1555
|
metadata: metadata,
|
1339
1556
|
retry_policy: @config.rpcs.create_snapshot.retry_policy
|
1340
|
-
|
1557
|
+
|
1558
|
+
options.apply_defaults timeout: @config.timeout,
|
1559
|
+
metadata: @config.metadata,
|
1341
1560
|
retry_policy: @config.retry_policy
|
1342
1561
|
|
1343
1562
|
@subscriber_stub.call_rpc :create_snapshot, request, options: options do |response, operation|
|
@@ -1385,6 +1604,21 @@ module Google
|
|
1385
1604
|
#
|
1386
1605
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1387
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
|
+
#
|
1388
1622
|
def update_snapshot request, options = nil
|
1389
1623
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1390
1624
|
|
@@ -1402,16 +1636,20 @@ module Google
|
|
1402
1636
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1403
1637
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1404
1638
|
|
1405
|
-
header_params = {
|
1406
|
-
|
1407
|
-
|
1639
|
+
header_params = {}
|
1640
|
+
if request.snapshot&.name
|
1641
|
+
header_params["snapshot.name"] = request.snapshot.name
|
1642
|
+
end
|
1643
|
+
|
1408
1644
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1409
1645
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1410
1646
|
|
1411
1647
|
options.apply_defaults timeout: @config.rpcs.update_snapshot.timeout,
|
1412
1648
|
metadata: metadata,
|
1413
1649
|
retry_policy: @config.rpcs.update_snapshot.retry_policy
|
1414
|
-
|
1650
|
+
|
1651
|
+
options.apply_defaults timeout: @config.timeout,
|
1652
|
+
metadata: @config.metadata,
|
1415
1653
|
retry_policy: @config.retry_policy
|
1416
1654
|
|
1417
1655
|
@subscriber_stub.call_rpc :update_snapshot, request, options: options do |response, operation|
|
@@ -1460,6 +1698,21 @@ module Google
|
|
1460
1698
|
#
|
1461
1699
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1462
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
|
+
#
|
1463
1716
|
def delete_snapshot request, options = nil
|
1464
1717
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1465
1718
|
|
@@ -1477,16 +1730,20 @@ module Google
|
|
1477
1730
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1478
1731
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1479
1732
|
|
1480
|
-
header_params = {
|
1481
|
-
|
1482
|
-
|
1733
|
+
header_params = {}
|
1734
|
+
if request.snapshot
|
1735
|
+
header_params["snapshot"] = request.snapshot
|
1736
|
+
end
|
1737
|
+
|
1483
1738
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1484
1739
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1485
1740
|
|
1486
1741
|
options.apply_defaults timeout: @config.rpcs.delete_snapshot.timeout,
|
1487
1742
|
metadata: metadata,
|
1488
1743
|
retry_policy: @config.rpcs.delete_snapshot.retry_policy
|
1489
|
-
|
1744
|
+
|
1745
|
+
options.apply_defaults timeout: @config.timeout,
|
1746
|
+
metadata: @config.metadata,
|
1490
1747
|
retry_policy: @config.retry_policy
|
1491
1748
|
|
1492
1749
|
@subscriber_stub.call_rpc :delete_snapshot, request, options: options do |response, operation|
|
@@ -1499,8 +1756,8 @@ module Google
|
|
1499
1756
|
|
1500
1757
|
##
|
1501
1758
|
# Seeks an existing subscription to a point in time or to a given snapshot,
|
1502
|
-
# whichever is provided in the request. Snapshots are used in [Seek]
|
1503
|
-
# https://cloud.google.com/pubsub/docs/replay-overview) operations, which
|
1759
|
+
# whichever is provided in the request. Snapshots are used in [Seek]
|
1760
|
+
# (https://cloud.google.com/pubsub/docs/replay-overview) operations, which
|
1504
1761
|
# allow you to manage message acknowledgments in bulk. That is, you can set
|
1505
1762
|
# the acknowledgment state of messages in an existing subscription to the
|
1506
1763
|
# state captured by a snapshot. Note that both the subscription and the
|
@@ -1548,6 +1805,21 @@ module Google
|
|
1548
1805
|
#
|
1549
1806
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
1550
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
|
+
#
|
1551
1823
|
def seek request, options = nil
|
1552
1824
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
1553
1825
|
|
@@ -1565,16 +1837,20 @@ module Google
|
|
1565
1837
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
1566
1838
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
1567
1839
|
|
1568
|
-
header_params = {
|
1569
|
-
|
1570
|
-
|
1840
|
+
header_params = {}
|
1841
|
+
if request.subscription
|
1842
|
+
header_params["subscription"] = request.subscription
|
1843
|
+
end
|
1844
|
+
|
1571
1845
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
1572
1846
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
1573
1847
|
|
1574
1848
|
options.apply_defaults timeout: @config.rpcs.seek.timeout,
|
1575
1849
|
metadata: metadata,
|
1576
1850
|
retry_policy: @config.rpcs.seek.retry_policy
|
1577
|
-
|
1851
|
+
|
1852
|
+
options.apply_defaults timeout: @config.timeout,
|
1853
|
+
metadata: @config.metadata,
|
1578
1854
|
retry_policy: @config.retry_policy
|
1579
1855
|
|
1580
1856
|
@subscriber_stub.call_rpc :seek, request, options: options do |response, operation|
|
@@ -1598,22 +1874,21 @@ module Google
|
|
1598
1874
|
# Configuration can be applied globally to all clients, or to a single client
|
1599
1875
|
# on construction.
|
1600
1876
|
#
|
1601
|
-
#
|
1602
|
-
#
|
1603
|
-
# To modify the global config, setting the timeout for create_subscription
|
1604
|
-
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
1605
|
-
#
|
1606
|
-
# ::Google::Cloud::PubSub::V1::Subscriber::Client.configure do |config|
|
1607
|
-
# config.timeout = 10.0
|
1608
|
-
# config.rpcs.create_subscription.timeout = 20.0
|
1609
|
-
# end
|
1877
|
+
# @example
|
1610
1878
|
#
|
1611
|
-
#
|
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
|
1612
1886
|
#
|
1613
|
-
#
|
1614
|
-
#
|
1615
|
-
#
|
1616
|
-
#
|
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
|
1617
1892
|
#
|
1618
1893
|
# @!attribute [rw] endpoint
|
1619
1894
|
# The hostname or hostname:port of the service endpoint.
|
@@ -1677,7 +1952,7 @@ module Google
|
|
1677
1952
|
config_attr :scope, nil, ::String, ::Array, nil
|
1678
1953
|
config_attr :lib_name, nil, ::String, nil
|
1679
1954
|
config_attr :lib_version, nil, ::String, nil
|
1680
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
1955
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
1681
1956
|
config_attr :interceptors, nil, ::Array, nil
|
1682
1957
|
config_attr :timeout, nil, ::Numeric, nil
|
1683
1958
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -1698,7 +1973,7 @@ module Google
|
|
1698
1973
|
def rpcs
|
1699
1974
|
@rpcs ||= begin
|
1700
1975
|
parent_rpcs = nil
|
1701
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
1976
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
1702
1977
|
Rpcs.new parent_rpcs
|
1703
1978
|
end
|
1704
1979
|
end
|
@@ -1710,7 +1985,7 @@ module Google
|
|
1710
1985
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1711
1986
|
# the following configuration fields:
|
1712
1987
|
#
|
1713
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
1988
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1714
1989
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1715
1990
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1716
1991
|
# include the following keys:
|
@@ -1804,37 +2079,37 @@ module Google
|
|
1804
2079
|
|
1805
2080
|
# @private
|
1806
2081
|
def initialize parent_rpcs = nil
|
1807
|
-
create_subscription_config = parent_rpcs
|
2082
|
+
create_subscription_config = parent_rpcs.create_subscription if parent_rpcs.respond_to? :create_subscription
|
1808
2083
|
@create_subscription = ::Gapic::Config::Method.new create_subscription_config
|
1809
|
-
get_subscription_config = parent_rpcs
|
2084
|
+
get_subscription_config = parent_rpcs.get_subscription if parent_rpcs.respond_to? :get_subscription
|
1810
2085
|
@get_subscription = ::Gapic::Config::Method.new get_subscription_config
|
1811
|
-
update_subscription_config = parent_rpcs
|
2086
|
+
update_subscription_config = parent_rpcs.update_subscription if parent_rpcs.respond_to? :update_subscription
|
1812
2087
|
@update_subscription = ::Gapic::Config::Method.new update_subscription_config
|
1813
|
-
list_subscriptions_config = parent_rpcs
|
2088
|
+
list_subscriptions_config = parent_rpcs.list_subscriptions if parent_rpcs.respond_to? :list_subscriptions
|
1814
2089
|
@list_subscriptions = ::Gapic::Config::Method.new list_subscriptions_config
|
1815
|
-
delete_subscription_config = parent_rpcs
|
2090
|
+
delete_subscription_config = parent_rpcs.delete_subscription if parent_rpcs.respond_to? :delete_subscription
|
1816
2091
|
@delete_subscription = ::Gapic::Config::Method.new delete_subscription_config
|
1817
|
-
modify_ack_deadline_config = parent_rpcs
|
2092
|
+
modify_ack_deadline_config = parent_rpcs.modify_ack_deadline if parent_rpcs.respond_to? :modify_ack_deadline
|
1818
2093
|
@modify_ack_deadline = ::Gapic::Config::Method.new modify_ack_deadline_config
|
1819
|
-
acknowledge_config = parent_rpcs
|
2094
|
+
acknowledge_config = parent_rpcs.acknowledge if parent_rpcs.respond_to? :acknowledge
|
1820
2095
|
@acknowledge = ::Gapic::Config::Method.new acknowledge_config
|
1821
|
-
pull_config = parent_rpcs
|
2096
|
+
pull_config = parent_rpcs.pull if parent_rpcs.respond_to? :pull
|
1822
2097
|
@pull = ::Gapic::Config::Method.new pull_config
|
1823
|
-
streaming_pull_config = parent_rpcs
|
2098
|
+
streaming_pull_config = parent_rpcs.streaming_pull if parent_rpcs.respond_to? :streaming_pull
|
1824
2099
|
@streaming_pull = ::Gapic::Config::Method.new streaming_pull_config
|
1825
|
-
modify_push_config_config = parent_rpcs
|
2100
|
+
modify_push_config_config = parent_rpcs.modify_push_config if parent_rpcs.respond_to? :modify_push_config
|
1826
2101
|
@modify_push_config = ::Gapic::Config::Method.new modify_push_config_config
|
1827
|
-
get_snapshot_config = parent_rpcs
|
2102
|
+
get_snapshot_config = parent_rpcs.get_snapshot if parent_rpcs.respond_to? :get_snapshot
|
1828
2103
|
@get_snapshot = ::Gapic::Config::Method.new get_snapshot_config
|
1829
|
-
list_snapshots_config = parent_rpcs
|
2104
|
+
list_snapshots_config = parent_rpcs.list_snapshots if parent_rpcs.respond_to? :list_snapshots
|
1830
2105
|
@list_snapshots = ::Gapic::Config::Method.new list_snapshots_config
|
1831
|
-
create_snapshot_config = parent_rpcs
|
2106
|
+
create_snapshot_config = parent_rpcs.create_snapshot if parent_rpcs.respond_to? :create_snapshot
|
1832
2107
|
@create_snapshot = ::Gapic::Config::Method.new create_snapshot_config
|
1833
|
-
update_snapshot_config = parent_rpcs
|
2108
|
+
update_snapshot_config = parent_rpcs.update_snapshot if parent_rpcs.respond_to? :update_snapshot
|
1834
2109
|
@update_snapshot = ::Gapic::Config::Method.new update_snapshot_config
|
1835
|
-
delete_snapshot_config = parent_rpcs
|
2110
|
+
delete_snapshot_config = parent_rpcs.delete_snapshot if parent_rpcs.respond_to? :delete_snapshot
|
1836
2111
|
@delete_snapshot = ::Gapic::Config::Method.new delete_snapshot_config
|
1837
|
-
seek_config = parent_rpcs
|
2112
|
+
seek_config = parent_rpcs.seek if parent_rpcs.respond_to? :seek
|
1838
2113
|
@seek = ::Gapic::Config::Method.new seek_config
|
1839
2114
|
|
1840
2115
|
yield self if block_given?
|