google-cloud-pubsub-v1 1.16.0 → 1.18.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -2
  3. data/lib/google/cloud/pubsub/v1/bindings_override.rb +158 -0
  4. data/lib/google/cloud/pubsub/v1/rest.rb +40 -0
  5. data/lib/google/cloud/pubsub/v1/schema_service/client.rb +1 -1
  6. data/lib/google/cloud/pubsub/v1/schema_service/credentials.rb +1 -1
  7. data/lib/google/cloud/pubsub/v1/schema_service/paths.rb +1 -1
  8. data/lib/google/cloud/pubsub/v1/schema_service/rest/client.rb +1348 -0
  9. data/lib/google/cloud/pubsub/v1/schema_service/rest/service_stub.rb +696 -0
  10. data/lib/google/cloud/pubsub/v1/schema_service/rest.rb +53 -0
  11. data/lib/google/cloud/pubsub/v1/schema_service.rb +7 -1
  12. data/lib/google/cloud/pubsub/v1/subscription_admin/client.rb +7 -5
  13. data/lib/google/cloud/pubsub/v1/subscription_admin/credentials.rb +1 -1
  14. data/lib/google/cloud/pubsub/v1/subscription_admin/paths.rb +1 -1
  15. data/lib/google/cloud/pubsub/v1/subscription_admin/rest/client.rb +2035 -0
  16. data/lib/google/cloud/pubsub/v1/subscription_admin/rest/service_stub.rb +1005 -0
  17. data/lib/google/cloud/pubsub/v1/subscription_admin/rest.rb +55 -0
  18. data/lib/google/cloud/pubsub/v1/subscription_admin.rb +7 -1
  19. data/lib/google/cloud/pubsub/v1/topic_admin/client.rb +4 -3
  20. data/lib/google/cloud/pubsub/v1/topic_admin/credentials.rb +1 -1
  21. data/lib/google/cloud/pubsub/v1/topic_admin/paths.rb +1 -1
  22. data/lib/google/cloud/pubsub/v1/topic_admin/rest/client.rb +1274 -0
  23. data/lib/google/cloud/pubsub/v1/topic_admin/rest/service_stub.rb +633 -0
  24. data/lib/google/cloud/pubsub/v1/topic_admin/rest.rb +54 -0
  25. data/lib/google/cloud/pubsub/v1/topic_admin.rb +7 -1
  26. data/lib/google/cloud/pubsub/v1/version.rb +1 -1
  27. data/lib/google/cloud/pubsub/v1.rb +6 -1
  28. data/lib/google/pubsub/v1/pubsub_pb.rb +6 -1
  29. data/lib/google/pubsub/v1/pubsub_services_pb.rb +1 -1
  30. data/lib/google/pubsub/v1/schema_pb.rb +2 -1
  31. data/lib/google/pubsub/v1/schema_services_pb.rb +1 -1
  32. data/lib/google-cloud-pubsub-v1.rb +1 -1
  33. data/proto_docs/google/api/client.rb +1 -1
  34. data/proto_docs/google/api/field_behavior.rb +1 -1
  35. data/proto_docs/google/api/launch_stage.rb +1 -1
  36. data/proto_docs/google/api/resource.rb +1 -1
  37. data/proto_docs/google/protobuf/duration.rb +1 -1
  38. data/proto_docs/google/protobuf/empty.rb +1 -1
  39. data/proto_docs/google/protobuf/field_mask.rb +1 -1
  40. data/proto_docs/google/protobuf/timestamp.rb +8 -7
  41. data/proto_docs/google/pubsub/v1/pubsub.rb +140 -35
  42. data/proto_docs/google/pubsub/v1/schema.rb +18 -1
  43. metadata +16 -6
  44. data/proto_docs/google/type/expr.rb +0 -75
@@ -0,0 +1,2035 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2026 Google LLC
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # https://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+ # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
+
19
+ require "google/cloud/errors"
20
+ require "google/pubsub/v1/pubsub_pb"
21
+ require "google/cloud/pubsub/v1/subscription_admin/rest/service_stub"
22
+ require "google/iam/v1/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module PubSub
27
+ module V1
28
+ module SubscriptionAdmin
29
+ module Rest
30
+ ##
31
+ # REST client for the SubscriptionAdmin service.
32
+ #
33
+ # The service that an application uses to manipulate subscriptions and to
34
+ # consume messages from a subscription via the `Pull` method or by
35
+ # establishing a bi-directional stream using the `StreamingPull` method.
36
+ #
37
+ class Client
38
+ # @private
39
+ API_VERSION = ""
40
+
41
+ # @private
42
+ DEFAULT_ENDPOINT_TEMPLATE = "pubsub.$UNIVERSE_DOMAIN$"
43
+
44
+ include Paths
45
+
46
+ # @private
47
+ attr_reader :subscription_admin_stub
48
+
49
+ ##
50
+ # Configure the SubscriptionAdmin Client class.
51
+ #
52
+ # See {::Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client::Configuration}
53
+ # for a description of the configuration fields.
54
+ #
55
+ # @example
56
+ #
57
+ # # Modify the configuration for all SubscriptionAdmin clients
58
+ # ::Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.configure do |config|
59
+ # config.timeout = 10.0
60
+ # end
61
+ #
62
+ # @yield [config] Configure the Client client.
63
+ # @yieldparam config [Client::Configuration]
64
+ #
65
+ # @return [Client::Configuration]
66
+ #
67
+ def self.configure
68
+ @configure ||= begin
69
+ namespace = ["Google", "Cloud", "PubSub", "V1"]
70
+ parent_config = while namespace.any?
71
+ parent_name = namespace.join "::"
72
+ parent_const = const_get parent_name
73
+ break parent_const.configure if parent_const.respond_to? :configure
74
+ namespace.pop
75
+ end
76
+ default_config = Client::Configuration.new parent_config
77
+
78
+ default_config.rpcs.create_subscription.timeout = 60.0
79
+ default_config.rpcs.create_subscription.retry_policy = {
80
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
81
+ }
82
+
83
+ default_config.rpcs.get_subscription.timeout = 60.0
84
+ default_config.rpcs.get_subscription.retry_policy = {
85
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
86
+ }
87
+
88
+ default_config.rpcs.update_subscription.timeout = 60.0
89
+ default_config.rpcs.update_subscription.retry_policy = {
90
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
91
+ }
92
+
93
+ default_config.rpcs.list_subscriptions.timeout = 60.0
94
+ default_config.rpcs.list_subscriptions.retry_policy = {
95
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
96
+ }
97
+
98
+ default_config.rpcs.delete_subscription.timeout = 60.0
99
+ default_config.rpcs.delete_subscription.retry_policy = {
100
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
101
+ }
102
+
103
+ default_config.rpcs.modify_ack_deadline.timeout = 60.0
104
+ default_config.rpcs.modify_ack_deadline.retry_policy = {
105
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
106
+ }
107
+
108
+ default_config.rpcs.acknowledge.timeout = 60.0
109
+ default_config.rpcs.acknowledge.retry_policy = {
110
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
111
+ }
112
+
113
+ default_config.rpcs.pull.timeout = 60.0
114
+ default_config.rpcs.pull.retry_policy = {
115
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14, 13]
116
+ }
117
+
118
+ default_config.rpcs.modify_push_config.timeout = 60.0
119
+ default_config.rpcs.modify_push_config.retry_policy = {
120
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
121
+ }
122
+
123
+ default_config.rpcs.get_snapshot.timeout = 60.0
124
+ default_config.rpcs.get_snapshot.retry_policy = {
125
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
126
+ }
127
+
128
+ default_config.rpcs.list_snapshots.timeout = 60.0
129
+ default_config.rpcs.list_snapshots.retry_policy = {
130
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
131
+ }
132
+
133
+ default_config.rpcs.create_snapshot.timeout = 60.0
134
+ default_config.rpcs.create_snapshot.retry_policy = {
135
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
136
+ }
137
+
138
+ default_config.rpcs.update_snapshot.timeout = 60.0
139
+ default_config.rpcs.update_snapshot.retry_policy = {
140
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
141
+ }
142
+
143
+ default_config.rpcs.delete_snapshot.timeout = 60.0
144
+ default_config.rpcs.delete_snapshot.retry_policy = {
145
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
146
+ }
147
+
148
+ default_config.rpcs.seek.timeout = 60.0
149
+ default_config.rpcs.seek.retry_policy = {
150
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [2, 10, 14]
151
+ }
152
+
153
+ default_config
154
+ end
155
+ yield @configure if block_given?
156
+ @configure
157
+ end
158
+
159
+ ##
160
+ # Configure the SubscriptionAdmin Client instance.
161
+ #
162
+ # The configuration is set to the derived mode, meaning that values can be changed,
163
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
164
+ # should be made on {Client.configure}.
165
+ #
166
+ # See {::Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client::Configuration}
167
+ # for a description of the configuration fields.
168
+ #
169
+ # @yield [config] Configure the Client client.
170
+ # @yieldparam config [Client::Configuration]
171
+ #
172
+ # @return [Client::Configuration]
173
+ #
174
+ def configure
175
+ yield @config if block_given?
176
+ @config
177
+ end
178
+
179
+ ##
180
+ # The effective universe domain
181
+ #
182
+ # @return [String]
183
+ #
184
+ def universe_domain
185
+ @subscription_admin_stub.universe_domain
186
+ end
187
+
188
+ ##
189
+ # Create a new SubscriptionAdmin REST client object.
190
+ #
191
+ # @example
192
+ #
193
+ # # Create a client using the default configuration
194
+ # client = ::Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
195
+ #
196
+ # # Create a client using a custom configuration
197
+ # client = ::Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new do |config|
198
+ # config.timeout = 10.0
199
+ # end
200
+ #
201
+ # @yield [config] Configure the SubscriptionAdmin client.
202
+ # @yieldparam config [Client::Configuration]
203
+ #
204
+ def initialize
205
+ # Create the configuration object
206
+ @config = Configuration.new Client.configure
207
+
208
+ # Yield the configuration if needed
209
+ yield @config if block_given?
210
+
211
+ # Create credentials
212
+ credentials = @config.credentials
213
+ # Use self-signed JWT if the endpoint is unchanged from default,
214
+ # but only if the default endpoint does not have a region prefix.
215
+ enable_self_signed_jwt = @config.endpoint.nil? ||
216
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
217
+ !@config.endpoint.split(".").first.include?("-"))
218
+ credentials ||= Credentials.default scope: @config.scope,
219
+ enable_self_signed_jwt: enable_self_signed_jwt
220
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
221
+ credentials = Credentials.new credentials, scope: @config.scope
222
+ end
223
+
224
+ @quota_project_id = @config.quota_project
225
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
226
+
227
+ @subscription_admin_stub = ::Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::ServiceStub.new(
228
+ endpoint: @config.endpoint,
229
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
230
+ universe_domain: @config.universe_domain,
231
+ credentials: credentials,
232
+ logger: @config.logger
233
+ )
234
+
235
+ @subscription_admin_stub.logger(stub: true)&.info do |entry|
236
+ entry.set_system_name
237
+ entry.set_service
238
+ entry.message = "Created client for #{entry.service}"
239
+ entry.set_credentials_fields credentials
240
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
241
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
242
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
243
+ end
244
+
245
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
246
+ config.credentials = credentials
247
+ config.quota_project = @quota_project_id
248
+ config.endpoint = @subscription_admin_stub.endpoint
249
+ config.universe_domain = @subscription_admin_stub.universe_domain
250
+ config.bindings_override = @config.bindings_override
251
+ config.logger = @subscription_admin_stub.logger if config.respond_to? :logger=
252
+ end
253
+ end
254
+
255
+ ##
256
+ # Get the associated client for mix-in of the IAMPolicy.
257
+ #
258
+ # @return [Google::Iam::V1::IAMPolicy::Rest::Client]
259
+ #
260
+ attr_reader :iam_policy_client
261
+
262
+ ##
263
+ # The logger used for request/response debug logging.
264
+ #
265
+ # @return [Logger]
266
+ #
267
+ def logger
268
+ @subscription_admin_stub.logger
269
+ end
270
+
271
+ # Service calls
272
+
273
+ ##
274
+ # Creates a subscription to a given topic. See the [resource name rules]
275
+ # (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
276
+ # If the subscription already exists, returns `ALREADY_EXISTS`.
277
+ # If the corresponding topic doesn't exist, returns `NOT_FOUND`.
278
+ #
279
+ # If the name is not provided in the request, the server will assign a random
280
+ # name for this subscription on the same project as the topic, conforming
281
+ # to the [resource name format]
282
+ # (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
283
+ # generated name is populated in the returned Subscription object. Note that
284
+ # for REST API requests, you must specify a name in the request.
285
+ #
286
+ # @overload create_subscription(request, options = nil)
287
+ # Pass arguments to `create_subscription` via a request object, either of type
288
+ # {::Google::Cloud::PubSub::V1::Subscription} or an equivalent Hash.
289
+ #
290
+ # @param request [::Google::Cloud::PubSub::V1::Subscription, ::Hash]
291
+ # A request object representing the call parameters. Required. To specify no
292
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
293
+ # @param options [::Gapic::CallOptions, ::Hash]
294
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
295
+ #
296
+ # @overload create_subscription(name: nil, topic: nil, push_config: nil, bigquery_config: nil, cloud_storage_config: nil, bigtable_config: nil, ack_deadline_seconds: nil, retain_acked_messages: nil, message_retention_duration: nil, labels: nil, enable_message_ordering: nil, expiration_policy: nil, filter: nil, dead_letter_policy: nil, retry_policy: nil, detached: nil, enable_exactly_once_delivery: nil, message_transforms: nil, tags: nil)
297
+ # Pass arguments to `create_subscription` via keyword arguments. Note that at
298
+ # least one keyword argument is required. To specify no parameters, or to keep all
299
+ # the default parameter values, pass an empty Hash as a request object (see above).
300
+ #
301
+ # @param name [::String]
302
+ # Required. Identifier. The name of the subscription. It must have the format
303
+ # `"projects/{project}/subscriptions/{subscription}"`. `{subscription}` must
304
+ # start with a letter, and contain only letters (`[A-Za-z]`), numbers
305
+ # (`[0-9]`), dashes (`-`), underscores (`_`), periods (`.`), tildes (`~`),
306
+ # plus (`+`) or percent signs (`%`). It must be between 3 and 255 characters
307
+ # in length, and it must not start with `"goog"`.
308
+ # @param topic [::String]
309
+ # Required. The name of the topic from which this subscription is receiving
310
+ # messages. Format is `projects/{project}/topics/{topic}`. The value of this
311
+ # field will be `_deleted-topic_` if the topic has been deleted.
312
+ # @param push_config [::Google::Cloud::PubSub::V1::PushConfig, ::Hash]
313
+ # Optional. If push delivery is used with this subscription, this field is
314
+ # used to configure it.
315
+ # @param bigquery_config [::Google::Cloud::PubSub::V1::BigQueryConfig, ::Hash]
316
+ # Optional. If delivery to BigQuery is used with this subscription, this
317
+ # field is used to configure it.
318
+ # @param cloud_storage_config [::Google::Cloud::PubSub::V1::CloudStorageConfig, ::Hash]
319
+ # Optional. If delivery to Google Cloud Storage is used with this
320
+ # subscription, this field is used to configure it.
321
+ # @param bigtable_config [::Google::Cloud::PubSub::V1::BigtableConfig, ::Hash]
322
+ # Optional. If delivery to Bigtable is used with this subscription, this
323
+ # field is used to configure it.
324
+ # @param ack_deadline_seconds [::Integer]
325
+ # Optional. The approximate amount of time (on a best-effort basis) Pub/Sub
326
+ # waits for the subscriber to acknowledge receipt before resending the
327
+ # message. In the interval after the message is delivered and before it is
328
+ # acknowledged, it is considered to be _outstanding_. During that time
329
+ # period, the message will not be redelivered (on a best-effort basis).
330
+ #
331
+ # For pull subscriptions, this value is used as the initial value for the ack
332
+ # deadline. To override this value for a given message, call
333
+ # `ModifyAckDeadline` with the corresponding `ack_id` if using
334
+ # non-streaming pull or send the `ack_id` in a
335
+ # `StreamingModifyAckDeadlineRequest` if using streaming pull.
336
+ # The minimum custom deadline you can specify is 10 seconds.
337
+ # The maximum custom deadline you can specify is 600 seconds (10 minutes).
338
+ # If this parameter is 0, a default value of 10 seconds is used.
339
+ #
340
+ # For push delivery, this value is also used to set the request timeout for
341
+ # the call to the push endpoint.
342
+ #
343
+ # If the subscriber never acknowledges the message, the Pub/Sub
344
+ # system will eventually redeliver the message.
345
+ # @param retain_acked_messages [::Boolean]
346
+ # Optional. Indicates whether to retain acknowledged messages. If true, then
347
+ # messages are not expunged from the subscription's backlog, even if they are
348
+ # acknowledged, until they fall out of the `message_retention_duration`
349
+ # window. This must be true if you would like to [`Seek` to a timestamp]
350
+ # (https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time) in
351
+ # the past to replay previously-acknowledged messages.
352
+ # @param message_retention_duration [::Google::Protobuf::Duration, ::Hash]
353
+ # Optional. How long to retain unacknowledged messages in the subscription's
354
+ # backlog, from the moment a message is published. If `retain_acked_messages`
355
+ # is true, then this also configures the retention of acknowledged messages,
356
+ # and thus configures how far back in time a `Seek` can be done. Defaults to
357
+ # 7 days. Cannot be more than 31 days or less than 10 minutes.
358
+ # @param labels [::Hash{::String => ::String}]
359
+ # Optional. See [Creating and managing
360
+ # labels](https://cloud.google.com/pubsub/docs/labels).
361
+ # @param enable_message_ordering [::Boolean]
362
+ # Optional. If true, messages published with the same `ordering_key` in
363
+ # `PubsubMessage` will be delivered to the subscribers in the order in which
364
+ # they are received by the Pub/Sub system. Otherwise, they may be delivered
365
+ # in any order.
366
+ # @param expiration_policy [::Google::Cloud::PubSub::V1::ExpirationPolicy, ::Hash]
367
+ # Optional. A policy that specifies the conditions for this subscription's
368
+ # expiration. A subscription is considered active as long as any connected
369
+ # subscriber is successfully consuming messages from the subscription or is
370
+ # issuing operations on the subscription. If `expiration_policy` is not set,
371
+ # a *default policy* with `ttl` of 31 days will be used. The minimum allowed
372
+ # value for `expiration_policy.ttl` is 1 day. If `expiration_policy` is set,
373
+ # but `expiration_policy.ttl` is not set, the subscription never expires.
374
+ # @param filter [::String]
375
+ # Optional. An expression written in the Pub/Sub [filter
376
+ # language](https://cloud.google.com/pubsub/docs/filtering). If non-empty,
377
+ # then only `PubsubMessage`s whose `attributes` field matches the filter are
378
+ # delivered on this subscription. If empty, then no messages are filtered
379
+ # out.
380
+ # @param dead_letter_policy [::Google::Cloud::PubSub::V1::DeadLetterPolicy, ::Hash]
381
+ # Optional. A policy that specifies the conditions for dead lettering
382
+ # messages in this subscription. If dead_letter_policy is not set, dead
383
+ # lettering is disabled.
384
+ #
385
+ # The Pub/Sub service account associated with this subscriptions's
386
+ # parent project (i.e.,
387
+ # service-\\{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have
388
+ # permission to Acknowledge() messages on this subscription.
389
+ # @param retry_policy [::Google::Cloud::PubSub::V1::RetryPolicy, ::Hash]
390
+ # Optional. A policy that specifies how Pub/Sub retries message delivery for
391
+ # this subscription.
392
+ #
393
+ # If not set, the default retry policy is applied. This generally implies
394
+ # that messages will be retried as soon as possible for healthy subscribers.
395
+ # RetryPolicy will be triggered on NACKs or acknowledgment deadline exceeded
396
+ # events for a given message.
397
+ # @param detached [::Boolean]
398
+ # Optional. Indicates whether the subscription is detached from its topic.
399
+ # Detached subscriptions don't receive messages from their topic and don't
400
+ # retain any backlog. `Pull` and `StreamingPull` requests will return
401
+ # FAILED_PRECONDITION. If the subscription is a push subscription, pushes to
402
+ # the endpoint will not be made.
403
+ # @param enable_exactly_once_delivery [::Boolean]
404
+ # Optional. If true, Pub/Sub provides the following guarantees for the
405
+ # delivery of a message with a given value of `message_id` on this
406
+ # subscription:
407
+ #
408
+ # * The message sent to a subscriber is guaranteed not to be resent
409
+ # before the message's acknowledgment deadline expires.
410
+ # * An acknowledged message will not be resent to a subscriber.
411
+ #
412
+ # Note that subscribers may still receive multiple copies of a message
413
+ # when `enable_exactly_once_delivery` is true if the message was published
414
+ # multiple times by a publisher client. These copies are considered distinct
415
+ # by Pub/Sub and have distinct `message_id` values.
416
+ # @param message_transforms [::Array<::Google::Cloud::PubSub::V1::MessageTransform, ::Hash>]
417
+ # Optional. Transforms to be applied to messages before they are delivered to
418
+ # subscribers. Transforms are applied in the order specified.
419
+ # @param tags [::Hash{::String => ::String}]
420
+ # Optional. Input only. Immutable. Tag keys/values directly bound to this
421
+ # resource. For example:
422
+ # "123/environment": "production",
423
+ # "123/costCenter": "marketing"
424
+ # See
425
+ # https://\\{$universe.dns_names.final_documentation_domain}/pubsub/docs/tags
426
+ # for more information on using tags with Pub/Sub resources.
427
+ # @yield [result, operation] Access the result along with the TransportOperation object
428
+ # @yieldparam result [::Google::Cloud::PubSub::V1::Subscription]
429
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
430
+ #
431
+ # @return [::Google::Cloud::PubSub::V1::Subscription]
432
+ #
433
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
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::SubscriptionAdmin::Rest::Client.new
440
+ #
441
+ # # Create a request. To set request fields, pass in keyword arguments.
442
+ # request = Google::Cloud::PubSub::V1::Subscription.new
443
+ #
444
+ # # Call the create_subscription method.
445
+ # result = client.create_subscription request
446
+ #
447
+ # # The returned object is of type Google::Cloud::PubSub::V1::Subscription.
448
+ # p result
449
+ #
450
+ def create_subscription request, options = nil
451
+ raise ::ArgumentError, "request must be provided" if request.nil?
452
+
453
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::Subscription
454
+
455
+ # Converts hash and nil to an options object
456
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
457
+
458
+ # Customize the options with defaults
459
+ call_metadata = @config.rpcs.create_subscription.metadata.to_h
460
+
461
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
462
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
463
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
464
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
465
+ transports_version_send: [:rest]
466
+
467
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
468
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
469
+
470
+ options.apply_defaults timeout: @config.rpcs.create_subscription.timeout,
471
+ metadata: call_metadata,
472
+ retry_policy: @config.rpcs.create_subscription.retry_policy
473
+
474
+ options.apply_defaults timeout: @config.timeout,
475
+ metadata: @config.metadata,
476
+ retry_policy: @config.retry_policy
477
+
478
+ @subscription_admin_stub.create_subscription request, options do |result, operation|
479
+ yield result, operation if block_given?
480
+ end
481
+ rescue ::Gapic::Rest::Error => e
482
+ raise ::Google::Cloud::Error.from_error(e)
483
+ end
484
+
485
+ ##
486
+ # Gets the configuration details of a subscription.
487
+ #
488
+ # @overload get_subscription(request, options = nil)
489
+ # Pass arguments to `get_subscription` via a request object, either of type
490
+ # {::Google::Cloud::PubSub::V1::GetSubscriptionRequest} or an equivalent Hash.
491
+ #
492
+ # @param request [::Google::Cloud::PubSub::V1::GetSubscriptionRequest, ::Hash]
493
+ # A request object representing the call parameters. Required. To specify no
494
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
495
+ # @param options [::Gapic::CallOptions, ::Hash]
496
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
497
+ #
498
+ # @overload get_subscription(subscription: nil)
499
+ # Pass arguments to `get_subscription` via keyword arguments. Note that at
500
+ # least one keyword argument is required. To specify no parameters, or to keep all
501
+ # the default parameter values, pass an empty Hash as a request object (see above).
502
+ #
503
+ # @param subscription [::String]
504
+ # Required. The name of the subscription to get.
505
+ # Format is `projects/{project}/subscriptions/{sub}`.
506
+ # @yield [result, operation] Access the result along with the TransportOperation object
507
+ # @yieldparam result [::Google::Cloud::PubSub::V1::Subscription]
508
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
509
+ #
510
+ # @return [::Google::Cloud::PubSub::V1::Subscription]
511
+ #
512
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
513
+ #
514
+ # @example Basic example
515
+ # require "google/cloud/pubsub/v1"
516
+ #
517
+ # # Create a client object. The client can be reused for multiple calls.
518
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
519
+ #
520
+ # # Create a request. To set request fields, pass in keyword arguments.
521
+ # request = Google::Cloud::PubSub::V1::GetSubscriptionRequest.new
522
+ #
523
+ # # Call the get_subscription method.
524
+ # result = client.get_subscription request
525
+ #
526
+ # # The returned object is of type Google::Cloud::PubSub::V1::Subscription.
527
+ # p result
528
+ #
529
+ def get_subscription request, options = nil
530
+ raise ::ArgumentError, "request must be provided" if request.nil?
531
+
532
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::GetSubscriptionRequest
533
+
534
+ # Converts hash and nil to an options object
535
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
536
+
537
+ # Customize the options with defaults
538
+ call_metadata = @config.rpcs.get_subscription.metadata.to_h
539
+
540
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
541
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
542
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
543
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
544
+ transports_version_send: [:rest]
545
+
546
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
547
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
548
+
549
+ options.apply_defaults timeout: @config.rpcs.get_subscription.timeout,
550
+ metadata: call_metadata,
551
+ retry_policy: @config.rpcs.get_subscription.retry_policy
552
+
553
+ options.apply_defaults timeout: @config.timeout,
554
+ metadata: @config.metadata,
555
+ retry_policy: @config.retry_policy
556
+
557
+ @subscription_admin_stub.get_subscription request, options do |result, operation|
558
+ yield result, operation if block_given?
559
+ end
560
+ rescue ::Gapic::Rest::Error => e
561
+ raise ::Google::Cloud::Error.from_error(e)
562
+ end
563
+
564
+ ##
565
+ # Updates an existing subscription by updating the fields specified in the
566
+ # update mask. Note that certain properties of a subscription, such as its
567
+ # topic, are not modifiable.
568
+ #
569
+ # @overload update_subscription(request, options = nil)
570
+ # Pass arguments to `update_subscription` via a request object, either of type
571
+ # {::Google::Cloud::PubSub::V1::UpdateSubscriptionRequest} or an equivalent Hash.
572
+ #
573
+ # @param request [::Google::Cloud::PubSub::V1::UpdateSubscriptionRequest, ::Hash]
574
+ # A request object representing the call parameters. Required. To specify no
575
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
576
+ # @param options [::Gapic::CallOptions, ::Hash]
577
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
578
+ #
579
+ # @overload update_subscription(subscription: nil, update_mask: nil)
580
+ # Pass arguments to `update_subscription` via keyword arguments. Note that at
581
+ # least one keyword argument is required. To specify no parameters, or to keep all
582
+ # the default parameter values, pass an empty Hash as a request object (see above).
583
+ #
584
+ # @param subscription [::Google::Cloud::PubSub::V1::Subscription, ::Hash]
585
+ # Required. The updated subscription object.
586
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
587
+ # Required. Indicates which fields in the provided subscription to update.
588
+ # Must be specified and non-empty.
589
+ # @yield [result, operation] Access the result along with the TransportOperation object
590
+ # @yieldparam result [::Google::Cloud::PubSub::V1::Subscription]
591
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
592
+ #
593
+ # @return [::Google::Cloud::PubSub::V1::Subscription]
594
+ #
595
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
596
+ #
597
+ # @example Basic example
598
+ # require "google/cloud/pubsub/v1"
599
+ #
600
+ # # Create a client object. The client can be reused for multiple calls.
601
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
602
+ #
603
+ # # Create a request. To set request fields, pass in keyword arguments.
604
+ # request = Google::Cloud::PubSub::V1::UpdateSubscriptionRequest.new
605
+ #
606
+ # # Call the update_subscription method.
607
+ # result = client.update_subscription request
608
+ #
609
+ # # The returned object is of type Google::Cloud::PubSub::V1::Subscription.
610
+ # p result
611
+ #
612
+ def update_subscription request, options = nil
613
+ raise ::ArgumentError, "request must be provided" if request.nil?
614
+
615
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::UpdateSubscriptionRequest
616
+
617
+ # Converts hash and nil to an options object
618
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
619
+
620
+ # Customize the options with defaults
621
+ call_metadata = @config.rpcs.update_subscription.metadata.to_h
622
+
623
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
624
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
625
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
626
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
627
+ transports_version_send: [:rest]
628
+
629
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
630
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
631
+
632
+ options.apply_defaults timeout: @config.rpcs.update_subscription.timeout,
633
+ metadata: call_metadata,
634
+ retry_policy: @config.rpcs.update_subscription.retry_policy
635
+
636
+ options.apply_defaults timeout: @config.timeout,
637
+ metadata: @config.metadata,
638
+ retry_policy: @config.retry_policy
639
+
640
+ @subscription_admin_stub.update_subscription request, options do |result, operation|
641
+ yield result, operation if block_given?
642
+ end
643
+ rescue ::Gapic::Rest::Error => e
644
+ raise ::Google::Cloud::Error.from_error(e)
645
+ end
646
+
647
+ ##
648
+ # Lists matching subscriptions.
649
+ #
650
+ # @overload list_subscriptions(request, options = nil)
651
+ # Pass arguments to `list_subscriptions` via a request object, either of type
652
+ # {::Google::Cloud::PubSub::V1::ListSubscriptionsRequest} or an equivalent Hash.
653
+ #
654
+ # @param request [::Google::Cloud::PubSub::V1::ListSubscriptionsRequest, ::Hash]
655
+ # A request object representing the call parameters. Required. To specify no
656
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
657
+ # @param options [::Gapic::CallOptions, ::Hash]
658
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
659
+ #
660
+ # @overload list_subscriptions(project: nil, page_size: nil, page_token: nil)
661
+ # Pass arguments to `list_subscriptions` via keyword arguments. Note that at
662
+ # least one keyword argument is required. To specify no parameters, or to keep all
663
+ # the default parameter values, pass an empty Hash as a request object (see above).
664
+ #
665
+ # @param project [::String]
666
+ # Required. The name of the project in which to list subscriptions.
667
+ # Format is `projects/{project-id}`.
668
+ # @param page_size [::Integer]
669
+ # Optional. Maximum number of subscriptions to return.
670
+ # @param page_token [::String]
671
+ # Optional. The value returned by the last `ListSubscriptionsResponse`;
672
+ # indicates that this is a continuation of a prior `ListSubscriptions` call,
673
+ # and that the system should return the next page of data.
674
+ # @yield [result, operation] Access the result along with the TransportOperation object
675
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PubSub::V1::Subscription>]
676
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
677
+ #
678
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PubSub::V1::Subscription>]
679
+ #
680
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
681
+ #
682
+ # @example Basic example
683
+ # require "google/cloud/pubsub/v1"
684
+ #
685
+ # # Create a client object. The client can be reused for multiple calls.
686
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
687
+ #
688
+ # # Create a request. To set request fields, pass in keyword arguments.
689
+ # request = Google::Cloud::PubSub::V1::ListSubscriptionsRequest.new
690
+ #
691
+ # # Call the list_subscriptions method.
692
+ # result = client.list_subscriptions request
693
+ #
694
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
695
+ # # over elements, and API calls will be issued to fetch pages as needed.
696
+ # result.each do |item|
697
+ # # Each element is of type ::Google::Cloud::PubSub::V1::Subscription.
698
+ # p item
699
+ # end
700
+ #
701
+ def list_subscriptions request, options = nil
702
+ raise ::ArgumentError, "request must be provided" if request.nil?
703
+
704
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListSubscriptionsRequest
705
+
706
+ # Converts hash and nil to an options object
707
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
708
+
709
+ # Customize the options with defaults
710
+ call_metadata = @config.rpcs.list_subscriptions.metadata.to_h
711
+
712
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
713
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
714
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
715
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
716
+ transports_version_send: [:rest]
717
+
718
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
719
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
720
+
721
+ options.apply_defaults timeout: @config.rpcs.list_subscriptions.timeout,
722
+ metadata: call_metadata,
723
+ retry_policy: @config.rpcs.list_subscriptions.retry_policy
724
+
725
+ options.apply_defaults timeout: @config.timeout,
726
+ metadata: @config.metadata,
727
+ retry_policy: @config.retry_policy
728
+
729
+ @subscription_admin_stub.list_subscriptions request, options do |result, operation|
730
+ result = ::Gapic::Rest::PagedEnumerable.new @subscription_admin_stub, :list_subscriptions, "subscriptions", request, result, options
731
+ yield result, operation if block_given?
732
+ throw :response, result
733
+ end
734
+ rescue ::Gapic::Rest::Error => e
735
+ raise ::Google::Cloud::Error.from_error(e)
736
+ end
737
+
738
+ ##
739
+ # Deletes an existing subscription. All messages retained in the subscription
740
+ # are immediately dropped. Calls to `Pull` after deletion will return
741
+ # `NOT_FOUND`. After a subscription is deleted, a new one may be created with
742
+ # the same name, but the new one has no association with the old
743
+ # subscription or its topic unless the same topic is specified.
744
+ #
745
+ # @overload delete_subscription(request, options = nil)
746
+ # Pass arguments to `delete_subscription` via a request object, either of type
747
+ # {::Google::Cloud::PubSub::V1::DeleteSubscriptionRequest} or an equivalent Hash.
748
+ #
749
+ # @param request [::Google::Cloud::PubSub::V1::DeleteSubscriptionRequest, ::Hash]
750
+ # A request object representing the call parameters. Required. To specify no
751
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
752
+ # @param options [::Gapic::CallOptions, ::Hash]
753
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
754
+ #
755
+ # @overload delete_subscription(subscription: nil)
756
+ # Pass arguments to `delete_subscription` via keyword arguments. Note that at
757
+ # least one keyword argument is required. To specify no parameters, or to keep all
758
+ # the default parameter values, pass an empty Hash as a request object (see above).
759
+ #
760
+ # @param subscription [::String]
761
+ # Required. The subscription to delete.
762
+ # Format is `projects/{project}/subscriptions/{sub}`.
763
+ # @yield [result, operation] Access the result along with the TransportOperation object
764
+ # @yieldparam result [::Google::Protobuf::Empty]
765
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
766
+ #
767
+ # @return [::Google::Protobuf::Empty]
768
+ #
769
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
770
+ #
771
+ # @example Basic example
772
+ # require "google/cloud/pubsub/v1"
773
+ #
774
+ # # Create a client object. The client can be reused for multiple calls.
775
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
776
+ #
777
+ # # Create a request. To set request fields, pass in keyword arguments.
778
+ # request = Google::Cloud::PubSub::V1::DeleteSubscriptionRequest.new
779
+ #
780
+ # # Call the delete_subscription method.
781
+ # result = client.delete_subscription request
782
+ #
783
+ # # The returned object is of type Google::Protobuf::Empty.
784
+ # p result
785
+ #
786
+ def delete_subscription request, options = nil
787
+ raise ::ArgumentError, "request must be provided" if request.nil?
788
+
789
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::DeleteSubscriptionRequest
790
+
791
+ # Converts hash and nil to an options object
792
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
793
+
794
+ # Customize the options with defaults
795
+ call_metadata = @config.rpcs.delete_subscription.metadata.to_h
796
+
797
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
798
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
799
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
800
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
801
+ transports_version_send: [:rest]
802
+
803
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
804
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
805
+
806
+ options.apply_defaults timeout: @config.rpcs.delete_subscription.timeout,
807
+ metadata: call_metadata,
808
+ retry_policy: @config.rpcs.delete_subscription.retry_policy
809
+
810
+ options.apply_defaults timeout: @config.timeout,
811
+ metadata: @config.metadata,
812
+ retry_policy: @config.retry_policy
813
+
814
+ @subscription_admin_stub.delete_subscription request, options do |result, operation|
815
+ yield result, operation if block_given?
816
+ end
817
+ rescue ::Gapic::Rest::Error => e
818
+ raise ::Google::Cloud::Error.from_error(e)
819
+ end
820
+
821
+ ##
822
+ # Modifies the ack deadline for a specific message. This method is useful
823
+ # to indicate that more time is needed to process a message by the
824
+ # subscriber, or to make the message available for redelivery if the
825
+ # processing was interrupted. Note that this does not modify the
826
+ # subscription-level `ackDeadlineSeconds` used for subsequent messages.
827
+ #
828
+ # @overload modify_ack_deadline(request, options = nil)
829
+ # Pass arguments to `modify_ack_deadline` via a request object, either of type
830
+ # {::Google::Cloud::PubSub::V1::ModifyAckDeadlineRequest} or an equivalent Hash.
831
+ #
832
+ # @param request [::Google::Cloud::PubSub::V1::ModifyAckDeadlineRequest, ::Hash]
833
+ # A request object representing the call parameters. Required. To specify no
834
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
835
+ # @param options [::Gapic::CallOptions, ::Hash]
836
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
837
+ #
838
+ # @overload modify_ack_deadline(subscription: nil, ack_ids: nil, ack_deadline_seconds: nil)
839
+ # Pass arguments to `modify_ack_deadline` via keyword arguments. Note that at
840
+ # least one keyword argument is required. To specify no parameters, or to keep all
841
+ # the default parameter values, pass an empty Hash as a request object (see above).
842
+ #
843
+ # @param subscription [::String]
844
+ # Required. The name of the subscription.
845
+ # Format is `projects/{project}/subscriptions/{sub}`.
846
+ # @param ack_ids [::Array<::String>]
847
+ # Required. List of acknowledgment IDs.
848
+ # @param ack_deadline_seconds [::Integer]
849
+ # Required. The new ack deadline with respect to the time this request was
850
+ # sent to the Pub/Sub system. For example, if the value is 10, the new ack
851
+ # deadline will expire 10 seconds after the `ModifyAckDeadline` call was
852
+ # made. Specifying zero might immediately make the message available for
853
+ # delivery to another subscriber client. This typically results in an
854
+ # increase in the rate of message redeliveries (that is, duplicates).
855
+ # The minimum deadline you can specify is 0 seconds.
856
+ # The maximum deadline you can specify in a single request is 600 seconds
857
+ # (10 minutes).
858
+ # @yield [result, operation] Access the result along with the TransportOperation object
859
+ # @yieldparam result [::Google::Protobuf::Empty]
860
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
861
+ #
862
+ # @return [::Google::Protobuf::Empty]
863
+ #
864
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
865
+ #
866
+ # @example Basic example
867
+ # require "google/cloud/pubsub/v1"
868
+ #
869
+ # # Create a client object. The client can be reused for multiple calls.
870
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
871
+ #
872
+ # # Create a request. To set request fields, pass in keyword arguments.
873
+ # request = Google::Cloud::PubSub::V1::ModifyAckDeadlineRequest.new
874
+ #
875
+ # # Call the modify_ack_deadline method.
876
+ # result = client.modify_ack_deadline request
877
+ #
878
+ # # The returned object is of type Google::Protobuf::Empty.
879
+ # p result
880
+ #
881
+ def modify_ack_deadline request, options = nil
882
+ raise ::ArgumentError, "request must be provided" if request.nil?
883
+
884
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ModifyAckDeadlineRequest
885
+
886
+ # Converts hash and nil to an options object
887
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
888
+
889
+ # Customize the options with defaults
890
+ call_metadata = @config.rpcs.modify_ack_deadline.metadata.to_h
891
+
892
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
893
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
894
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
895
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
896
+ transports_version_send: [:rest]
897
+
898
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
899
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
900
+
901
+ options.apply_defaults timeout: @config.rpcs.modify_ack_deadline.timeout,
902
+ metadata: call_metadata,
903
+ retry_policy: @config.rpcs.modify_ack_deadline.retry_policy
904
+
905
+ options.apply_defaults timeout: @config.timeout,
906
+ metadata: @config.metadata,
907
+ retry_policy: @config.retry_policy
908
+
909
+ @subscription_admin_stub.modify_ack_deadline request, options do |result, operation|
910
+ yield result, operation if block_given?
911
+ end
912
+ rescue ::Gapic::Rest::Error => e
913
+ raise ::Google::Cloud::Error.from_error(e)
914
+ end
915
+
916
+ ##
917
+ # Acknowledges the messages associated with the `ack_ids` in the
918
+ # `AcknowledgeRequest`. The Pub/Sub system can remove the relevant messages
919
+ # from the subscription.
920
+ #
921
+ # Acknowledging a message whose ack deadline has expired may succeed,
922
+ # but such a message may be redelivered later. Acknowledging a message more
923
+ # than once will not result in an error.
924
+ #
925
+ # @overload acknowledge(request, options = nil)
926
+ # Pass arguments to `acknowledge` via a request object, either of type
927
+ # {::Google::Cloud::PubSub::V1::AcknowledgeRequest} or an equivalent Hash.
928
+ #
929
+ # @param request [::Google::Cloud::PubSub::V1::AcknowledgeRequest, ::Hash]
930
+ # A request object representing the call parameters. Required. To specify no
931
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
932
+ # @param options [::Gapic::CallOptions, ::Hash]
933
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
934
+ #
935
+ # @overload acknowledge(subscription: nil, ack_ids: nil)
936
+ # Pass arguments to `acknowledge` via keyword arguments. Note that at
937
+ # least one keyword argument is required. To specify no parameters, or to keep all
938
+ # the default parameter values, pass an empty Hash as a request object (see above).
939
+ #
940
+ # @param subscription [::String]
941
+ # Required. The subscription whose message is being acknowledged.
942
+ # Format is `projects/{project}/subscriptions/{sub}`.
943
+ # @param ack_ids [::Array<::String>]
944
+ # Required. The acknowledgment ID for the messages being acknowledged that
945
+ # was returned by the Pub/Sub system in the `Pull` response. Must not be
946
+ # empty.
947
+ # @yield [result, operation] Access the result along with the TransportOperation object
948
+ # @yieldparam result [::Google::Protobuf::Empty]
949
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
950
+ #
951
+ # @return [::Google::Protobuf::Empty]
952
+ #
953
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
954
+ #
955
+ # @example Basic example
956
+ # require "google/cloud/pubsub/v1"
957
+ #
958
+ # # Create a client object. The client can be reused for multiple calls.
959
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
960
+ #
961
+ # # Create a request. To set request fields, pass in keyword arguments.
962
+ # request = Google::Cloud::PubSub::V1::AcknowledgeRequest.new
963
+ #
964
+ # # Call the acknowledge method.
965
+ # result = client.acknowledge request
966
+ #
967
+ # # The returned object is of type Google::Protobuf::Empty.
968
+ # p result
969
+ #
970
+ def acknowledge request, options = nil
971
+ raise ::ArgumentError, "request must be provided" if request.nil?
972
+
973
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::AcknowledgeRequest
974
+
975
+ # Converts hash and nil to an options object
976
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
977
+
978
+ # Customize the options with defaults
979
+ call_metadata = @config.rpcs.acknowledge.metadata.to_h
980
+
981
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
982
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
983
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
984
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
985
+ transports_version_send: [:rest]
986
+
987
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
988
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
989
+
990
+ options.apply_defaults timeout: @config.rpcs.acknowledge.timeout,
991
+ metadata: call_metadata,
992
+ retry_policy: @config.rpcs.acknowledge.retry_policy
993
+
994
+ options.apply_defaults timeout: @config.timeout,
995
+ metadata: @config.metadata,
996
+ retry_policy: @config.retry_policy
997
+
998
+ @subscription_admin_stub.acknowledge request, options do |result, operation|
999
+ yield result, operation if block_given?
1000
+ end
1001
+ rescue ::Gapic::Rest::Error => e
1002
+ raise ::Google::Cloud::Error.from_error(e)
1003
+ end
1004
+
1005
+ ##
1006
+ # Pulls messages from the server.
1007
+ #
1008
+ # @overload pull(request, options = nil)
1009
+ # Pass arguments to `pull` via a request object, either of type
1010
+ # {::Google::Cloud::PubSub::V1::PullRequest} or an equivalent Hash.
1011
+ #
1012
+ # @param request [::Google::Cloud::PubSub::V1::PullRequest, ::Hash]
1013
+ # A request object representing the call parameters. Required. To specify no
1014
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1015
+ # @param options [::Gapic::CallOptions, ::Hash]
1016
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1017
+ #
1018
+ # @overload pull(subscription: nil, return_immediately: nil, max_messages: nil)
1019
+ # Pass arguments to `pull` via keyword arguments. Note that at
1020
+ # least one keyword argument is required. To specify no parameters, or to keep all
1021
+ # the default parameter values, pass an empty Hash as a request object (see above).
1022
+ #
1023
+ # @param subscription [::String]
1024
+ # Required. The subscription from which messages should be pulled.
1025
+ # Format is `projects/{project}/subscriptions/{sub}`.
1026
+ # @param return_immediately [::Boolean]
1027
+ # Optional. If this field set to true, the system will respond immediately
1028
+ # even if it there are no messages available to return in the `Pull`
1029
+ # response. Otherwise, the system may wait (for a bounded amount of time)
1030
+ # until at least one message is available, rather than returning no messages.
1031
+ # Warning: setting this field to `true` is discouraged because it adversely
1032
+ # impacts the performance of `Pull` operations. We recommend that users do
1033
+ # not set this field.
1034
+ # @param max_messages [::Integer]
1035
+ # Required. The maximum number of messages to return for this request. Must
1036
+ # be a positive integer. The Pub/Sub system may return fewer than the number
1037
+ # specified.
1038
+ # @yield [result, operation] Access the result along with the TransportOperation object
1039
+ # @yieldparam result [::Google::Cloud::PubSub::V1::PullResponse]
1040
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1041
+ #
1042
+ # @return [::Google::Cloud::PubSub::V1::PullResponse]
1043
+ #
1044
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1045
+ #
1046
+ # @example Basic example
1047
+ # require "google/cloud/pubsub/v1"
1048
+ #
1049
+ # # Create a client object. The client can be reused for multiple calls.
1050
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
1051
+ #
1052
+ # # Create a request. To set request fields, pass in keyword arguments.
1053
+ # request = Google::Cloud::PubSub::V1::PullRequest.new
1054
+ #
1055
+ # # Call the pull method.
1056
+ # result = client.pull request
1057
+ #
1058
+ # # The returned object is of type Google::Cloud::PubSub::V1::PullResponse.
1059
+ # p result
1060
+ #
1061
+ def pull request, options = nil
1062
+ raise ::ArgumentError, "request must be provided" if request.nil?
1063
+
1064
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::PullRequest
1065
+
1066
+ # Converts hash and nil to an options object
1067
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1068
+
1069
+ # Customize the options with defaults
1070
+ call_metadata = @config.rpcs.pull.metadata.to_h
1071
+
1072
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1073
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1074
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1075
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
1076
+ transports_version_send: [:rest]
1077
+
1078
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1079
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1080
+
1081
+ options.apply_defaults timeout: @config.rpcs.pull.timeout,
1082
+ metadata: call_metadata,
1083
+ retry_policy: @config.rpcs.pull.retry_policy
1084
+
1085
+ options.apply_defaults timeout: @config.timeout,
1086
+ metadata: @config.metadata,
1087
+ retry_policy: @config.retry_policy
1088
+
1089
+ @subscription_admin_stub.pull request, options do |result, operation|
1090
+ yield result, operation if block_given?
1091
+ end
1092
+ rescue ::Gapic::Rest::Error => e
1093
+ raise ::Google::Cloud::Error.from_error(e)
1094
+ end
1095
+
1096
+ ##
1097
+ # Modifies the `PushConfig` for a specified subscription.
1098
+ #
1099
+ # This may be used to change a push subscription to a pull one (signified by
1100
+ # an empty `PushConfig`) or vice versa, or change the endpoint URL and other
1101
+ # attributes of a push subscription. Messages will accumulate for delivery
1102
+ # continuously through the call regardless of changes to the `PushConfig`.
1103
+ #
1104
+ # @overload modify_push_config(request, options = nil)
1105
+ # Pass arguments to `modify_push_config` via a request object, either of type
1106
+ # {::Google::Cloud::PubSub::V1::ModifyPushConfigRequest} or an equivalent Hash.
1107
+ #
1108
+ # @param request [::Google::Cloud::PubSub::V1::ModifyPushConfigRequest, ::Hash]
1109
+ # A request object representing the call parameters. Required. To specify no
1110
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1111
+ # @param options [::Gapic::CallOptions, ::Hash]
1112
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1113
+ #
1114
+ # @overload modify_push_config(subscription: nil, push_config: nil)
1115
+ # Pass arguments to `modify_push_config` via keyword arguments. Note that at
1116
+ # least one keyword argument is required. To specify no parameters, or to keep all
1117
+ # the default parameter values, pass an empty Hash as a request object (see above).
1118
+ #
1119
+ # @param subscription [::String]
1120
+ # Required. The name of the subscription.
1121
+ # Format is `projects/{project}/subscriptions/{sub}`.
1122
+ # @param push_config [::Google::Cloud::PubSub::V1::PushConfig, ::Hash]
1123
+ # Required. The push configuration for future deliveries.
1124
+ #
1125
+ # An empty `pushConfig` indicates that the Pub/Sub system should
1126
+ # stop pushing messages from the given subscription and allow
1127
+ # messages to be pulled and acknowledged - effectively pausing
1128
+ # the subscription if `Pull` or `StreamingPull` is not called.
1129
+ # @yield [result, operation] Access the result along with the TransportOperation object
1130
+ # @yieldparam result [::Google::Protobuf::Empty]
1131
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1132
+ #
1133
+ # @return [::Google::Protobuf::Empty]
1134
+ #
1135
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1136
+ #
1137
+ # @example Basic example
1138
+ # require "google/cloud/pubsub/v1"
1139
+ #
1140
+ # # Create a client object. The client can be reused for multiple calls.
1141
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
1142
+ #
1143
+ # # Create a request. To set request fields, pass in keyword arguments.
1144
+ # request = Google::Cloud::PubSub::V1::ModifyPushConfigRequest.new
1145
+ #
1146
+ # # Call the modify_push_config method.
1147
+ # result = client.modify_push_config request
1148
+ #
1149
+ # # The returned object is of type Google::Protobuf::Empty.
1150
+ # p result
1151
+ #
1152
+ def modify_push_config request, options = nil
1153
+ raise ::ArgumentError, "request must be provided" if request.nil?
1154
+
1155
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ModifyPushConfigRequest
1156
+
1157
+ # Converts hash and nil to an options object
1158
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1159
+
1160
+ # Customize the options with defaults
1161
+ call_metadata = @config.rpcs.modify_push_config.metadata.to_h
1162
+
1163
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1164
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1165
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1166
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
1167
+ transports_version_send: [:rest]
1168
+
1169
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1170
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1171
+
1172
+ options.apply_defaults timeout: @config.rpcs.modify_push_config.timeout,
1173
+ metadata: call_metadata,
1174
+ retry_policy: @config.rpcs.modify_push_config.retry_policy
1175
+
1176
+ options.apply_defaults timeout: @config.timeout,
1177
+ metadata: @config.metadata,
1178
+ retry_policy: @config.retry_policy
1179
+
1180
+ @subscription_admin_stub.modify_push_config request, options do |result, operation|
1181
+ yield result, operation if block_given?
1182
+ end
1183
+ rescue ::Gapic::Rest::Error => e
1184
+ raise ::Google::Cloud::Error.from_error(e)
1185
+ end
1186
+
1187
+ ##
1188
+ # Gets the configuration details of a snapshot. Snapshots are used in
1189
+ # [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
1190
+ # which allow you to manage message acknowledgments in bulk. That is, you can
1191
+ # set the acknowledgment state of messages in an existing subscription to the
1192
+ # state captured by a snapshot.
1193
+ #
1194
+ # @overload get_snapshot(request, options = nil)
1195
+ # Pass arguments to `get_snapshot` via a request object, either of type
1196
+ # {::Google::Cloud::PubSub::V1::GetSnapshotRequest} or an equivalent Hash.
1197
+ #
1198
+ # @param request [::Google::Cloud::PubSub::V1::GetSnapshotRequest, ::Hash]
1199
+ # A request object representing the call parameters. Required. To specify no
1200
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1201
+ # @param options [::Gapic::CallOptions, ::Hash]
1202
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1203
+ #
1204
+ # @overload get_snapshot(snapshot: nil)
1205
+ # Pass arguments to `get_snapshot` via keyword arguments. Note that at
1206
+ # least one keyword argument is required. To specify no parameters, or to keep all
1207
+ # the default parameter values, pass an empty Hash as a request object (see above).
1208
+ #
1209
+ # @param snapshot [::String]
1210
+ # Required. The name of the snapshot to get.
1211
+ # Format is `projects/{project}/snapshots/{snap}`.
1212
+ # @yield [result, operation] Access the result along with the TransportOperation object
1213
+ # @yieldparam result [::Google::Cloud::PubSub::V1::Snapshot]
1214
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1215
+ #
1216
+ # @return [::Google::Cloud::PubSub::V1::Snapshot]
1217
+ #
1218
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1219
+ #
1220
+ # @example Basic example
1221
+ # require "google/cloud/pubsub/v1"
1222
+ #
1223
+ # # Create a client object. The client can be reused for multiple calls.
1224
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
1225
+ #
1226
+ # # Create a request. To set request fields, pass in keyword arguments.
1227
+ # request = Google::Cloud::PubSub::V1::GetSnapshotRequest.new
1228
+ #
1229
+ # # Call the get_snapshot method.
1230
+ # result = client.get_snapshot request
1231
+ #
1232
+ # # The returned object is of type Google::Cloud::PubSub::V1::Snapshot.
1233
+ # p result
1234
+ #
1235
+ def get_snapshot request, options = nil
1236
+ raise ::ArgumentError, "request must be provided" if request.nil?
1237
+
1238
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::GetSnapshotRequest
1239
+
1240
+ # Converts hash and nil to an options object
1241
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1242
+
1243
+ # Customize the options with defaults
1244
+ call_metadata = @config.rpcs.get_snapshot.metadata.to_h
1245
+
1246
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1247
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1248
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1249
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
1250
+ transports_version_send: [:rest]
1251
+
1252
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1253
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1254
+
1255
+ options.apply_defaults timeout: @config.rpcs.get_snapshot.timeout,
1256
+ metadata: call_metadata,
1257
+ retry_policy: @config.rpcs.get_snapshot.retry_policy
1258
+
1259
+ options.apply_defaults timeout: @config.timeout,
1260
+ metadata: @config.metadata,
1261
+ retry_policy: @config.retry_policy
1262
+
1263
+ @subscription_admin_stub.get_snapshot request, options do |result, operation|
1264
+ yield result, operation if block_given?
1265
+ end
1266
+ rescue ::Gapic::Rest::Error => e
1267
+ raise ::Google::Cloud::Error.from_error(e)
1268
+ end
1269
+
1270
+ ##
1271
+ # Lists the existing snapshots. Snapshots are used in [Seek](
1272
+ # https://cloud.google.com/pubsub/docs/replay-overview) operations, which
1273
+ # allow you to manage message acknowledgments in bulk. That is, you can set
1274
+ # the acknowledgment state of messages in an existing subscription to the
1275
+ # state captured by a snapshot.
1276
+ #
1277
+ # @overload list_snapshots(request, options = nil)
1278
+ # Pass arguments to `list_snapshots` via a request object, either of type
1279
+ # {::Google::Cloud::PubSub::V1::ListSnapshotsRequest} or an equivalent Hash.
1280
+ #
1281
+ # @param request [::Google::Cloud::PubSub::V1::ListSnapshotsRequest, ::Hash]
1282
+ # A request object representing the call parameters. Required. To specify no
1283
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1284
+ # @param options [::Gapic::CallOptions, ::Hash]
1285
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1286
+ #
1287
+ # @overload list_snapshots(project: nil, page_size: nil, page_token: nil)
1288
+ # Pass arguments to `list_snapshots` via keyword arguments. Note that at
1289
+ # least one keyword argument is required. To specify no parameters, or to keep all
1290
+ # the default parameter values, pass an empty Hash as a request object (see above).
1291
+ #
1292
+ # @param project [::String]
1293
+ # Required. The name of the project in which to list snapshots.
1294
+ # Format is `projects/{project-id}`.
1295
+ # @param page_size [::Integer]
1296
+ # Optional. Maximum number of snapshots to return.
1297
+ # @param page_token [::String]
1298
+ # Optional. The value returned by the last `ListSnapshotsResponse`; indicates
1299
+ # that this is a continuation of a prior `ListSnapshots` call, and that the
1300
+ # system should return the next page of data.
1301
+ # @yield [result, operation] Access the result along with the TransportOperation object
1302
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PubSub::V1::Snapshot>]
1303
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1304
+ #
1305
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PubSub::V1::Snapshot>]
1306
+ #
1307
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1308
+ #
1309
+ # @example Basic example
1310
+ # require "google/cloud/pubsub/v1"
1311
+ #
1312
+ # # Create a client object. The client can be reused for multiple calls.
1313
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
1314
+ #
1315
+ # # Create a request. To set request fields, pass in keyword arguments.
1316
+ # request = Google::Cloud::PubSub::V1::ListSnapshotsRequest.new
1317
+ #
1318
+ # # Call the list_snapshots method.
1319
+ # result = client.list_snapshots request
1320
+ #
1321
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
1322
+ # # over elements, and API calls will be issued to fetch pages as needed.
1323
+ # result.each do |item|
1324
+ # # Each element is of type ::Google::Cloud::PubSub::V1::Snapshot.
1325
+ # p item
1326
+ # end
1327
+ #
1328
+ def list_snapshots request, options = nil
1329
+ raise ::ArgumentError, "request must be provided" if request.nil?
1330
+
1331
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListSnapshotsRequest
1332
+
1333
+ # Converts hash and nil to an options object
1334
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1335
+
1336
+ # Customize the options with defaults
1337
+ call_metadata = @config.rpcs.list_snapshots.metadata.to_h
1338
+
1339
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1340
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1341
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1342
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
1343
+ transports_version_send: [:rest]
1344
+
1345
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1346
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1347
+
1348
+ options.apply_defaults timeout: @config.rpcs.list_snapshots.timeout,
1349
+ metadata: call_metadata,
1350
+ retry_policy: @config.rpcs.list_snapshots.retry_policy
1351
+
1352
+ options.apply_defaults timeout: @config.timeout,
1353
+ metadata: @config.metadata,
1354
+ retry_policy: @config.retry_policy
1355
+
1356
+ @subscription_admin_stub.list_snapshots request, options do |result, operation|
1357
+ result = ::Gapic::Rest::PagedEnumerable.new @subscription_admin_stub, :list_snapshots, "snapshots", request, result, options
1358
+ yield result, operation if block_given?
1359
+ throw :response, result
1360
+ end
1361
+ rescue ::Gapic::Rest::Error => e
1362
+ raise ::Google::Cloud::Error.from_error(e)
1363
+ end
1364
+
1365
+ ##
1366
+ # Creates a snapshot from the requested subscription. Snapshots are used in
1367
+ # [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
1368
+ # which allow you to manage message acknowledgments in bulk. That is, you can
1369
+ # set the acknowledgment state of messages in an existing subscription to the
1370
+ # state captured by a snapshot.
1371
+ # If the snapshot already exists, returns `ALREADY_EXISTS`.
1372
+ # If the requested subscription doesn't exist, returns `NOT_FOUND`.
1373
+ # If the backlog in the subscription is too old -- and the resulting snapshot
1374
+ # would expire in less than 1 hour -- then `FAILED_PRECONDITION` is returned.
1375
+ # See also the `Snapshot.expire_time` field. If the name is not provided in
1376
+ # the request, the server will assign a random
1377
+ # name for this snapshot on the same project as the subscription, conforming
1378
+ # to the [resource name format]
1379
+ # (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names). The
1380
+ # generated name is populated in the returned Snapshot object. Note that for
1381
+ # REST API requests, you must specify a name in the request.
1382
+ #
1383
+ # @overload create_snapshot(request, options = nil)
1384
+ # Pass arguments to `create_snapshot` via a request object, either of type
1385
+ # {::Google::Cloud::PubSub::V1::CreateSnapshotRequest} or an equivalent Hash.
1386
+ #
1387
+ # @param request [::Google::Cloud::PubSub::V1::CreateSnapshotRequest, ::Hash]
1388
+ # A request object representing the call parameters. Required. To specify no
1389
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1390
+ # @param options [::Gapic::CallOptions, ::Hash]
1391
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1392
+ #
1393
+ # @overload create_snapshot(name: nil, subscription: nil, labels: nil, tags: nil)
1394
+ # Pass arguments to `create_snapshot` via keyword arguments. Note that at
1395
+ # least one keyword argument is required. To specify no parameters, or to keep all
1396
+ # the default parameter values, pass an empty Hash as a request object (see above).
1397
+ #
1398
+ # @param name [::String]
1399
+ # Required. User-provided name for this snapshot. If the name is not provided
1400
+ # in the request, the server will assign a random name for this snapshot on
1401
+ # the same project as the subscription. Note that for REST API requests, you
1402
+ # must specify a name. See the [resource name
1403
+ # rules](https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
1404
+ # Format is `projects/{project}/snapshots/{snap}`.
1405
+ # @param subscription [::String]
1406
+ # Required. The subscription whose backlog the snapshot retains.
1407
+ # Specifically, the created snapshot is guaranteed to retain:
1408
+ # (a) The existing backlog on the subscription. More precisely, this is
1409
+ # defined as the messages in the subscription's backlog that are
1410
+ # unacknowledged upon the successful completion of the
1411
+ # `CreateSnapshot` request; as well as:
1412
+ # (b) Any messages published to the subscription's topic following the
1413
+ # successful completion of the CreateSnapshot request.
1414
+ # Format is `projects/{project}/subscriptions/{sub}`.
1415
+ # @param labels [::Hash{::String => ::String}]
1416
+ # Optional. See [Creating and managing
1417
+ # labels](https://cloud.google.com/pubsub/docs/labels).
1418
+ # @param tags [::Hash{::String => ::String}]
1419
+ # Optional. Input only. Immutable. Tag keys/values directly bound to this
1420
+ # resource. For example:
1421
+ # "123/environment": "production",
1422
+ # "123/costCenter": "marketing"
1423
+ # See
1424
+ # https://\\{$universe.dns_names.final_documentation_domain}/pubsub/docs/tags
1425
+ # for more information on using tags with Pub/Sub resources.
1426
+ # @yield [result, operation] Access the result along with the TransportOperation object
1427
+ # @yieldparam result [::Google::Cloud::PubSub::V1::Snapshot]
1428
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1429
+ #
1430
+ # @return [::Google::Cloud::PubSub::V1::Snapshot]
1431
+ #
1432
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1433
+ #
1434
+ # @example Basic example
1435
+ # require "google/cloud/pubsub/v1"
1436
+ #
1437
+ # # Create a client object. The client can be reused for multiple calls.
1438
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
1439
+ #
1440
+ # # Create a request. To set request fields, pass in keyword arguments.
1441
+ # request = Google::Cloud::PubSub::V1::CreateSnapshotRequest.new
1442
+ #
1443
+ # # Call the create_snapshot method.
1444
+ # result = client.create_snapshot request
1445
+ #
1446
+ # # The returned object is of type Google::Cloud::PubSub::V1::Snapshot.
1447
+ # p result
1448
+ #
1449
+ def create_snapshot request, options = nil
1450
+ raise ::ArgumentError, "request must be provided" if request.nil?
1451
+
1452
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::CreateSnapshotRequest
1453
+
1454
+ # Converts hash and nil to an options object
1455
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1456
+
1457
+ # Customize the options with defaults
1458
+ call_metadata = @config.rpcs.create_snapshot.metadata.to_h
1459
+
1460
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1461
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1462
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1463
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
1464
+ transports_version_send: [:rest]
1465
+
1466
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1467
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1468
+
1469
+ options.apply_defaults timeout: @config.rpcs.create_snapshot.timeout,
1470
+ metadata: call_metadata,
1471
+ retry_policy: @config.rpcs.create_snapshot.retry_policy
1472
+
1473
+ options.apply_defaults timeout: @config.timeout,
1474
+ metadata: @config.metadata,
1475
+ retry_policy: @config.retry_policy
1476
+
1477
+ @subscription_admin_stub.create_snapshot request, options do |result, operation|
1478
+ yield result, operation if block_given?
1479
+ end
1480
+ rescue ::Gapic::Rest::Error => e
1481
+ raise ::Google::Cloud::Error.from_error(e)
1482
+ end
1483
+
1484
+ ##
1485
+ # Updates an existing snapshot by updating the fields specified in the update
1486
+ # mask. Snapshots are used in
1487
+ # [Seek](https://cloud.google.com/pubsub/docs/replay-overview) operations,
1488
+ # which allow you to manage message acknowledgments in bulk. That is, you can
1489
+ # set the acknowledgment state of messages in an existing subscription to the
1490
+ # state captured by a snapshot.
1491
+ #
1492
+ # @overload update_snapshot(request, options = nil)
1493
+ # Pass arguments to `update_snapshot` via a request object, either of type
1494
+ # {::Google::Cloud::PubSub::V1::UpdateSnapshotRequest} or an equivalent Hash.
1495
+ #
1496
+ # @param request [::Google::Cloud::PubSub::V1::UpdateSnapshotRequest, ::Hash]
1497
+ # A request object representing the call parameters. Required. To specify no
1498
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1499
+ # @param options [::Gapic::CallOptions, ::Hash]
1500
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1501
+ #
1502
+ # @overload update_snapshot(snapshot: nil, update_mask: nil)
1503
+ # Pass arguments to `update_snapshot` via keyword arguments. Note that at
1504
+ # least one keyword argument is required. To specify no parameters, or to keep all
1505
+ # the default parameter values, pass an empty Hash as a request object (see above).
1506
+ #
1507
+ # @param snapshot [::Google::Cloud::PubSub::V1::Snapshot, ::Hash]
1508
+ # Required. The updated snapshot object.
1509
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
1510
+ # Required. Indicates which fields in the provided snapshot to update.
1511
+ # Must be specified and non-empty.
1512
+ # @yield [result, operation] Access the result along with the TransportOperation object
1513
+ # @yieldparam result [::Google::Cloud::PubSub::V1::Snapshot]
1514
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1515
+ #
1516
+ # @return [::Google::Cloud::PubSub::V1::Snapshot]
1517
+ #
1518
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1519
+ #
1520
+ # @example Basic example
1521
+ # require "google/cloud/pubsub/v1"
1522
+ #
1523
+ # # Create a client object. The client can be reused for multiple calls.
1524
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
1525
+ #
1526
+ # # Create a request. To set request fields, pass in keyword arguments.
1527
+ # request = Google::Cloud::PubSub::V1::UpdateSnapshotRequest.new
1528
+ #
1529
+ # # Call the update_snapshot method.
1530
+ # result = client.update_snapshot request
1531
+ #
1532
+ # # The returned object is of type Google::Cloud::PubSub::V1::Snapshot.
1533
+ # p result
1534
+ #
1535
+ def update_snapshot request, options = nil
1536
+ raise ::ArgumentError, "request must be provided" if request.nil?
1537
+
1538
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::UpdateSnapshotRequest
1539
+
1540
+ # Converts hash and nil to an options object
1541
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1542
+
1543
+ # Customize the options with defaults
1544
+ call_metadata = @config.rpcs.update_snapshot.metadata.to_h
1545
+
1546
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1547
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1548
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1549
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
1550
+ transports_version_send: [:rest]
1551
+
1552
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1553
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1554
+
1555
+ options.apply_defaults timeout: @config.rpcs.update_snapshot.timeout,
1556
+ metadata: call_metadata,
1557
+ retry_policy: @config.rpcs.update_snapshot.retry_policy
1558
+
1559
+ options.apply_defaults timeout: @config.timeout,
1560
+ metadata: @config.metadata,
1561
+ retry_policy: @config.retry_policy
1562
+
1563
+ @subscription_admin_stub.update_snapshot request, options do |result, operation|
1564
+ yield result, operation if block_given?
1565
+ end
1566
+ rescue ::Gapic::Rest::Error => e
1567
+ raise ::Google::Cloud::Error.from_error(e)
1568
+ end
1569
+
1570
+ ##
1571
+ # Removes an existing snapshot. Snapshots are used in [Seek]
1572
+ # (https://cloud.google.com/pubsub/docs/replay-overview) operations, which
1573
+ # allow you to manage message acknowledgments in bulk. That is, you can set
1574
+ # the acknowledgment state of messages in an existing subscription to the
1575
+ # state captured by a snapshot.
1576
+ # When the snapshot is deleted, all messages retained in the snapshot
1577
+ # are immediately dropped. After a snapshot is deleted, a new one may be
1578
+ # created with the same name, but the new one has no association with the old
1579
+ # snapshot or its subscription, unless the same subscription is specified.
1580
+ #
1581
+ # @overload delete_snapshot(request, options = nil)
1582
+ # Pass arguments to `delete_snapshot` via a request object, either of type
1583
+ # {::Google::Cloud::PubSub::V1::DeleteSnapshotRequest} or an equivalent Hash.
1584
+ #
1585
+ # @param request [::Google::Cloud::PubSub::V1::DeleteSnapshotRequest, ::Hash]
1586
+ # A request object representing the call parameters. Required. To specify no
1587
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1588
+ # @param options [::Gapic::CallOptions, ::Hash]
1589
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1590
+ #
1591
+ # @overload delete_snapshot(snapshot: nil)
1592
+ # Pass arguments to `delete_snapshot` via keyword arguments. Note that at
1593
+ # least one keyword argument is required. To specify no parameters, or to keep all
1594
+ # the default parameter values, pass an empty Hash as a request object (see above).
1595
+ #
1596
+ # @param snapshot [::String]
1597
+ # Required. The name of the snapshot to delete.
1598
+ # Format is `projects/{project}/snapshots/{snap}`.
1599
+ # @yield [result, operation] Access the result along with the TransportOperation object
1600
+ # @yieldparam result [::Google::Protobuf::Empty]
1601
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1602
+ #
1603
+ # @return [::Google::Protobuf::Empty]
1604
+ #
1605
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
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::SubscriptionAdmin::Rest::Client.new
1612
+ #
1613
+ # # Create a request. To set request fields, pass in keyword arguments.
1614
+ # request = Google::Cloud::PubSub::V1::DeleteSnapshotRequest.new
1615
+ #
1616
+ # # Call the delete_snapshot method.
1617
+ # result = client.delete_snapshot request
1618
+ #
1619
+ # # The returned object is of type Google::Protobuf::Empty.
1620
+ # p result
1621
+ #
1622
+ def delete_snapshot request, options = nil
1623
+ raise ::ArgumentError, "request must be provided" if request.nil?
1624
+
1625
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::DeleteSnapshotRequest
1626
+
1627
+ # Converts hash and nil to an options object
1628
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1629
+
1630
+ # Customize the options with defaults
1631
+ call_metadata = @config.rpcs.delete_snapshot.metadata.to_h
1632
+
1633
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1634
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1635
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1636
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
1637
+ transports_version_send: [:rest]
1638
+
1639
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1640
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1641
+
1642
+ options.apply_defaults timeout: @config.rpcs.delete_snapshot.timeout,
1643
+ metadata: call_metadata,
1644
+ retry_policy: @config.rpcs.delete_snapshot.retry_policy
1645
+
1646
+ options.apply_defaults timeout: @config.timeout,
1647
+ metadata: @config.metadata,
1648
+ retry_policy: @config.retry_policy
1649
+
1650
+ @subscription_admin_stub.delete_snapshot request, options do |result, operation|
1651
+ yield result, operation if block_given?
1652
+ end
1653
+ rescue ::Gapic::Rest::Error => e
1654
+ raise ::Google::Cloud::Error.from_error(e)
1655
+ end
1656
+
1657
+ ##
1658
+ # Seeks an existing subscription to a point in time or to a given snapshot,
1659
+ # whichever is provided in the request. Snapshots are used in [Seek]
1660
+ # (https://cloud.google.com/pubsub/docs/replay-overview) operations, which
1661
+ # allow you to manage message acknowledgments in bulk. That is, you can set
1662
+ # the acknowledgment state of messages in an existing subscription to the
1663
+ # state captured by a snapshot. Note that both the subscription and the
1664
+ # snapshot must be on the same topic.
1665
+ #
1666
+ # @overload seek(request, options = nil)
1667
+ # Pass arguments to `seek` via a request object, either of type
1668
+ # {::Google::Cloud::PubSub::V1::SeekRequest} or an equivalent Hash.
1669
+ #
1670
+ # @param request [::Google::Cloud::PubSub::V1::SeekRequest, ::Hash]
1671
+ # A request object representing the call parameters. Required. To specify no
1672
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
1673
+ # @param options [::Gapic::CallOptions, ::Hash]
1674
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
1675
+ #
1676
+ # @overload seek(subscription: nil, time: nil, snapshot: nil)
1677
+ # Pass arguments to `seek` via keyword arguments. Note that at
1678
+ # least one keyword argument is required. To specify no parameters, or to keep all
1679
+ # the default parameter values, pass an empty Hash as a request object (see above).
1680
+ #
1681
+ # @param subscription [::String]
1682
+ # Required. The subscription to affect.
1683
+ # @param time [::Google::Protobuf::Timestamp, ::Hash]
1684
+ # Optional. The time to seek to.
1685
+ # Messages retained in the subscription that were published before this
1686
+ # time are marked as acknowledged, and messages retained in the
1687
+ # subscription that were published after this time are marked as
1688
+ # unacknowledged. Note that this operation affects only those messages
1689
+ # retained in the subscription (configured by the combination of
1690
+ # `message_retention_duration` and `retain_acked_messages`). For example,
1691
+ # if `time` corresponds to a point before the message retention
1692
+ # window (or to a point before the system's notion of the subscription
1693
+ # creation time), only retained messages will be marked as unacknowledged,
1694
+ # and already-expunged messages will not be restored.
1695
+ #
1696
+ # Note: The following parameters are mutually exclusive: `time`, `snapshot`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
1697
+ # @param snapshot [::String]
1698
+ # Optional. The snapshot to seek to. The snapshot's topic must be the same
1699
+ # as that of the provided subscription. Format is
1700
+ # `projects/{project}/snapshots/{snap}`.
1701
+ #
1702
+ # Note: The following parameters are mutually exclusive: `snapshot`, `time`. At most one of these parameters can be set. If more than one is set, only one will be used, and it is not defined which one.
1703
+ # @yield [result, operation] Access the result along with the TransportOperation object
1704
+ # @yieldparam result [::Google::Cloud::PubSub::V1::SeekResponse]
1705
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
1706
+ #
1707
+ # @return [::Google::Cloud::PubSub::V1::SeekResponse]
1708
+ #
1709
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
1710
+ #
1711
+ # @example Basic example
1712
+ # require "google/cloud/pubsub/v1"
1713
+ #
1714
+ # # Create a client object. The client can be reused for multiple calls.
1715
+ # client = Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new
1716
+ #
1717
+ # # Create a request. To set request fields, pass in keyword arguments.
1718
+ # request = Google::Cloud::PubSub::V1::SeekRequest.new
1719
+ #
1720
+ # # Call the seek method.
1721
+ # result = client.seek request
1722
+ #
1723
+ # # The returned object is of type Google::Cloud::PubSub::V1::SeekResponse.
1724
+ # p result
1725
+ #
1726
+ def seek request, options = nil
1727
+ raise ::ArgumentError, "request must be provided" if request.nil?
1728
+
1729
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::SeekRequest
1730
+
1731
+ # Converts hash and nil to an options object
1732
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
1733
+
1734
+ # Customize the options with defaults
1735
+ call_metadata = @config.rpcs.seek.metadata.to_h
1736
+
1737
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1738
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1739
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
1740
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
1741
+ transports_version_send: [:rest]
1742
+
1743
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1744
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1745
+
1746
+ options.apply_defaults timeout: @config.rpcs.seek.timeout,
1747
+ metadata: call_metadata,
1748
+ retry_policy: @config.rpcs.seek.retry_policy
1749
+
1750
+ options.apply_defaults timeout: @config.timeout,
1751
+ metadata: @config.metadata,
1752
+ retry_policy: @config.retry_policy
1753
+
1754
+ @subscription_admin_stub.seek request, options do |result, operation|
1755
+ yield result, operation if block_given?
1756
+ end
1757
+ rescue ::Gapic::Rest::Error => e
1758
+ raise ::Google::Cloud::Error.from_error(e)
1759
+ end
1760
+
1761
+ ##
1762
+ # Configuration class for the SubscriptionAdmin REST API.
1763
+ #
1764
+ # This class represents the configuration for SubscriptionAdmin REST,
1765
+ # providing control over timeouts, retry behavior, logging, transport
1766
+ # parameters, and other low-level controls. Certain parameters can also be
1767
+ # applied individually to specific RPCs. See
1768
+ # {::Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client::Configuration::Rpcs}
1769
+ # for a list of RPCs that can be configured independently.
1770
+ #
1771
+ # Configuration can be applied globally to all clients, or to a single client
1772
+ # on construction.
1773
+ #
1774
+ # @example
1775
+ #
1776
+ # # Modify the global config, setting the timeout for
1777
+ # # create_subscription to 20 seconds,
1778
+ # # and all remaining timeouts to 10 seconds.
1779
+ # ::Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.configure do |config|
1780
+ # config.timeout = 10.0
1781
+ # config.rpcs.create_subscription.timeout = 20.0
1782
+ # end
1783
+ #
1784
+ # # Apply the above configuration only to a new client.
1785
+ # client = ::Google::Cloud::PubSub::V1::SubscriptionAdmin::Rest::Client.new do |config|
1786
+ # config.timeout = 10.0
1787
+ # config.rpcs.create_subscription.timeout = 20.0
1788
+ # end
1789
+ #
1790
+ # @!attribute [rw] endpoint
1791
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1792
+ # nil, indicating to use the default endpoint in the current universe domain.
1793
+ # @return [::String,nil]
1794
+ # @!attribute [rw] credentials
1795
+ # Credentials to send with calls. You may provide any of the following types:
1796
+ # * (`String`) The path to a service account key file in JSON format
1797
+ # * (`Hash`) A service account key as a Hash
1798
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
1799
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1800
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1801
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1802
+ # * (`nil`) indicating no credentials
1803
+ #
1804
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1805
+ # external source for authentication to Google Cloud, you must validate it before
1806
+ # providing it to a Google API client library. Providing an unvalidated credential
1807
+ # configuration to Google APIs can compromise the security of your systems and data.
1808
+ # For more information, refer to [Validate credential configurations from external
1809
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1810
+ # @return [::Object]
1811
+ # @!attribute [rw] scope
1812
+ # The OAuth scopes
1813
+ # @return [::Array<::String>]
1814
+ # @!attribute [rw] lib_name
1815
+ # The library name as recorded in instrumentation and logging
1816
+ # @return [::String]
1817
+ # @!attribute [rw] lib_version
1818
+ # The library version as recorded in instrumentation and logging
1819
+ # @return [::String]
1820
+ # @!attribute [rw] timeout
1821
+ # The call timeout in seconds.
1822
+ # @return [::Numeric]
1823
+ # @!attribute [rw] metadata
1824
+ # Additional headers to be sent with the call.
1825
+ # @return [::Hash{::Symbol=>::String}]
1826
+ # @!attribute [rw] retry_policy
1827
+ # The retry policy. The value is a hash with the following keys:
1828
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1829
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1830
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1831
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
1832
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1833
+ # trigger a retry.
1834
+ # @return [::Hash]
1835
+ # @!attribute [rw] quota_project
1836
+ # A separate project against which to charge quota.
1837
+ # @return [::String]
1838
+ # @!attribute [rw] universe_domain
1839
+ # The universe domain within which to make requests. This determines the
1840
+ # default endpoint URL. The default value of nil uses the environment
1841
+ # universe (usually the default "googleapis.com" universe).
1842
+ # @return [::String,nil]
1843
+ # @!attribute [rw] logger
1844
+ # A custom logger to use for request/response debug logging, or the value
1845
+ # `:default` (the default) to construct a default logger, or `nil` to
1846
+ # explicitly disable logging.
1847
+ # @return [::Logger,:default,nil]
1848
+ #
1849
+ class Configuration
1850
+ extend ::Gapic::Config
1851
+
1852
+ # @private
1853
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1854
+ DEFAULT_ENDPOINT = "pubsub.googleapis.com"
1855
+
1856
+ config_attr :endpoint, nil, ::String, nil
1857
+ config_attr :credentials, nil do |value|
1858
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1859
+ allowed.any? { |klass| klass === value }
1860
+ end
1861
+ config_attr :scope, nil, ::String, ::Array, nil
1862
+ config_attr :lib_name, nil, ::String, nil
1863
+ config_attr :lib_version, nil, ::String, nil
1864
+ config_attr :timeout, nil, ::Numeric, nil
1865
+ config_attr :metadata, nil, ::Hash, nil
1866
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1867
+ config_attr :quota_project, nil, ::String, nil
1868
+ config_attr :universe_domain, nil, ::String, nil
1869
+
1870
+ # @private
1871
+ # Overrides for http bindings for the RPCs of this service
1872
+ # are only used when this service is used as mixin, and only
1873
+ # by the host service.
1874
+ # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
1875
+ config_attr :bindings_override, {}, ::Hash, nil
1876
+ config_attr :logger, :default, ::Logger, nil, :default
1877
+
1878
+ # @private
1879
+ def initialize parent_config = nil
1880
+ @parent_config = parent_config unless parent_config.nil?
1881
+
1882
+ yield self if block_given?
1883
+ end
1884
+
1885
+ ##
1886
+ # Configurations for individual RPCs
1887
+ # @return [Rpcs]
1888
+ #
1889
+ def rpcs
1890
+ @rpcs ||= begin
1891
+ parent_rpcs = nil
1892
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
1893
+ Rpcs.new parent_rpcs
1894
+ end
1895
+ end
1896
+
1897
+ ##
1898
+ # Configuration RPC class for the SubscriptionAdmin API.
1899
+ #
1900
+ # Includes fields providing the configuration for each RPC in this service.
1901
+ # Each configuration object is of type `Gapic::Config::Method` and includes
1902
+ # the following configuration fields:
1903
+ #
1904
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1905
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
1906
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1907
+ # include the following keys:
1908
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
1909
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
1910
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
1911
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
1912
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
1913
+ # trigger a retry.
1914
+ #
1915
+ class Rpcs
1916
+ ##
1917
+ # RPC-specific configuration for `create_subscription`
1918
+ # @return [::Gapic::Config::Method]
1919
+ #
1920
+ attr_reader :create_subscription
1921
+ ##
1922
+ # RPC-specific configuration for `get_subscription`
1923
+ # @return [::Gapic::Config::Method]
1924
+ #
1925
+ attr_reader :get_subscription
1926
+ ##
1927
+ # RPC-specific configuration for `update_subscription`
1928
+ # @return [::Gapic::Config::Method]
1929
+ #
1930
+ attr_reader :update_subscription
1931
+ ##
1932
+ # RPC-specific configuration for `list_subscriptions`
1933
+ # @return [::Gapic::Config::Method]
1934
+ #
1935
+ attr_reader :list_subscriptions
1936
+ ##
1937
+ # RPC-specific configuration for `delete_subscription`
1938
+ # @return [::Gapic::Config::Method]
1939
+ #
1940
+ attr_reader :delete_subscription
1941
+ ##
1942
+ # RPC-specific configuration for `modify_ack_deadline`
1943
+ # @return [::Gapic::Config::Method]
1944
+ #
1945
+ attr_reader :modify_ack_deadline
1946
+ ##
1947
+ # RPC-specific configuration for `acknowledge`
1948
+ # @return [::Gapic::Config::Method]
1949
+ #
1950
+ attr_reader :acknowledge
1951
+ ##
1952
+ # RPC-specific configuration for `pull`
1953
+ # @return [::Gapic::Config::Method]
1954
+ #
1955
+ attr_reader :pull
1956
+ ##
1957
+ # RPC-specific configuration for `modify_push_config`
1958
+ # @return [::Gapic::Config::Method]
1959
+ #
1960
+ attr_reader :modify_push_config
1961
+ ##
1962
+ # RPC-specific configuration for `get_snapshot`
1963
+ # @return [::Gapic::Config::Method]
1964
+ #
1965
+ attr_reader :get_snapshot
1966
+ ##
1967
+ # RPC-specific configuration for `list_snapshots`
1968
+ # @return [::Gapic::Config::Method]
1969
+ #
1970
+ attr_reader :list_snapshots
1971
+ ##
1972
+ # RPC-specific configuration for `create_snapshot`
1973
+ # @return [::Gapic::Config::Method]
1974
+ #
1975
+ attr_reader :create_snapshot
1976
+ ##
1977
+ # RPC-specific configuration for `update_snapshot`
1978
+ # @return [::Gapic::Config::Method]
1979
+ #
1980
+ attr_reader :update_snapshot
1981
+ ##
1982
+ # RPC-specific configuration for `delete_snapshot`
1983
+ # @return [::Gapic::Config::Method]
1984
+ #
1985
+ attr_reader :delete_snapshot
1986
+ ##
1987
+ # RPC-specific configuration for `seek`
1988
+ # @return [::Gapic::Config::Method]
1989
+ #
1990
+ attr_reader :seek
1991
+
1992
+ # @private
1993
+ def initialize parent_rpcs = nil
1994
+ create_subscription_config = parent_rpcs.create_subscription if parent_rpcs.respond_to? :create_subscription
1995
+ @create_subscription = ::Gapic::Config::Method.new create_subscription_config
1996
+ get_subscription_config = parent_rpcs.get_subscription if parent_rpcs.respond_to? :get_subscription
1997
+ @get_subscription = ::Gapic::Config::Method.new get_subscription_config
1998
+ update_subscription_config = parent_rpcs.update_subscription if parent_rpcs.respond_to? :update_subscription
1999
+ @update_subscription = ::Gapic::Config::Method.new update_subscription_config
2000
+ list_subscriptions_config = parent_rpcs.list_subscriptions if parent_rpcs.respond_to? :list_subscriptions
2001
+ @list_subscriptions = ::Gapic::Config::Method.new list_subscriptions_config
2002
+ delete_subscription_config = parent_rpcs.delete_subscription if parent_rpcs.respond_to? :delete_subscription
2003
+ @delete_subscription = ::Gapic::Config::Method.new delete_subscription_config
2004
+ modify_ack_deadline_config = parent_rpcs.modify_ack_deadline if parent_rpcs.respond_to? :modify_ack_deadline
2005
+ @modify_ack_deadline = ::Gapic::Config::Method.new modify_ack_deadline_config
2006
+ acknowledge_config = parent_rpcs.acknowledge if parent_rpcs.respond_to? :acknowledge
2007
+ @acknowledge = ::Gapic::Config::Method.new acknowledge_config
2008
+ pull_config = parent_rpcs.pull if parent_rpcs.respond_to? :pull
2009
+ @pull = ::Gapic::Config::Method.new pull_config
2010
+ modify_push_config_config = parent_rpcs.modify_push_config if parent_rpcs.respond_to? :modify_push_config
2011
+ @modify_push_config = ::Gapic::Config::Method.new modify_push_config_config
2012
+ get_snapshot_config = parent_rpcs.get_snapshot if parent_rpcs.respond_to? :get_snapshot
2013
+ @get_snapshot = ::Gapic::Config::Method.new get_snapshot_config
2014
+ list_snapshots_config = parent_rpcs.list_snapshots if parent_rpcs.respond_to? :list_snapshots
2015
+ @list_snapshots = ::Gapic::Config::Method.new list_snapshots_config
2016
+ create_snapshot_config = parent_rpcs.create_snapshot if parent_rpcs.respond_to? :create_snapshot
2017
+ @create_snapshot = ::Gapic::Config::Method.new create_snapshot_config
2018
+ update_snapshot_config = parent_rpcs.update_snapshot if parent_rpcs.respond_to? :update_snapshot
2019
+ @update_snapshot = ::Gapic::Config::Method.new update_snapshot_config
2020
+ delete_snapshot_config = parent_rpcs.delete_snapshot if parent_rpcs.respond_to? :delete_snapshot
2021
+ @delete_snapshot = ::Gapic::Config::Method.new delete_snapshot_config
2022
+ seek_config = parent_rpcs.seek if parent_rpcs.respond_to? :seek
2023
+ @seek = ::Gapic::Config::Method.new seek_config
2024
+
2025
+ yield self if block_given?
2026
+ end
2027
+ end
2028
+ end
2029
+ end
2030
+ end
2031
+ end
2032
+ end
2033
+ end
2034
+ end
2035
+ end