google-cloud-pubsub-v1 0.1.2 → 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 +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
@@ -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]
|
@@ -61,81 +60,54 @@ module Google
|
|
61
60
|
parent_config = while namespace.any?
|
62
61
|
parent_name = namespace.join "::"
|
63
62
|
parent_const = const_get parent_name
|
64
|
-
break parent_const.configure if parent_const
|
63
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
65
64
|
namespace.pop
|
66
65
|
end
|
67
66
|
default_config = Client::Configuration.new parent_config
|
68
67
|
|
69
68
|
default_config.rpcs.create_topic.timeout = 60.0
|
70
69
|
default_config.rpcs.create_topic.retry_policy = {
|
71
|
-
initial_delay: 0.1,
|
72
|
-
max_delay: 60.0,
|
73
|
-
multiplier: 1.3,
|
74
|
-
retry_codes: [14]
|
70
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
75
71
|
}
|
76
72
|
|
77
73
|
default_config.rpcs.update_topic.timeout = 60.0
|
78
74
|
default_config.rpcs.update_topic.retry_policy = {
|
79
|
-
initial_delay: 0.1,
|
80
|
-
max_delay: 60.0,
|
81
|
-
multiplier: 1.3,
|
82
|
-
retry_codes: [14]
|
75
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
83
76
|
}
|
84
77
|
|
85
78
|
default_config.rpcs.publish.timeout = 60.0
|
86
79
|
default_config.rpcs.publish.retry_policy = {
|
87
|
-
initial_delay: 0.1,
|
88
|
-
max_delay: 60.0,
|
89
|
-
multiplier: 1.3,
|
90
|
-
retry_codes: [10, 1, 13, 8, 2, 14, 4]
|
80
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [10, 1, 13, 8, 2, 14, 4]
|
91
81
|
}
|
92
82
|
|
93
83
|
default_config.rpcs.get_topic.timeout = 60.0
|
94
84
|
default_config.rpcs.get_topic.retry_policy = {
|
95
|
-
initial_delay: 0.1,
|
96
|
-
max_delay: 60.0,
|
97
|
-
multiplier: 1.3,
|
98
|
-
retry_codes: [2, 10, 14]
|
85
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
99
86
|
}
|
100
87
|
|
101
88
|
default_config.rpcs.list_topics.timeout = 60.0
|
102
89
|
default_config.rpcs.list_topics.retry_policy = {
|
103
|
-
initial_delay: 0.1,
|
104
|
-
max_delay: 60.0,
|
105
|
-
multiplier: 1.3,
|
106
|
-
retry_codes: [2, 10, 14]
|
90
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
107
91
|
}
|
108
92
|
|
109
93
|
default_config.rpcs.list_topic_subscriptions.timeout = 60.0
|
110
94
|
default_config.rpcs.list_topic_subscriptions.retry_policy = {
|
111
|
-
initial_delay: 0.1,
|
112
|
-
max_delay: 60.0,
|
113
|
-
multiplier: 1.3,
|
114
|
-
retry_codes: [2, 10, 14]
|
95
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
115
96
|
}
|
116
97
|
|
117
98
|
default_config.rpcs.list_topic_snapshots.timeout = 60.0
|
118
99
|
default_config.rpcs.list_topic_snapshots.retry_policy = {
|
119
|
-
initial_delay: 0.1,
|
120
|
-
max_delay: 60.0,
|
121
|
-
multiplier: 1.3,
|
122
|
-
retry_codes: [2, 10, 14]
|
100
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
|
123
101
|
}
|
124
102
|
|
125
103
|
default_config.rpcs.delete_topic.timeout = 60.0
|
126
104
|
default_config.rpcs.delete_topic.retry_policy = {
|
127
|
-
initial_delay: 0.1,
|
128
|
-
max_delay: 60.0,
|
129
|
-
multiplier: 1.3,
|
130
|
-
retry_codes: [14]
|
105
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
131
106
|
}
|
132
107
|
|
133
108
|
default_config.rpcs.detach_subscription.timeout = 60.0
|
134
109
|
default_config.rpcs.detach_subscription.retry_policy = {
|
135
|
-
initial_delay: 0.1,
|
136
|
-
max_delay: 60.0,
|
137
|
-
multiplier: 1.3,
|
138
|
-
retry_codes: [14]
|
110
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
139
111
|
}
|
140
112
|
|
141
113
|
default_config
|
@@ -167,19 +139,15 @@ module Google
|
|
167
139
|
##
|
168
140
|
# Create a new Publisher client object.
|
169
141
|
#
|
170
|
-
#
|
171
|
-
#
|
172
|
-
# To create a new Publisher client with the default
|
173
|
-
# configuration:
|
174
|
-
#
|
175
|
-
# client = ::Google::Cloud::PubSub::V1::Publisher::Client.new
|
142
|
+
# @example
|
176
143
|
#
|
177
|
-
#
|
178
|
-
#
|
144
|
+
# # Create a client using the default configuration
|
145
|
+
# client = ::Google::Cloud::PubSub::V1::Publisher::Client.new
|
179
146
|
#
|
180
|
-
#
|
181
|
-
#
|
182
|
-
#
|
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
|
183
151
|
#
|
184
152
|
# @yield [config] Configure the Publisher client.
|
185
153
|
# @yieldparam config [Client::Configuration]
|
@@ -199,8 +167,13 @@ module Google
|
|
199
167
|
|
200
168
|
# Create credentials
|
201
169
|
credentials = @config.credentials
|
202
|
-
|
203
|
-
if
|
170
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
171
|
+
# but only if the default endpoint does not have a region prefix.
|
172
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
173
|
+
!@config.endpoint.split(".").first.include?("-")
|
174
|
+
credentials ||= Credentials.default scope: @config.scope,
|
175
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
176
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
204
177
|
credentials = Credentials.new credentials, scope: @config.scope
|
205
178
|
end
|
206
179
|
@quota_project_id = @config.quota_project
|
@@ -218,8 +191,8 @@ module Google
|
|
218
191
|
# Service calls
|
219
192
|
|
220
193
|
##
|
221
|
-
# Creates the given topic with the given name. See the [resource name rules]
|
222
|
-
# https://cloud.google.com/pubsub/docs/admin#resource_names).
|
194
|
+
# Creates the given topic with the given name. See the [resource name rules]
|
195
|
+
# (https://cloud.google.com/pubsub/docs/admin#resource_names).
|
223
196
|
#
|
224
197
|
# @overload create_topic(request, options = nil)
|
225
198
|
# Pass arguments to `create_topic` via a request object, either of type
|
@@ -231,7 +204,7 @@ module Google
|
|
231
204
|
# @param options [::Gapic::CallOptions, ::Hash]
|
232
205
|
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
233
206
|
#
|
234
|
-
# @overload create_topic(name: nil, labels: nil, message_storage_policy: nil, kms_key_name: 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)
|
235
208
|
# Pass arguments to `create_topic` via keyword arguments. Note that at
|
236
209
|
# least one keyword argument is required. To specify no parameters, or to keep all
|
237
210
|
# the default parameter values, pass an empty Hash as a request object (see above).
|
@@ -255,6 +228,20 @@ module Google
|
|
255
228
|
# to messages published on this topic.
|
256
229
|
#
|
257
230
|
# The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
|
231
|
+
# @param schema_settings [::Google::Cloud::PubSub::V1::SchemaSettings, ::Hash]
|
232
|
+
# Settings for validating messages published against a schema.
|
233
|
+
# @param satisfies_pzs [::Boolean]
|
234
|
+
# Reserved for future use. This field is set only in responses from the
|
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.
|
258
245
|
#
|
259
246
|
# @yield [response, operation] Access the result along with the RPC operation
|
260
247
|
# @yieldparam response [::Google::Cloud::PubSub::V1::Topic]
|
@@ -264,6 +251,21 @@ module Google
|
|
264
251
|
#
|
265
252
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
266
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
|
+
#
|
267
269
|
def create_topic request, options = nil
|
268
270
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
269
271
|
|
@@ -281,16 +283,20 @@ module Google
|
|
281
283
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
282
284
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
283
285
|
|
284
|
-
header_params = {
|
285
|
-
|
286
|
-
|
286
|
+
header_params = {}
|
287
|
+
if request.name
|
288
|
+
header_params["name"] = request.name
|
289
|
+
end
|
290
|
+
|
287
291
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
288
292
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
289
293
|
|
290
294
|
options.apply_defaults timeout: @config.rpcs.create_topic.timeout,
|
291
295
|
metadata: metadata,
|
292
296
|
retry_policy: @config.rpcs.create_topic.retry_policy
|
293
|
-
|
297
|
+
|
298
|
+
options.apply_defaults timeout: @config.timeout,
|
299
|
+
metadata: @config.metadata,
|
294
300
|
retry_policy: @config.retry_policy
|
295
301
|
|
296
302
|
@publisher_stub.call_rpc :create_topic, request, options: options do |response, operation|
|
@@ -337,6 +343,21 @@ module Google
|
|
337
343
|
#
|
338
344
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
339
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
|
+
#
|
340
361
|
def update_topic request, options = nil
|
341
362
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
342
363
|
|
@@ -354,16 +375,20 @@ module Google
|
|
354
375
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
355
376
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
356
377
|
|
357
|
-
header_params = {
|
358
|
-
|
359
|
-
|
378
|
+
header_params = {}
|
379
|
+
if request.topic&.name
|
380
|
+
header_params["topic.name"] = request.topic.name
|
381
|
+
end
|
382
|
+
|
360
383
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
361
384
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
362
385
|
|
363
386
|
options.apply_defaults timeout: @config.rpcs.update_topic.timeout,
|
364
387
|
metadata: metadata,
|
365
388
|
retry_policy: @config.rpcs.update_topic.retry_policy
|
366
|
-
|
389
|
+
|
390
|
+
options.apply_defaults timeout: @config.timeout,
|
391
|
+
metadata: @config.metadata,
|
367
392
|
retry_policy: @config.retry_policy
|
368
393
|
|
369
394
|
@publisher_stub.call_rpc :update_topic, request, options: options do |response, operation|
|
@@ -407,6 +432,21 @@ module Google
|
|
407
432
|
#
|
408
433
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
409
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
|
+
#
|
410
450
|
def publish request, options = nil
|
411
451
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
412
452
|
|
@@ -424,16 +464,20 @@ module Google
|
|
424
464
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
425
465
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
426
466
|
|
427
|
-
header_params = {
|
428
|
-
|
429
|
-
|
467
|
+
header_params = {}
|
468
|
+
if request.topic
|
469
|
+
header_params["topic"] = request.topic
|
470
|
+
end
|
471
|
+
|
430
472
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
431
473
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
432
474
|
|
433
475
|
options.apply_defaults timeout: @config.rpcs.publish.timeout,
|
434
476
|
metadata: metadata,
|
435
477
|
retry_policy: @config.rpcs.publish.retry_policy
|
436
|
-
|
478
|
+
|
479
|
+
options.apply_defaults timeout: @config.timeout,
|
480
|
+
metadata: @config.metadata,
|
437
481
|
retry_policy: @config.retry_policy
|
438
482
|
|
439
483
|
@publisher_stub.call_rpc :publish, request, options: options do |response, operation|
|
@@ -474,6 +518,21 @@ module Google
|
|
474
518
|
#
|
475
519
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
476
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
|
+
#
|
477
536
|
def get_topic request, options = nil
|
478
537
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
479
538
|
|
@@ -491,16 +550,20 @@ module Google
|
|
491
550
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
492
551
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
493
552
|
|
494
|
-
header_params = {
|
495
|
-
|
496
|
-
|
553
|
+
header_params = {}
|
554
|
+
if request.topic
|
555
|
+
header_params["topic"] = request.topic
|
556
|
+
end
|
557
|
+
|
497
558
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
498
559
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
499
560
|
|
500
561
|
options.apply_defaults timeout: @config.rpcs.get_topic.timeout,
|
501
562
|
metadata: metadata,
|
502
563
|
retry_policy: @config.rpcs.get_topic.retry_policy
|
503
|
-
|
564
|
+
|
565
|
+
options.apply_defaults timeout: @config.timeout,
|
566
|
+
metadata: @config.metadata,
|
504
567
|
retry_policy: @config.retry_policy
|
505
568
|
|
506
569
|
@publisher_stub.call_rpc :get_topic, request, options: options do |response, operation|
|
@@ -547,6 +610,27 @@ module Google
|
|
547
610
|
#
|
548
611
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
549
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
|
+
#
|
550
634
|
def list_topics request, options = nil
|
551
635
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
552
636
|
|
@@ -564,16 +648,20 @@ module Google
|
|
564
648
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
565
649
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
566
650
|
|
567
|
-
header_params = {
|
568
|
-
|
569
|
-
|
651
|
+
header_params = {}
|
652
|
+
if request.project
|
653
|
+
header_params["project"] = request.project
|
654
|
+
end
|
655
|
+
|
570
656
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
571
657
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
572
658
|
|
573
659
|
options.apply_defaults timeout: @config.rpcs.list_topics.timeout,
|
574
660
|
metadata: metadata,
|
575
661
|
retry_policy: @config.rpcs.list_topics.retry_policy
|
576
|
-
|
662
|
+
|
663
|
+
options.apply_defaults timeout: @config.timeout,
|
664
|
+
metadata: @config.metadata,
|
577
665
|
retry_policy: @config.retry_policy
|
578
666
|
|
579
667
|
@publisher_stub.call_rpc :list_topics, request, options: options do |response, operation|
|
@@ -621,6 +709,21 @@ module Google
|
|
621
709
|
#
|
622
710
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
623
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
|
+
#
|
624
727
|
def list_topic_subscriptions request, options = nil
|
625
728
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
626
729
|
|
@@ -638,16 +741,20 @@ module Google
|
|
638
741
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
639
742
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
640
743
|
|
641
|
-
header_params = {
|
642
|
-
|
643
|
-
|
744
|
+
header_params = {}
|
745
|
+
if request.topic
|
746
|
+
header_params["topic"] = request.topic
|
747
|
+
end
|
748
|
+
|
644
749
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
645
750
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
646
751
|
|
647
752
|
options.apply_defaults timeout: @config.rpcs.list_topic_subscriptions.timeout,
|
648
753
|
metadata: metadata,
|
649
754
|
retry_policy: @config.rpcs.list_topic_subscriptions.retry_policy
|
650
|
-
|
755
|
+
|
756
|
+
options.apply_defaults timeout: @config.timeout,
|
757
|
+
metadata: @config.metadata,
|
651
758
|
retry_policy: @config.retry_policy
|
652
759
|
|
653
760
|
@publisher_stub.call_rpc :list_topic_subscriptions, request, options: options do |response, operation|
|
@@ -698,6 +805,21 @@ module Google
|
|
698
805
|
#
|
699
806
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
700
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
|
+
#
|
701
823
|
def list_topic_snapshots request, options = nil
|
702
824
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
703
825
|
|
@@ -715,16 +837,20 @@ module Google
|
|
715
837
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
716
838
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
717
839
|
|
718
|
-
header_params = {
|
719
|
-
|
720
|
-
|
840
|
+
header_params = {}
|
841
|
+
if request.topic
|
842
|
+
header_params["topic"] = request.topic
|
843
|
+
end
|
844
|
+
|
721
845
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
722
846
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
723
847
|
|
724
848
|
options.apply_defaults timeout: @config.rpcs.list_topic_snapshots.timeout,
|
725
849
|
metadata: metadata,
|
726
850
|
retry_policy: @config.rpcs.list_topic_snapshots.retry_policy
|
727
|
-
|
851
|
+
|
852
|
+
options.apply_defaults timeout: @config.timeout,
|
853
|
+
metadata: @config.metadata,
|
728
854
|
retry_policy: @config.retry_policy
|
729
855
|
|
730
856
|
@publisher_stub.call_rpc :list_topic_snapshots, request, options: options do |response, operation|
|
@@ -769,6 +895,21 @@ module Google
|
|
769
895
|
#
|
770
896
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
771
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
|
+
#
|
772
913
|
def delete_topic request, options = nil
|
773
914
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
774
915
|
|
@@ -786,16 +927,20 @@ module Google
|
|
786
927
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
787
928
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
788
929
|
|
789
|
-
header_params = {
|
790
|
-
|
791
|
-
|
930
|
+
header_params = {}
|
931
|
+
if request.topic
|
932
|
+
header_params["topic"] = request.topic
|
933
|
+
end
|
934
|
+
|
792
935
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
793
936
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
794
937
|
|
795
938
|
options.apply_defaults timeout: @config.rpcs.delete_topic.timeout,
|
796
939
|
metadata: metadata,
|
797
940
|
retry_policy: @config.rpcs.delete_topic.retry_policy
|
798
|
-
|
941
|
+
|
942
|
+
options.apply_defaults timeout: @config.timeout,
|
943
|
+
metadata: @config.metadata,
|
799
944
|
retry_policy: @config.retry_policy
|
800
945
|
|
801
946
|
@publisher_stub.call_rpc :delete_topic, request, options: options do |response, operation|
|
@@ -839,6 +984,21 @@ module Google
|
|
839
984
|
#
|
840
985
|
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
841
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
|
+
#
|
842
1002
|
def detach_subscription request, options = nil
|
843
1003
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
844
1004
|
|
@@ -856,16 +1016,20 @@ module Google
|
|
856
1016
|
gapic_version: ::Google::Cloud::PubSub::V1::VERSION
|
857
1017
|
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
858
1018
|
|
859
|
-
header_params = {
|
860
|
-
|
861
|
-
|
1019
|
+
header_params = {}
|
1020
|
+
if request.subscription
|
1021
|
+
header_params["subscription"] = request.subscription
|
1022
|
+
end
|
1023
|
+
|
862
1024
|
request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
|
863
1025
|
metadata[:"x-goog-request-params"] ||= request_params_header
|
864
1026
|
|
865
1027
|
options.apply_defaults timeout: @config.rpcs.detach_subscription.timeout,
|
866
1028
|
metadata: metadata,
|
867
1029
|
retry_policy: @config.rpcs.detach_subscription.retry_policy
|
868
|
-
|
1030
|
+
|
1031
|
+
options.apply_defaults timeout: @config.timeout,
|
1032
|
+
metadata: @config.metadata,
|
869
1033
|
retry_policy: @config.retry_policy
|
870
1034
|
|
871
1035
|
@publisher_stub.call_rpc :detach_subscription, request, options: options do |response, operation|
|
@@ -889,22 +1053,21 @@ module Google
|
|
889
1053
|
# Configuration can be applied globally to all clients, or to a single client
|
890
1054
|
# on construction.
|
891
1055
|
#
|
892
|
-
#
|
893
|
-
#
|
894
|
-
# To modify the global config, setting the timeout for create_topic
|
895
|
-
# to 20 seconds, and all remaining timeouts to 10 seconds:
|
896
|
-
#
|
897
|
-
# ::Google::Cloud::PubSub::V1::Publisher::Client.configure do |config|
|
898
|
-
# config.timeout = 10.0
|
899
|
-
# config.rpcs.create_topic.timeout = 20.0
|
900
|
-
# end
|
1056
|
+
# @example
|
901
1057
|
#
|
902
|
-
#
|
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
|
903
1065
|
#
|
904
|
-
#
|
905
|
-
#
|
906
|
-
#
|
907
|
-
#
|
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
|
908
1071
|
#
|
909
1072
|
# @!attribute [rw] endpoint
|
910
1073
|
# The hostname or hostname:port of the service endpoint.
|
@@ -968,7 +1131,7 @@ module Google
|
|
968
1131
|
config_attr :scope, nil, ::String, ::Array, nil
|
969
1132
|
config_attr :lib_name, nil, ::String, nil
|
970
1133
|
config_attr :lib_version, nil, ::String, nil
|
971
|
-
config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
|
1134
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
972
1135
|
config_attr :interceptors, nil, ::Array, nil
|
973
1136
|
config_attr :timeout, nil, ::Numeric, nil
|
974
1137
|
config_attr :metadata, nil, ::Hash, nil
|
@@ -989,7 +1152,7 @@ module Google
|
|
989
1152
|
def rpcs
|
990
1153
|
@rpcs ||= begin
|
991
1154
|
parent_rpcs = nil
|
992
|
-
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config
|
1155
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
993
1156
|
Rpcs.new parent_rpcs
|
994
1157
|
end
|
995
1158
|
end
|
@@ -1001,7 +1164,7 @@ module Google
|
|
1001
1164
|
# Each configuration object is of type `Gapic::Config::Method` and includes
|
1002
1165
|
# the following configuration fields:
|
1003
1166
|
#
|
1004
|
-
# * `timeout` (*type:* `Numeric`) - The call timeout in
|
1167
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
1005
1168
|
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
1006
1169
|
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
1007
1170
|
# include the following keys:
|
@@ -1060,23 +1223,23 @@ module Google
|
|
1060
1223
|
|
1061
1224
|
# @private
|
1062
1225
|
def initialize parent_rpcs = nil
|
1063
|
-
create_topic_config = parent_rpcs
|
1226
|
+
create_topic_config = parent_rpcs.create_topic if parent_rpcs.respond_to? :create_topic
|
1064
1227
|
@create_topic = ::Gapic::Config::Method.new create_topic_config
|
1065
|
-
update_topic_config = parent_rpcs
|
1228
|
+
update_topic_config = parent_rpcs.update_topic if parent_rpcs.respond_to? :update_topic
|
1066
1229
|
@update_topic = ::Gapic::Config::Method.new update_topic_config
|
1067
|
-
publish_config = parent_rpcs
|
1230
|
+
publish_config = parent_rpcs.publish if parent_rpcs.respond_to? :publish
|
1068
1231
|
@publish = ::Gapic::Config::Method.new publish_config
|
1069
|
-
get_topic_config = parent_rpcs
|
1232
|
+
get_topic_config = parent_rpcs.get_topic if parent_rpcs.respond_to? :get_topic
|
1070
1233
|
@get_topic = ::Gapic::Config::Method.new get_topic_config
|
1071
|
-
list_topics_config = parent_rpcs
|
1234
|
+
list_topics_config = parent_rpcs.list_topics if parent_rpcs.respond_to? :list_topics
|
1072
1235
|
@list_topics = ::Gapic::Config::Method.new list_topics_config
|
1073
|
-
list_topic_subscriptions_config = parent_rpcs
|
1236
|
+
list_topic_subscriptions_config = parent_rpcs.list_topic_subscriptions if parent_rpcs.respond_to? :list_topic_subscriptions
|
1074
1237
|
@list_topic_subscriptions = ::Gapic::Config::Method.new list_topic_subscriptions_config
|
1075
|
-
list_topic_snapshots_config = parent_rpcs
|
1238
|
+
list_topic_snapshots_config = parent_rpcs.list_topic_snapshots if parent_rpcs.respond_to? :list_topic_snapshots
|
1076
1239
|
@list_topic_snapshots = ::Gapic::Config::Method.new list_topic_snapshots_config
|
1077
|
-
delete_topic_config = parent_rpcs
|
1240
|
+
delete_topic_config = parent_rpcs.delete_topic if parent_rpcs.respond_to? :delete_topic
|
1078
1241
|
@delete_topic = ::Gapic::Config::Method.new delete_topic_config
|
1079
|
-
detach_subscription_config = parent_rpcs
|
1242
|
+
detach_subscription_config = parent_rpcs.detach_subscription if parent_rpcs.respond_to? :detach_subscription
|
1080
1243
|
@detach_subscription = ::Gapic::Config::Method.new detach_subscription_config
|
1081
1244
|
|
1082
1245
|
yield self if block_given?
|