google-cloud-pubsub 0.27.2 → 0.28.0
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 +5 -5
- data/README.md +2 -2
- data/lib/google-cloud-pubsub.rb +13 -10
- data/lib/google/cloud/pubsub.rb +31 -33
- data/lib/google/cloud/pubsub/credentials.rb +31 -5
- data/lib/google/cloud/pubsub/project.rb +6 -5
- data/lib/google/cloud/pubsub/service.rb +2 -2
- data/lib/google/cloud/pubsub/snapshot.rb +1 -1
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +14 -1
- data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +26 -1
- data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +43 -1
- data/lib/google/cloud/pubsub/v1/doc/overview.rb +75 -0
- data/lib/google/cloud/pubsub/v1/publisher_client.rb +163 -107
- data/lib/google/cloud/pubsub/v1/publisher_client_config.json +9 -4
- data/lib/google/cloud/pubsub/v1/subscriber_client.rb +237 -205
- data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +6 -1
- data/lib/google/cloud/pubsub/version.rb +1 -1
- data/lib/google/pubsub/v1/pubsub_pb.rb +14 -1
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +18 -0
- metadata +10 -23
@@ -7,13 +7,13 @@
|
|
7
7
|
"UNAVAILABLE"
|
8
8
|
],
|
9
9
|
"one_plus_delivery": [
|
10
|
+
"ABORTED",
|
10
11
|
"CANCELLED",
|
11
|
-
"UNKNOWN",
|
12
12
|
"DEADLINE_EXCEEDED",
|
13
|
-
"RESOURCE_EXHAUSTED",
|
14
|
-
"ABORTED",
|
15
13
|
"INTERNAL",
|
16
|
-
"
|
14
|
+
"RESOURCE_EXHAUSTED",
|
15
|
+
"UNAVAILABLE",
|
16
|
+
"UNKNOWN"
|
17
17
|
],
|
18
18
|
"non_idempotent": []
|
19
19
|
},
|
@@ -43,6 +43,11 @@
|
|
43
43
|
"retry_codes_name": "idempotent",
|
44
44
|
"retry_params_name": "default"
|
45
45
|
},
|
46
|
+
"UpdateTopic": {
|
47
|
+
"timeout_millis": 60000,
|
48
|
+
"retry_codes_name": "idempotent",
|
49
|
+
"retry_params_name": "default"
|
50
|
+
},
|
46
51
|
"Publish": {
|
47
52
|
"timeout_millis": 60000,
|
48
53
|
"retry_codes_name": "one_plus_delivery",
|
@@ -29,6 +29,7 @@ require "google/gax"
|
|
29
29
|
|
30
30
|
require "google/iam/v1/iam_policy_pb"
|
31
31
|
require "google/pubsub/v1/pubsub_pb"
|
32
|
+
require "google/cloud/pubsub/credentials"
|
32
33
|
|
33
34
|
module Google
|
34
35
|
module Cloud
|
@@ -138,64 +139,24 @@ module Google
|
|
138
139
|
)
|
139
140
|
end
|
140
141
|
|
141
|
-
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
#
|
149
|
-
#
|
150
|
-
#
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
#
|
156
|
-
#
|
157
|
-
#
|
158
|
-
|
159
|
-
SNAPSHOT_PATH_TEMPLATE.match(snapshot_name)["snapshot"]
|
160
|
-
end
|
161
|
-
|
162
|
-
# Parses the project from a subscription resource.
|
163
|
-
# @param subscription_name [String]
|
164
|
-
# @return [String]
|
165
|
-
def self.match_project_from_subscription_name subscription_name
|
166
|
-
SUBSCRIPTION_PATH_TEMPLATE.match(subscription_name)["project"]
|
167
|
-
end
|
168
|
-
|
169
|
-
# Parses the subscription from a subscription resource.
|
170
|
-
# @param subscription_name [String]
|
171
|
-
# @return [String]
|
172
|
-
def self.match_subscription_from_subscription_name subscription_name
|
173
|
-
SUBSCRIPTION_PATH_TEMPLATE.match(subscription_name)["subscription"]
|
174
|
-
end
|
175
|
-
|
176
|
-
# Parses the project from a topic resource.
|
177
|
-
# @param topic_name [String]
|
178
|
-
# @return [String]
|
179
|
-
def self.match_project_from_topic_name topic_name
|
180
|
-
TOPIC_PATH_TEMPLATE.match(topic_name)["project"]
|
181
|
-
end
|
182
|
-
|
183
|
-
# Parses the topic from a topic resource.
|
184
|
-
# @param topic_name [String]
|
185
|
-
# @return [String]
|
186
|
-
def self.match_topic_from_topic_name topic_name
|
187
|
-
TOPIC_PATH_TEMPLATE.match(topic_name)["topic"]
|
188
|
-
end
|
189
|
-
|
190
|
-
# @param service_path [String]
|
191
|
-
# The domain name of the API remote host.
|
192
|
-
# @param port [Integer]
|
193
|
-
# The port on which to connect to the remote host.
|
194
|
-
# @param channel [Channel]
|
195
|
-
# A Channel object through which to make calls.
|
196
|
-
# @param chan_creds [Grpc::ChannelCredentials]
|
197
|
-
# A ChannelCredentials for the setting up the RPC client.
|
198
|
-
# @param client_config[Hash]
|
142
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
143
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
144
|
+
# be many types.
|
145
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
146
|
+
# authenticating requests made by this client.
|
147
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
148
|
+
# credentials for this client.
|
149
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
150
|
+
# credentials for this client.
|
151
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
152
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
153
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
154
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
155
|
+
# metadata for requests, generally, to give OAuth credentials.
|
156
|
+
# @param scopes [Array<String>]
|
157
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
158
|
+
# an updater_proc is supplied.
|
159
|
+
# @param client_config [Hash]
|
199
160
|
# A Hash for call options for each method. See
|
200
161
|
# Google::Gax#construct_settings for the structure of
|
201
162
|
# this data. Falls back to the default config if not specified
|
@@ -207,11 +168,11 @@ module Google
|
|
207
168
|
port: DEFAULT_SERVICE_PORT,
|
208
169
|
channel: nil,
|
209
170
|
chan_creds: nil,
|
171
|
+
updater_proc: nil,
|
172
|
+
credentials: nil,
|
210
173
|
scopes: ALL_SCOPES,
|
211
174
|
client_config: {},
|
212
175
|
timeout: DEFAULT_TIMEOUT,
|
213
|
-
app_name: nil,
|
214
|
-
app_version: nil,
|
215
176
|
lib_name: nil,
|
216
177
|
lib_version: ""
|
217
178
|
# These require statements are intentionally placed here to initialize
|
@@ -221,14 +182,38 @@ module Google
|
|
221
182
|
require "google/iam/v1/iam_policy_services_pb"
|
222
183
|
require "google/pubsub/v1/pubsub_services_pb"
|
223
184
|
|
185
|
+
if channel || chan_creds || updater_proc
|
186
|
+
warn "The `channel`, `chan_creds`, and `updater_proc` parameters will be removed " \
|
187
|
+
"on 2017/09/08"
|
188
|
+
credentials ||= channel
|
189
|
+
credentials ||= chan_creds
|
190
|
+
credentials ||= updater_proc
|
191
|
+
end
|
192
|
+
if service_path != SERVICE_ADDRESS || port != DEFAULT_SERVICE_PORT
|
193
|
+
warn "`service_path` and `port` parameters are deprecated and will be removed"
|
194
|
+
end
|
195
|
+
|
196
|
+
credentials ||= Google::Cloud::Pubsub::Credentials.default
|
224
197
|
|
225
|
-
if
|
226
|
-
|
198
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
199
|
+
updater_proc = Google::Cloud::Pubsub::Credentials.new(credentials).updater_proc
|
200
|
+
end
|
201
|
+
if credentials.is_a?(GRPC::Core::Channel)
|
202
|
+
channel = credentials
|
203
|
+
end
|
204
|
+
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
205
|
+
chan_creds = credentials
|
206
|
+
end
|
207
|
+
if credentials.is_a?(Proc)
|
208
|
+
updater_proc = credentials
|
209
|
+
end
|
210
|
+
if credentials.is_a?(Google::Auth::Credentials)
|
211
|
+
updater_proc = credentials.updater_proc
|
227
212
|
end
|
228
213
|
|
229
214
|
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
230
215
|
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
231
|
-
google_api_client << " gapic/0.
|
216
|
+
google_api_client << " gapic/0.1.0 gax/#{Google::Gax::VERSION}"
|
232
217
|
google_api_client << " grpc/#{GRPC::VERSION}"
|
233
218
|
google_api_client.freeze
|
234
219
|
|
@@ -253,6 +238,7 @@ module Google
|
|
253
238
|
port,
|
254
239
|
chan_creds: chan_creds,
|
255
240
|
channel: channel,
|
241
|
+
updater_proc: updater_proc,
|
256
242
|
scopes: scopes,
|
257
243
|
&Google::Iam::V1::IAMPolicy::Stub.method(:new)
|
258
244
|
)
|
@@ -261,6 +247,7 @@ module Google
|
|
261
247
|
port,
|
262
248
|
chan_creds: chan_creds,
|
263
249
|
channel: channel,
|
250
|
+
updater_proc: updater_proc,
|
264
251
|
scopes: scopes,
|
265
252
|
&Google::Pubsub::V1::Subscriber::Stub.method(:new)
|
266
253
|
)
|
@@ -325,6 +312,10 @@ module Google
|
|
325
312
|
@subscriber_stub.method(:create_snapshot),
|
326
313
|
defaults["create_snapshot"]
|
327
314
|
)
|
315
|
+
@update_snapshot = Google::Gax.create_api_call(
|
316
|
+
@subscriber_stub.method(:update_snapshot),
|
317
|
+
defaults["update_snapshot"]
|
318
|
+
)
|
328
319
|
@delete_snapshot = Google::Gax.create_api_call(
|
329
320
|
@subscriber_stub.method(:delete_snapshot),
|
330
321
|
defaults["delete_snapshot"]
|
@@ -344,7 +335,7 @@ module Google
|
|
344
335
|
# If the name is not provided in the request, the server will assign a random
|
345
336
|
# name for this subscription on the same project as the topic, conforming
|
346
337
|
# to the
|
347
|
-
#
|
338
|
+
# [resource name format](https://cloud.google.com/pubsub/docs/overview#names).
|
348
339
|
# The generated name is populated in the returned Subscription object.
|
349
340
|
# Note that for REST API requests, you must specify a name in the request.
|
350
341
|
#
|
@@ -360,10 +351,12 @@ module Google
|
|
360
351
|
# Format is +projects/{project}/topics/{topic}+.
|
361
352
|
# The value of this field will be +_deleted-topic_+ if the topic has been
|
362
353
|
# deleted.
|
363
|
-
# @param push_config [Google::Pubsub::V1::PushConfig]
|
354
|
+
# @param push_config [Google::Pubsub::V1::PushConfig | Hash]
|
364
355
|
# If push delivery is used with this subscription, this field is
|
365
356
|
# used to configure it. An empty +pushConfig+ signifies that the subscriber
|
366
357
|
# will pull and ack messages using API methods.
|
358
|
+
# A hash of the same form as `Google::Pubsub::V1::PushConfig`
|
359
|
+
# can also be provided.
|
367
360
|
# @param ack_deadline_seconds [Integer]
|
368
361
|
# This value is the maximum time after a subscriber receives a message
|
369
362
|
# before the subscriber should acknowledge the message. After message
|
@@ -389,26 +382,28 @@ module Google
|
|
389
382
|
# messages are not expunged from the subscription's backlog, even if they are
|
390
383
|
# acknowledged, until they fall out of the +message_retention_duration+
|
391
384
|
# window.
|
392
|
-
# @param message_retention_duration [Google::Protobuf::Duration]
|
385
|
+
# @param message_retention_duration [Google::Protobuf::Duration | Hash]
|
393
386
|
# How long to retain unacknowledged messages in the subscription's backlog,
|
394
387
|
# from the moment a message is published.
|
395
388
|
# If +retain_acked_messages+ is true, then this also configures the retention
|
396
389
|
# of acknowledged messages, and thus configures how far back in time a +Seek+
|
397
390
|
# can be done. Defaults to 7 days. Cannot be more than 7 days or less than 10
|
398
391
|
# minutes.
|
392
|
+
# A hash of the same form as `Google::Protobuf::Duration`
|
393
|
+
# can also be provided.
|
394
|
+
# @param labels [Hash{String => String}]
|
395
|
+
# User labels.
|
399
396
|
# @param options [Google::Gax::CallOptions]
|
400
397
|
# Overrides the default settings for this call, e.g, timeout,
|
401
398
|
# retries, etc.
|
402
399
|
# @return [Google::Pubsub::V1::Subscription]
|
403
400
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
404
401
|
# @example
|
405
|
-
# require "google/cloud/pubsub/v1
|
406
|
-
#
|
407
|
-
# SubscriberClient = Google::Cloud::Pubsub::V1::SubscriberClient
|
402
|
+
# require "google/cloud/pubsub/v1"
|
408
403
|
#
|
409
|
-
# subscriber_client =
|
410
|
-
# formatted_name = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
411
|
-
# formatted_topic = SubscriberClient.topic_path("[PROJECT]", "[TOPIC]")
|
404
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
405
|
+
# formatted_name = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
406
|
+
# formatted_topic = Google::Cloud::Pubsub::V1::SubscriberClient.topic_path("[PROJECT]", "[TOPIC]")
|
412
407
|
# response = subscriber_client.create_subscription(formatted_name, formatted_topic)
|
413
408
|
|
414
409
|
def create_subscription \
|
@@ -418,15 +413,18 @@ module Google
|
|
418
413
|
ack_deadline_seconds: nil,
|
419
414
|
retain_acked_messages: nil,
|
420
415
|
message_retention_duration: nil,
|
416
|
+
labels: nil,
|
421
417
|
options: nil
|
422
|
-
req =
|
418
|
+
req = {
|
423
419
|
name: name,
|
424
420
|
topic: topic,
|
425
421
|
push_config: push_config,
|
426
422
|
ack_deadline_seconds: ack_deadline_seconds,
|
427
423
|
retain_acked_messages: retain_acked_messages,
|
428
|
-
message_retention_duration: message_retention_duration
|
429
|
-
|
424
|
+
message_retention_duration: message_retention_duration,
|
425
|
+
labels: labels
|
426
|
+
}.delete_if { |_, v| v.nil? }
|
427
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::Subscription)
|
430
428
|
@create_subscription.call(req, options)
|
431
429
|
end
|
432
430
|
|
@@ -441,56 +439,60 @@ module Google
|
|
441
439
|
# @return [Google::Pubsub::V1::Subscription]
|
442
440
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
443
441
|
# @example
|
444
|
-
# require "google/cloud/pubsub/v1
|
445
|
-
#
|
446
|
-
# SubscriberClient = Google::Cloud::Pubsub::V1::SubscriberClient
|
442
|
+
# require "google/cloud/pubsub/v1"
|
447
443
|
#
|
448
|
-
# subscriber_client =
|
449
|
-
# formatted_subscription = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
444
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
445
|
+
# formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
450
446
|
# response = subscriber_client.get_subscription(formatted_subscription)
|
451
447
|
|
452
448
|
def get_subscription \
|
453
449
|
subscription,
|
454
450
|
options: nil
|
455
|
-
req =
|
451
|
+
req = {
|
456
452
|
subscription: subscription
|
457
|
-
}.delete_if { |_, v| v.nil? }
|
453
|
+
}.delete_if { |_, v| v.nil? }
|
454
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::GetSubscriptionRequest)
|
458
455
|
@get_subscription.call(req, options)
|
459
456
|
end
|
460
457
|
|
461
458
|
# Updates an existing subscription. Note that certain properties of a
|
462
459
|
# subscription, such as its topic, are not modifiable.
|
460
|
+
# NOTE: The style guide requires body: "subscription" instead of body: "*".
|
461
|
+
# Keeping the latter for internal consistency in V1, however it should be
|
462
|
+
# corrected in V2. See
|
463
|
+
# https://cloud.google.com/apis/design/standard_methods#update for details.
|
463
464
|
#
|
464
|
-
# @param subscription [Google::Pubsub::V1::Subscription]
|
465
|
+
# @param subscription [Google::Pubsub::V1::Subscription | Hash]
|
465
466
|
# The updated subscription object.
|
466
|
-
#
|
467
|
+
# A hash of the same form as `Google::Pubsub::V1::Subscription`
|
468
|
+
# can also be provided.
|
469
|
+
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
467
470
|
# Indicates which fields in the provided subscription to update.
|
468
471
|
# Must be specified and non-empty.
|
472
|
+
# A hash of the same form as `Google::Protobuf::FieldMask`
|
473
|
+
# can also be provided.
|
469
474
|
# @param options [Google::Gax::CallOptions]
|
470
475
|
# Overrides the default settings for this call, e.g, timeout,
|
471
476
|
# retries, etc.
|
472
477
|
# @return [Google::Pubsub::V1::Subscription]
|
473
478
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
474
479
|
# @example
|
475
|
-
# require "google/cloud/pubsub/v1
|
480
|
+
# require "google/cloud/pubsub/v1"
|
476
481
|
#
|
477
|
-
#
|
478
|
-
#
|
479
|
-
#
|
480
|
-
#
|
481
|
-
# subscriber_client = SubscriberClient.new
|
482
|
-
# subscription = Subscription.new
|
483
|
-
# update_mask = FieldMask.new
|
482
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
483
|
+
# subscription = {}
|
484
|
+
# update_mask = {}
|
484
485
|
# response = subscriber_client.update_subscription(subscription, update_mask)
|
485
486
|
|
486
487
|
def update_subscription \
|
487
488
|
subscription,
|
488
489
|
update_mask,
|
489
490
|
options: nil
|
490
|
-
req =
|
491
|
+
req = {
|
491
492
|
subscription: subscription,
|
492
493
|
update_mask: update_mask
|
493
|
-
}.delete_if { |_, v| v.nil? }
|
494
|
+
}.delete_if { |_, v| v.nil? }
|
495
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::UpdateSubscriptionRequest)
|
494
496
|
@update_subscription.call(req, options)
|
495
497
|
end
|
496
498
|
|
@@ -515,12 +517,10 @@ module Google
|
|
515
517
|
# object.
|
516
518
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
517
519
|
# @example
|
518
|
-
# require "google/cloud/pubsub/v1
|
519
|
-
#
|
520
|
-
# SubscriberClient = Google::Cloud::Pubsub::V1::SubscriberClient
|
520
|
+
# require "google/cloud/pubsub/v1"
|
521
521
|
#
|
522
|
-
# subscriber_client =
|
523
|
-
# formatted_project = SubscriberClient.project_path("[PROJECT]")
|
522
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
523
|
+
# formatted_project = Google::Cloud::Pubsub::V1::SubscriberClient.project_path("[PROJECT]")
|
524
524
|
#
|
525
525
|
# # Iterate over all results.
|
526
526
|
# subscriber_client.list_subscriptions(formatted_project).each do |element|
|
@@ -539,10 +539,11 @@ module Google
|
|
539
539
|
project,
|
540
540
|
page_size: nil,
|
541
541
|
options: nil
|
542
|
-
req =
|
542
|
+
req = {
|
543
543
|
project: project,
|
544
544
|
page_size: page_size
|
545
|
-
}.delete_if { |_, v| v.nil? }
|
545
|
+
}.delete_if { |_, v| v.nil? }
|
546
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::ListSubscriptionsRequest)
|
546
547
|
@list_subscriptions.call(req, options)
|
547
548
|
end
|
548
549
|
|
@@ -560,20 +561,19 @@ module Google
|
|
560
561
|
# retries, etc.
|
561
562
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
562
563
|
# @example
|
563
|
-
# require "google/cloud/pubsub/v1
|
564
|
+
# require "google/cloud/pubsub/v1"
|
564
565
|
#
|
565
|
-
#
|
566
|
-
#
|
567
|
-
# subscriber_client = SubscriberClient.new
|
568
|
-
# formatted_subscription = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
566
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
567
|
+
# formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
569
568
|
# subscriber_client.delete_subscription(formatted_subscription)
|
570
569
|
|
571
570
|
def delete_subscription \
|
572
571
|
subscription,
|
573
572
|
options: nil
|
574
|
-
req =
|
573
|
+
req = {
|
575
574
|
subscription: subscription
|
576
|
-
}.delete_if { |_, v| v.nil? }
|
575
|
+
}.delete_if { |_, v| v.nil? }
|
576
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::DeleteSubscriptionRequest)
|
577
577
|
@delete_subscription.call(req, options)
|
578
578
|
nil
|
579
579
|
end
|
@@ -602,12 +602,10 @@ module Google
|
|
602
602
|
# retries, etc.
|
603
603
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
604
604
|
# @example
|
605
|
-
# require "google/cloud/pubsub/v1
|
606
|
-
#
|
607
|
-
# SubscriberClient = Google::Cloud::Pubsub::V1::SubscriberClient
|
605
|
+
# require "google/cloud/pubsub/v1"
|
608
606
|
#
|
609
|
-
# subscriber_client =
|
610
|
-
# formatted_subscription = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
607
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
608
|
+
# formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
611
609
|
# ack_ids = []
|
612
610
|
# ack_deadline_seconds = 0
|
613
611
|
# subscriber_client.modify_ack_deadline(formatted_subscription, ack_ids, ack_deadline_seconds)
|
@@ -617,11 +615,12 @@ module Google
|
|
617
615
|
ack_ids,
|
618
616
|
ack_deadline_seconds,
|
619
617
|
options: nil
|
620
|
-
req =
|
618
|
+
req = {
|
621
619
|
subscription: subscription,
|
622
620
|
ack_ids: ack_ids,
|
623
621
|
ack_deadline_seconds: ack_deadline_seconds
|
624
|
-
}.delete_if { |_, v| v.nil? }
|
622
|
+
}.delete_if { |_, v| v.nil? }
|
623
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::ModifyAckDeadlineRequest)
|
625
624
|
@modify_ack_deadline.call(req, options)
|
626
625
|
nil
|
627
626
|
end
|
@@ -645,12 +644,10 @@ module Google
|
|
645
644
|
# retries, etc.
|
646
645
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
647
646
|
# @example
|
648
|
-
# require "google/cloud/pubsub/v1
|
647
|
+
# require "google/cloud/pubsub/v1"
|
649
648
|
#
|
650
|
-
#
|
651
|
-
#
|
652
|
-
# subscriber_client = SubscriberClient.new
|
653
|
-
# formatted_subscription = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
649
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
650
|
+
# formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
654
651
|
# ack_ids = []
|
655
652
|
# subscriber_client.acknowledge(formatted_subscription, ack_ids)
|
656
653
|
|
@@ -658,10 +655,11 @@ module Google
|
|
658
655
|
subscription,
|
659
656
|
ack_ids,
|
660
657
|
options: nil
|
661
|
-
req =
|
658
|
+
req = {
|
662
659
|
subscription: subscription,
|
663
660
|
ack_ids: ack_ids
|
664
|
-
}.delete_if { |_, v| v.nil? }
|
661
|
+
}.delete_if { |_, v| v.nil? }
|
662
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::AcknowledgeRequest)
|
665
663
|
@acknowledge.call(req, options)
|
666
664
|
nil
|
667
665
|
end
|
@@ -690,12 +688,10 @@ module Google
|
|
690
688
|
# @return [Google::Pubsub::V1::PullResponse]
|
691
689
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
692
690
|
# @example
|
693
|
-
# require "google/cloud/pubsub/v1
|
694
|
-
#
|
695
|
-
# SubscriberClient = Google::Cloud::Pubsub::V1::SubscriberClient
|
691
|
+
# require "google/cloud/pubsub/v1"
|
696
692
|
#
|
697
|
-
# subscriber_client =
|
698
|
-
# formatted_subscription = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
693
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
694
|
+
# formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
699
695
|
# max_messages = 0
|
700
696
|
# response = subscriber_client.pull(formatted_subscription, max_messages)
|
701
697
|
|
@@ -704,11 +700,12 @@ module Google
|
|
704
700
|
max_messages,
|
705
701
|
return_immediately: nil,
|
706
702
|
options: nil
|
707
|
-
req =
|
703
|
+
req = {
|
708
704
|
subscription: subscription,
|
709
705
|
max_messages: max_messages,
|
710
706
|
return_immediately: return_immediately
|
711
|
-
}.delete_if { |_, v| v.nil? }
|
707
|
+
}.delete_if { |_, v| v.nil? }
|
708
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::PullRequest)
|
712
709
|
@pull.call(req, options)
|
713
710
|
end
|
714
711
|
|
@@ -741,24 +738,22 @@ module Google
|
|
741
738
|
# This method interface might change in the future.
|
742
739
|
#
|
743
740
|
# @example
|
744
|
-
# require "google/cloud/pubsub/v1
|
741
|
+
# require "google/cloud/pubsub/v1"
|
745
742
|
#
|
746
|
-
#
|
747
|
-
#
|
748
|
-
#
|
749
|
-
# subscriber_client = SubscriberClient.new
|
750
|
-
# formatted_subscription = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
743
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
744
|
+
# formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
751
745
|
# stream_ack_deadline_seconds = 0
|
752
|
-
# request =
|
753
|
-
# request.subscription = formatted_subscription
|
754
|
-
# request.stream_ack_deadline_seconds = stream_ack_deadline_seconds
|
746
|
+
# request = { subscription: formatted_subscription, stream_ack_deadline_seconds: stream_ack_deadline_seconds }
|
755
747
|
# requests = [request]
|
756
748
|
# subscriber_client.streaming_pull(requests).each do |element|
|
757
749
|
# # Process element.
|
758
750
|
# end
|
759
751
|
|
760
752
|
def streaming_pull reqs, options: nil
|
761
|
-
|
753
|
+
request_protos = reqs.lazy.map do |req|
|
754
|
+
Google::Gax::to_proto(req, Google::Pubsub::V1::StreamingPullRequest)
|
755
|
+
end
|
756
|
+
@streaming_pull.call(request_protos, options)
|
762
757
|
end
|
763
758
|
|
764
759
|
# Modifies the +PushConfig+ for a specified subscription.
|
@@ -771,36 +766,36 @@ module Google
|
|
771
766
|
# @param subscription [String]
|
772
767
|
# The name of the subscription.
|
773
768
|
# Format is +projects/{project}/subscriptions/{sub}+.
|
774
|
-
# @param push_config [Google::Pubsub::V1::PushConfig]
|
769
|
+
# @param push_config [Google::Pubsub::V1::PushConfig | Hash]
|
775
770
|
# The push configuration for future deliveries.
|
776
771
|
#
|
777
772
|
# An empty +pushConfig+ indicates that the Pub/Sub system should
|
778
773
|
# stop pushing messages from the given subscription and allow
|
779
774
|
# messages to be pulled and acknowledged - effectively pausing
|
780
775
|
# the subscription if +Pull+ is not called.
|
776
|
+
# A hash of the same form as `Google::Pubsub::V1::PushConfig`
|
777
|
+
# can also be provided.
|
781
778
|
# @param options [Google::Gax::CallOptions]
|
782
779
|
# Overrides the default settings for this call, e.g, timeout,
|
783
780
|
# retries, etc.
|
784
781
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
785
782
|
# @example
|
786
|
-
# require "google/cloud/pubsub/v1
|
783
|
+
# require "google/cloud/pubsub/v1"
|
787
784
|
#
|
788
|
-
#
|
789
|
-
#
|
790
|
-
#
|
791
|
-
# subscriber_client = SubscriberClient.new
|
792
|
-
# formatted_subscription = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
793
|
-
# push_config = PushConfig.new
|
785
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
786
|
+
# formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
787
|
+
# push_config = {}
|
794
788
|
# subscriber_client.modify_push_config(formatted_subscription, push_config)
|
795
789
|
|
796
790
|
def modify_push_config \
|
797
791
|
subscription,
|
798
792
|
push_config,
|
799
793
|
options: nil
|
800
|
-
req =
|
794
|
+
req = {
|
801
795
|
subscription: subscription,
|
802
796
|
push_config: push_config
|
803
|
-
}.delete_if { |_, v| v.nil? }
|
797
|
+
}.delete_if { |_, v| v.nil? }
|
798
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::ModifyPushConfigRequest)
|
804
799
|
@modify_push_config.call(req, options)
|
805
800
|
nil
|
806
801
|
end
|
@@ -826,12 +821,10 @@ module Google
|
|
826
821
|
# object.
|
827
822
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
828
823
|
# @example
|
829
|
-
# require "google/cloud/pubsub/v1
|
830
|
-
#
|
831
|
-
# SubscriberClient = Google::Cloud::Pubsub::V1::SubscriberClient
|
824
|
+
# require "google/cloud/pubsub/v1"
|
832
825
|
#
|
833
|
-
# subscriber_client =
|
834
|
-
# formatted_project = SubscriberClient.project_path("[PROJECT]")
|
826
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
827
|
+
# formatted_project = Google::Cloud::Pubsub::V1::SubscriberClient.project_path("[PROJECT]")
|
835
828
|
#
|
836
829
|
# # Iterate over all results.
|
837
830
|
# subscriber_client.list_snapshots(formatted_project).each do |element|
|
@@ -850,10 +843,11 @@ module Google
|
|
850
843
|
project,
|
851
844
|
page_size: nil,
|
852
845
|
options: nil
|
853
|
-
req =
|
846
|
+
req = {
|
854
847
|
project: project,
|
855
848
|
page_size: page_size
|
856
|
-
}.delete_if { |_, v| v.nil? }
|
849
|
+
}.delete_if { |_, v| v.nil? }
|
850
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::ListSnapshotsRequest)
|
857
851
|
@list_snapshots.call(req, options)
|
858
852
|
end
|
859
853
|
|
@@ -864,7 +858,7 @@ module Google
|
|
864
858
|
# If the name is not provided in the request, the server will assign a random
|
865
859
|
# name for this snapshot on the same project as the subscription, conforming
|
866
860
|
# to the
|
867
|
-
#
|
861
|
+
# [resource name format](https://cloud.google.com/pubsub/docs/overview#names).
|
868
862
|
# The generated name is populated in the returned Snapshot object.
|
869
863
|
# Note that for REST API requests, you must specify a name in the request.
|
870
864
|
#
|
@@ -890,26 +884,66 @@ module Google
|
|
890
884
|
# @return [Google::Pubsub::V1::Snapshot]
|
891
885
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
892
886
|
# @example
|
893
|
-
# require "google/cloud/pubsub/v1
|
887
|
+
# require "google/cloud/pubsub/v1"
|
894
888
|
#
|
895
|
-
#
|
896
|
-
#
|
897
|
-
#
|
898
|
-
# formatted_name = SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
|
899
|
-
# formatted_subscription = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
889
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
890
|
+
# formatted_name = Google::Cloud::Pubsub::V1::SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
|
891
|
+
# formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
900
892
|
# response = subscriber_client.create_snapshot(formatted_name, formatted_subscription)
|
901
893
|
|
902
894
|
def create_snapshot \
|
903
895
|
name,
|
904
896
|
subscription,
|
905
897
|
options: nil
|
906
|
-
req =
|
898
|
+
req = {
|
907
899
|
name: name,
|
908
900
|
subscription: subscription
|
909
|
-
}.delete_if { |_, v| v.nil? }
|
901
|
+
}.delete_if { |_, v| v.nil? }
|
902
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::CreateSnapshotRequest)
|
910
903
|
@create_snapshot.call(req, options)
|
911
904
|
end
|
912
905
|
|
906
|
+
# Updates an existing snapshot. Note that certain properties of a snapshot
|
907
|
+
# are not modifiable.
|
908
|
+
# NOTE: The style guide requires body: "snapshot" instead of body: "*".
|
909
|
+
# Keeping the latter for internal consistency in V1, however it should be
|
910
|
+
# corrected in V2. See
|
911
|
+
# https://cloud.google.com/apis/design/standard_methods#update for details.
|
912
|
+
#
|
913
|
+
# @param snapshot [Google::Pubsub::V1::Snapshot | Hash]
|
914
|
+
# The updated snpashot object.
|
915
|
+
# A hash of the same form as `Google::Pubsub::V1::Snapshot`
|
916
|
+
# can also be provided.
|
917
|
+
# @param update_mask [Google::Protobuf::FieldMask | Hash]
|
918
|
+
# Indicates which fields in the provided snapshot to update.
|
919
|
+
# Must be specified and non-empty.
|
920
|
+
# A hash of the same form as `Google::Protobuf::FieldMask`
|
921
|
+
# can also be provided.
|
922
|
+
# @param options [Google::Gax::CallOptions]
|
923
|
+
# Overrides the default settings for this call, e.g, timeout,
|
924
|
+
# retries, etc.
|
925
|
+
# @return [Google::Pubsub::V1::Snapshot]
|
926
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
927
|
+
# @example
|
928
|
+
# require "google/cloud/pubsub/v1"
|
929
|
+
#
|
930
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
931
|
+
# snapshot = {}
|
932
|
+
# update_mask = {}
|
933
|
+
# response = subscriber_client.update_snapshot(snapshot, update_mask)
|
934
|
+
|
935
|
+
def update_snapshot \
|
936
|
+
snapshot,
|
937
|
+
update_mask,
|
938
|
+
options: nil
|
939
|
+
req = {
|
940
|
+
snapshot: snapshot,
|
941
|
+
update_mask: update_mask
|
942
|
+
}.delete_if { |_, v| v.nil? }
|
943
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::UpdateSnapshotRequest)
|
944
|
+
@update_snapshot.call(req, options)
|
945
|
+
end
|
946
|
+
|
913
947
|
# Removes an existing snapshot. All messages retained in the snapshot
|
914
948
|
# are immediately dropped. After a snapshot is deleted, a new one may be
|
915
949
|
# created with the same name, but the new one has no association with the old
|
@@ -923,20 +957,19 @@ module Google
|
|
923
957
|
# retries, etc.
|
924
958
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
925
959
|
# @example
|
926
|
-
# require "google/cloud/pubsub/v1
|
960
|
+
# require "google/cloud/pubsub/v1"
|
927
961
|
#
|
928
|
-
#
|
929
|
-
#
|
930
|
-
# subscriber_client = SubscriberClient.new
|
931
|
-
# formatted_snapshot = SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
|
962
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
963
|
+
# formatted_snapshot = Google::Cloud::Pubsub::V1::SubscriberClient.snapshot_path("[PROJECT]", "[SNAPSHOT]")
|
932
964
|
# subscriber_client.delete_snapshot(formatted_snapshot)
|
933
965
|
|
934
966
|
def delete_snapshot \
|
935
967
|
snapshot,
|
936
968
|
options: nil
|
937
|
-
req =
|
969
|
+
req = {
|
938
970
|
snapshot: snapshot
|
939
|
-
}.delete_if { |_, v| v.nil? }
|
971
|
+
}.delete_if { |_, v| v.nil? }
|
972
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::DeleteSnapshotRequest)
|
940
973
|
@delete_snapshot.call(req, options)
|
941
974
|
nil
|
942
975
|
end
|
@@ -946,7 +979,7 @@ module Google
|
|
946
979
|
#
|
947
980
|
# @param subscription [String]
|
948
981
|
# The subscription to affect.
|
949
|
-
# @param time [Google::Protobuf::Timestamp]
|
982
|
+
# @param time [Google::Protobuf::Timestamp | Hash]
|
950
983
|
# The time to seek to.
|
951
984
|
# Messages retained in the subscription that were published before this
|
952
985
|
# time are marked as acknowledged, and messages retained in the
|
@@ -958,6 +991,8 @@ module Google
|
|
958
991
|
# window (or to a point before the system's notion of the subscription
|
959
992
|
# creation time), only retained messages will be marked as unacknowledged,
|
960
993
|
# and already-expunged messages will not be restored.
|
994
|
+
# A hash of the same form as `Google::Protobuf::Timestamp`
|
995
|
+
# can also be provided.
|
961
996
|
# @param snapshot [String]
|
962
997
|
# The snapshot to seek to. The snapshot's topic must be the same as that of
|
963
998
|
# the provided subscription.
|
@@ -968,12 +1003,10 @@ module Google
|
|
968
1003
|
# @return [Google::Pubsub::V1::SeekResponse]
|
969
1004
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
970
1005
|
# @example
|
971
|
-
# require "google/cloud/pubsub/v1
|
972
|
-
#
|
973
|
-
# SubscriberClient = Google::Cloud::Pubsub::V1::SubscriberClient
|
1006
|
+
# require "google/cloud/pubsub/v1"
|
974
1007
|
#
|
975
|
-
# subscriber_client =
|
976
|
-
# formatted_subscription = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
1008
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
1009
|
+
# formatted_subscription = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
977
1010
|
# response = subscriber_client.seek(formatted_subscription)
|
978
1011
|
|
979
1012
|
def seek \
|
@@ -981,11 +1014,12 @@ module Google
|
|
981
1014
|
time: nil,
|
982
1015
|
snapshot: nil,
|
983
1016
|
options: nil
|
984
|
-
req =
|
1017
|
+
req = {
|
985
1018
|
subscription: subscription,
|
986
1019
|
time: time,
|
987
1020
|
snapshot: snapshot
|
988
|
-
}.delete_if { |_, v| v.nil? }
|
1021
|
+
}.delete_if { |_, v| v.nil? }
|
1022
|
+
req = Google::Gax::to_proto(req, Google::Pubsub::V1::SeekRequest)
|
989
1023
|
@seek.call(req, options)
|
990
1024
|
end
|
991
1025
|
|
@@ -996,35 +1030,35 @@ module Google
|
|
996
1030
|
# REQUIRED: The resource for which the policy is being specified.
|
997
1031
|
# +resource+ is usually specified as a path. For example, a Project
|
998
1032
|
# resource is specified as +projects/{project}+.
|
999
|
-
# @param policy [Google::Iam::V1::Policy]
|
1033
|
+
# @param policy [Google::Iam::V1::Policy | Hash]
|
1000
1034
|
# REQUIRED: The complete policy to be applied to the +resource+. The size of
|
1001
1035
|
# the policy is limited to a few 10s of KB. An empty policy is a
|
1002
1036
|
# valid policy but certain Cloud Platform services (such as Projects)
|
1003
1037
|
# might reject them.
|
1038
|
+
# A hash of the same form as `Google::Iam::V1::Policy`
|
1039
|
+
# can also be provided.
|
1004
1040
|
# @param options [Google::Gax::CallOptions]
|
1005
1041
|
# Overrides the default settings for this call, e.g, timeout,
|
1006
1042
|
# retries, etc.
|
1007
1043
|
# @return [Google::Iam::V1::Policy]
|
1008
1044
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1009
1045
|
# @example
|
1010
|
-
# require "google/cloud/pubsub/v1
|
1046
|
+
# require "google/cloud/pubsub/v1"
|
1011
1047
|
#
|
1012
|
-
#
|
1013
|
-
#
|
1014
|
-
#
|
1015
|
-
# subscriber_client = SubscriberClient.new
|
1016
|
-
# formatted_resource = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
1017
|
-
# policy = Policy.new
|
1048
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
1049
|
+
# formatted_resource = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
1050
|
+
# policy = {}
|
1018
1051
|
# response = subscriber_client.set_iam_policy(formatted_resource, policy)
|
1019
1052
|
|
1020
1053
|
def set_iam_policy \
|
1021
1054
|
resource,
|
1022
1055
|
policy,
|
1023
1056
|
options: nil
|
1024
|
-
req =
|
1057
|
+
req = {
|
1025
1058
|
resource: resource,
|
1026
1059
|
policy: policy
|
1027
|
-
}.delete_if { |_, v| v.nil? }
|
1060
|
+
}.delete_if { |_, v| v.nil? }
|
1061
|
+
req = Google::Gax::to_proto(req, Google::Iam::V1::SetIamPolicyRequest)
|
1028
1062
|
@set_iam_policy.call(req, options)
|
1029
1063
|
end
|
1030
1064
|
|
@@ -1042,20 +1076,19 @@ module Google
|
|
1042
1076
|
# @return [Google::Iam::V1::Policy]
|
1043
1077
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1044
1078
|
# @example
|
1045
|
-
# require "google/cloud/pubsub/v1
|
1046
|
-
#
|
1047
|
-
# SubscriberClient = Google::Cloud::Pubsub::V1::SubscriberClient
|
1079
|
+
# require "google/cloud/pubsub/v1"
|
1048
1080
|
#
|
1049
|
-
# subscriber_client =
|
1050
|
-
# formatted_resource = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
1081
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
1082
|
+
# formatted_resource = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
1051
1083
|
# response = subscriber_client.get_iam_policy(formatted_resource)
|
1052
1084
|
|
1053
1085
|
def get_iam_policy \
|
1054
1086
|
resource,
|
1055
1087
|
options: nil
|
1056
|
-
req =
|
1088
|
+
req = {
|
1057
1089
|
resource: resource
|
1058
|
-
}.delete_if { |_, v| v.nil? }
|
1090
|
+
}.delete_if { |_, v| v.nil? }
|
1091
|
+
req = Google::Gax::to_proto(req, Google::Iam::V1::GetIamPolicyRequest)
|
1059
1092
|
@get_iam_policy.call(req, options)
|
1060
1093
|
end
|
1061
1094
|
|
@@ -1071,19 +1104,17 @@ module Google
|
|
1071
1104
|
# The set of permissions to check for the +resource+. Permissions with
|
1072
1105
|
# wildcards (such as '*' or 'storage.*') are not allowed. For more
|
1073
1106
|
# information see
|
1074
|
-
#
|
1107
|
+
# [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions).
|
1075
1108
|
# @param options [Google::Gax::CallOptions]
|
1076
1109
|
# Overrides the default settings for this call, e.g, timeout,
|
1077
1110
|
# retries, etc.
|
1078
1111
|
# @return [Google::Iam::V1::TestIamPermissionsResponse]
|
1079
1112
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
1080
1113
|
# @example
|
1081
|
-
# require "google/cloud/pubsub/v1
|
1082
|
-
#
|
1083
|
-
# SubscriberClient = Google::Cloud::Pubsub::V1::SubscriberClient
|
1114
|
+
# require "google/cloud/pubsub/v1"
|
1084
1115
|
#
|
1085
|
-
# subscriber_client =
|
1086
|
-
# formatted_resource = SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
1116
|
+
# subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
|
1117
|
+
# formatted_resource = Google::Cloud::Pubsub::V1::SubscriberClient.subscription_path("[PROJECT]", "[SUBSCRIPTION]")
|
1087
1118
|
# permissions = []
|
1088
1119
|
# response = subscriber_client.test_iam_permissions(formatted_resource, permissions)
|
1089
1120
|
|
@@ -1091,10 +1122,11 @@ module Google
|
|
1091
1122
|
resource,
|
1092
1123
|
permissions,
|
1093
1124
|
options: nil
|
1094
|
-
req =
|
1125
|
+
req = {
|
1095
1126
|
resource: resource,
|
1096
1127
|
permissions: permissions
|
1097
|
-
}.delete_if { |_, v| v.nil? }
|
1128
|
+
}.delete_if { |_, v| v.nil? }
|
1129
|
+
req = Google::Gax::to_proto(req, Google::Iam::V1::TestIamPermissionsRequest)
|
1098
1130
|
@test_iam_permissions.call(req, options)
|
1099
1131
|
end
|
1100
1132
|
end
|