google-cloud-pubsub-v1 0.11.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +72 -101
  3. data/README.md +32 -22
  4. data/lib/google/cloud/pubsub/v1/{publisher/helpers.rb → _helpers.rb} +4 -10
  5. data/lib/google/cloud/pubsub/v1/iam_policy/client.rb +33 -337
  6. data/lib/google/cloud/pubsub/v1/iam_policy/credentials.rb +6 -2
  7. data/lib/google/cloud/pubsub/v1/iam_policy.rb +5 -31
  8. data/lib/google/cloud/pubsub/v1/publisher/credentials.rb +2 -37
  9. data/lib/google/cloud/pubsub/v1/publisher.rb +2 -35
  10. data/lib/google/cloud/pubsub/v1/schema_service/client.rb +571 -35
  11. data/lib/google/cloud/pubsub/v1/schema_service.rb +1 -1
  12. data/lib/google/cloud/pubsub/v1/subscriber/credentials.rb +2 -37
  13. data/lib/google/cloud/pubsub/v1/subscriber.rb +2 -36
  14. data/lib/google/cloud/pubsub/v1/{subscriber → subscription_admin}/client.rb +299 -208
  15. data/lib/google/cloud/pubsub/v1/subscription_admin/credentials.rb +52 -0
  16. data/lib/google/cloud/pubsub/v1/subscription_admin/helpers.rb +50 -0
  17. data/lib/google/cloud/pubsub/v1/{subscriber → subscription_admin}/paths.rb +3 -3
  18. data/lib/google/cloud/pubsub/v1/subscription_admin.rb +51 -0
  19. data/lib/google/cloud/pubsub/v1/{publisher → topic_admin}/client.rb +199 -108
  20. data/lib/google/cloud/pubsub/v1/topic_admin/credentials.rb +52 -0
  21. data/lib/google/cloud/pubsub/v1/topic_admin/helpers.rb +50 -0
  22. data/lib/google/cloud/pubsub/v1/{publisher → topic_admin}/paths.rb +3 -3
  23. data/lib/google/cloud/pubsub/v1/topic_admin.rb +50 -0
  24. data/lib/google/cloud/pubsub/v1/version.rb +1 -1
  25. data/lib/google/cloud/pubsub/v1.rb +4 -5
  26. data/lib/google/pubsub/v1/pubsub_pb.rb +63 -246
  27. data/lib/google/pubsub/v1/pubsub_services_pb.rb +23 -24
  28. data/lib/google/pubsub/v1/schema_pb.rb +31 -60
  29. data/lib/google/pubsub/v1/schema_services_pb.rb +8 -0
  30. data/proto_docs/google/api/client.rb +473 -0
  31. data/proto_docs/google/api/field_behavior.rb +14 -0
  32. data/proto_docs/google/api/launch_stage.rb +71 -0
  33. data/proto_docs/google/api/resource.rb +7 -2
  34. data/proto_docs/google/protobuf/empty.rb +0 -2
  35. data/proto_docs/google/protobuf/timestamp.rb +1 -3
  36. data/proto_docs/google/pubsub/v1/pubsub.rb +1189 -227
  37. data/proto_docs/google/pubsub/v1/schema.rb +93 -4
  38. metadata +25 -142
  39. data/lib/google/cloud/pubsub/v1/subscriber/helpers.rb +0 -25
  40. data/proto_docs/google/iam/v1/iam_policy.rb +0 -87
  41. data/proto_docs/google/iam/v1/options.rb +0 -50
  42. data/proto_docs/google/iam/v1/policy.rb +0 -418
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Copyright 2020 Google LLC
3
+ # Copyright 2025 Google LLC
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -18,34 +18,41 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/pubsub/v1/pubsub_pb"
21
+ require "google/iam/v1"
21
22
 
22
23
  module Google
23
24
  module Cloud
24
25
  module PubSub
25
26
  module V1
26
- module Publisher
27
+ module TopicAdmin
27
28
  ##
28
- # Client for the Publisher service.
29
+ # Client for the TopicAdmin service.
29
30
  #
30
31
  # The service that an application uses to manipulate topics, and to send
31
32
  # messages to a topic.
32
33
  #
33
34
  class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
38
+ # @private
39
+ DEFAULT_ENDPOINT_TEMPLATE = "pubsub.$UNIVERSE_DOMAIN$"
40
+
34
41
  include Paths
35
42
 
36
43
  # @private
37
- attr_reader :publisher_stub
44
+ attr_reader :topic_admin_stub
38
45
 
39
46
  ##
40
- # Configure the Publisher Client class.
47
+ # Configure the TopicAdmin Client class.
41
48
  #
42
- # See {::Google::Cloud::PubSub::V1::Publisher::Client::Configuration}
49
+ # See {::Google::Cloud::PubSub::V1::TopicAdmin::Client::Configuration}
43
50
  # for a description of the configuration fields.
44
51
  #
45
52
  # @example
46
53
  #
47
- # # Modify the configuration for all Publisher clients
48
- # ::Google::Cloud::PubSub::V1::Publisher::Client.configure do |config|
54
+ # # Modify the configuration for all TopicAdmin clients
55
+ # ::Google::Cloud::PubSub::V1::TopicAdmin::Client.configure do |config|
49
56
  # config.timeout = 10.0
50
57
  # end
51
58
  #
@@ -77,7 +84,7 @@ module Google
77
84
 
78
85
  default_config.rpcs.publish.timeout = 60.0
79
86
  default_config.rpcs.publish.retry_policy = {
80
- initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [10, 1, 13, 8, 2, 14, 4]
87
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 4, retry_codes: [10, 1, 13, 8, 2, 14, 4]
81
88
  }
82
89
 
83
90
  default_config.rpcs.get_topic.timeout = 60.0
@@ -117,13 +124,13 @@ module Google
117
124
  end
118
125
 
119
126
  ##
120
- # Configure the Publisher Client instance.
127
+ # Configure the TopicAdmin Client instance.
121
128
  #
122
129
  # The configuration is set to the derived mode, meaning that values can be changed,
123
130
  # but structural changes (adding new fields, etc.) are not allowed. Structural changes
124
131
  # should be made on {Client.configure}.
125
132
  #
126
- # See {::Google::Cloud::PubSub::V1::Publisher::Client::Configuration}
133
+ # See {::Google::Cloud::PubSub::V1::TopicAdmin::Client::Configuration}
127
134
  # for a description of the configuration fields.
128
135
  #
129
136
  # @yield [config] Configure the Client client.
@@ -137,19 +144,28 @@ module Google
137
144
  end
138
145
 
139
146
  ##
140
- # Create a new Publisher client object.
147
+ # The effective universe domain
148
+ #
149
+ # @return [String]
150
+ #
151
+ def universe_domain
152
+ @topic_admin_stub.universe_domain
153
+ end
154
+
155
+ ##
156
+ # Create a new TopicAdmin client object.
141
157
  #
142
158
  # @example
143
159
  #
144
160
  # # Create a client using the default configuration
145
- # client = ::Google::Cloud::PubSub::V1::Publisher::Client.new
161
+ # client = ::Google::Cloud::PubSub::V1::TopicAdmin::Client.new
146
162
  #
147
163
  # # Create a client using a custom configuration
148
- # client = ::Google::Cloud::PubSub::V1::Publisher::Client.new do |config|
164
+ # client = ::Google::Cloud::PubSub::V1::TopicAdmin::Client.new do |config|
149
165
  # config.timeout = 10.0
150
166
  # end
151
167
  #
152
- # @yield [config] Configure the Publisher client.
168
+ # @yield [config] Configure the TopicAdmin client.
153
169
  # @yieldparam config [Client::Configuration]
154
170
  #
155
171
  def initialize
@@ -169,8 +185,9 @@ module Google
169
185
  credentials = @config.credentials
170
186
  # Use self-signed JWT if the endpoint is unchanged from default,
171
187
  # but only if the default endpoint does not have a region prefix.
172
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
173
- !@config.endpoint.split(".").first.include?("-")
188
+ enable_self_signed_jwt = @config.endpoint.nil? ||
189
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
190
+ !@config.endpoint.split(".").first.include?("-"))
174
191
  credentials ||= Credentials.default scope: @config.scope,
175
192
  enable_self_signed_jwt: enable_self_signed_jwt
176
193
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -179,20 +196,58 @@ module Google
179
196
  @quota_project_id = @config.quota_project
180
197
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
181
198
 
182
- @publisher_stub = ::Gapic::ServiceStub.new(
199
+ @topic_admin_stub = ::Gapic::ServiceStub.new(
183
200
  ::Google::Cloud::PubSub::V1::Publisher::Stub,
184
- credentials: credentials,
185
- endpoint: @config.endpoint,
201
+ credentials: credentials,
202
+ endpoint: @config.endpoint,
203
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
204
+ universe_domain: @config.universe_domain,
186
205
  channel_args: @config.channel_args,
187
- interceptors: @config.interceptors
206
+ interceptors: @config.interceptors,
207
+ channel_pool_config: @config.channel_pool,
208
+ logger: @config.logger
188
209
  )
210
+
211
+ @topic_admin_stub.stub_logger&.info do |entry|
212
+ entry.set_system_name
213
+ entry.set_service
214
+ entry.message = "Created client for #{entry.service}"
215
+ entry.set_credentials_fields credentials
216
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
217
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
218
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
219
+ end
220
+
221
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
222
+ config.credentials = credentials
223
+ config.quota_project = @quota_project_id
224
+ config.endpoint = @topic_admin_stub.endpoint
225
+ config.universe_domain = @topic_admin_stub.universe_domain
226
+ config.logger = @topic_admin_stub.logger if config.respond_to? :logger=
227
+ end
228
+ end
229
+
230
+ ##
231
+ # Get the associated client for mix-in of the IAMPolicy.
232
+ #
233
+ # @return [Google::Iam::V1::IAMPolicy::Client]
234
+ #
235
+ attr_reader :iam_policy_client
236
+
237
+ ##
238
+ # The logger used for request/response debug logging.
239
+ #
240
+ # @return [Logger]
241
+ #
242
+ def logger
243
+ @topic_admin_stub.logger
189
244
  end
190
245
 
191
246
  # Service calls
192
247
 
193
248
  ##
194
249
  # Creates the given topic with the given name. See the [resource name rules]
195
- # (https://cloud.google.com/pubsub/docs/admin#resource_names).
250
+ # (https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names).
196
251
  #
197
252
  # @overload create_topic(request, options = nil)
198
253
  # Pass arguments to `create_topic` via a request object, either of type
@@ -204,7 +259,7 @@ module Google
204
259
  # @param options [::Gapic::CallOptions, ::Hash]
205
260
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
206
261
  #
207
- # @overload create_topic(name: nil, labels: nil, message_storage_policy: nil, kms_key_name: nil, schema_settings: nil, satisfies_pzs: nil, message_retention_duration: nil)
262
+ # @overload create_topic(name: nil, labels: nil, message_storage_policy: nil, kms_key_name: nil, schema_settings: nil, satisfies_pzs: nil, message_retention_duration: nil, ingestion_data_source_settings: nil, message_transforms: nil)
208
263
  # Pass arguments to `create_topic` via keyword arguments. Note that at
209
264
  # least one keyword argument is required. To specify no parameters, or to keep all
210
265
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -217,31 +272,37 @@ module Google
217
272
  # signs (`%`). It must be between 3 and 255 characters in length, and it
218
273
  # must not start with `"goog"`.
219
274
  # @param labels [::Hash{::String => ::String}]
220
- # See [Creating and managing labels]
275
+ # Optional. See [Creating and managing labels]
221
276
  # (https://cloud.google.com/pubsub/docs/labels).
222
277
  # @param message_storage_policy [::Google::Cloud::PubSub::V1::MessageStoragePolicy, ::Hash]
223
- # Policy constraining the set of Google Cloud Platform regions where messages
224
- # published to the topic may be stored. If not present, then no constraints
225
- # are in effect.
278
+ # Optional. Policy constraining the set of Google Cloud Platform regions
279
+ # where messages published to the topic may be stored. If not present, then
280
+ # no constraints are in effect.
226
281
  # @param kms_key_name [::String]
227
- # The resource name of the Cloud KMS CryptoKey to be used to protect access
228
- # to messages published on this topic.
282
+ # Optional. The resource name of the Cloud KMS CryptoKey to be used to
283
+ # protect access to messages published on this topic.
229
284
  #
230
285
  # The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
231
286
  # @param schema_settings [::Google::Cloud::PubSub::V1::SchemaSettings, ::Hash]
232
- # Settings for validating messages published against a schema.
287
+ # Optional. Settings for validating messages published against a schema.
233
288
  # @param satisfies_pzs [::Boolean]
234
- # Reserved for future use. This field is set only in responses from the
235
- # server; it is ignored if it is set in any requests.
289
+ # Optional. Reserved for future use. This field is set only in responses from
290
+ # the server; it is ignored if it is set in any requests.
236
291
  # @param message_retention_duration [::Google::Protobuf::Duration, ::Hash]
237
- # Indicates the minimum duration to retain a message after it is published to
238
- # the topic. If this field is set, messages published to the topic in the
239
- # last `message_retention_duration` are always available to subscribers. For
240
- # instance, it allows any attached subscription to [seek to a
292
+ # Optional. Indicates the minimum duration to retain a message after it is
293
+ # published to the topic. If this field is set, messages published to the
294
+ # topic in the last `message_retention_duration` are always available to
295
+ # subscribers. For instance, it allows any attached subscription to [seek to
296
+ # a
241
297
  # timestamp](https://cloud.google.com/pubsub/docs/replay-overview#seek_to_a_time)
242
298
  # that is up to `message_retention_duration` in the past. If this field is
243
299
  # not set, message retention is controlled by settings on individual
244
- # subscriptions. Cannot be more than 7 days or less than 10 minutes.
300
+ # subscriptions. Cannot be more than 31 days or less than 10 minutes.
301
+ # @param ingestion_data_source_settings [::Google::Cloud::PubSub::V1::IngestionDataSourceSettings, ::Hash]
302
+ # Optional. Settings for ingestion from a data source into this topic.
303
+ # @param message_transforms [::Array<::Google::Cloud::PubSub::V1::MessageTransform, ::Hash>]
304
+ # Optional. Transforms to be applied to messages published to the topic.
305
+ # Transforms are applied in the order specified.
245
306
  #
246
307
  # @yield [response, operation] Access the result along with the RPC operation
247
308
  # @yieldparam response [::Google::Cloud::PubSub::V1::Topic]
@@ -255,7 +316,7 @@ module Google
255
316
  # require "google/cloud/pubsub/v1"
256
317
  #
257
318
  # # Create a client object. The client can be reused for multiple calls.
258
- # client = Google::Cloud::PubSub::V1::Publisher::Client.new
319
+ # client = Google::Cloud::PubSub::V1::TopicAdmin::Client.new
259
320
  #
260
321
  # # Create a request. To set request fields, pass in keyword arguments.
261
322
  # request = Google::Cloud::PubSub::V1::Topic.new
@@ -277,10 +338,11 @@ module Google
277
338
  # Customize the options with defaults
278
339
  metadata = @config.rpcs.create_topic.metadata.to_h
279
340
 
280
- # Set x-goog-api-client and x-goog-user-project headers
341
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
281
342
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
282
343
  lib_name: @config.lib_name, lib_version: @config.lib_version,
283
344
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
345
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
284
346
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
285
347
 
286
348
  header_params = {}
@@ -299,17 +361,16 @@ module Google
299
361
  metadata: @config.metadata,
300
362
  retry_policy: @config.retry_policy
301
363
 
302
- @publisher_stub.call_rpc :create_topic, request, options: options do |response, operation|
364
+ @topic_admin_stub.call_rpc :create_topic, request, options: options do |response, operation|
303
365
  yield response, operation if block_given?
304
- return response
305
366
  end
306
367
  rescue ::GRPC::BadStatus => e
307
368
  raise ::Google::Cloud::Error.from_error(e)
308
369
  end
309
370
 
310
371
  ##
311
- # Updates an existing topic. Note that certain properties of a
312
- # topic are not modifiable.
372
+ # Updates an existing topic by updating the fields specified in the update
373
+ # mask. Note that certain properties of a topic are not modifiable.
313
374
  #
314
375
  # @overload update_topic(request, options = nil)
315
376
  # Pass arguments to `update_topic` via a request object, either of type
@@ -347,7 +408,7 @@ module Google
347
408
  # require "google/cloud/pubsub/v1"
348
409
  #
349
410
  # # Create a client object. The client can be reused for multiple calls.
350
- # client = Google::Cloud::PubSub::V1::Publisher::Client.new
411
+ # client = Google::Cloud::PubSub::V1::TopicAdmin::Client.new
351
412
  #
352
413
  # # Create a request. To set request fields, pass in keyword arguments.
353
414
  # request = Google::Cloud::PubSub::V1::UpdateTopicRequest.new
@@ -369,10 +430,11 @@ module Google
369
430
  # Customize the options with defaults
370
431
  metadata = @config.rpcs.update_topic.metadata.to_h
371
432
 
372
- # Set x-goog-api-client and x-goog-user-project headers
433
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
373
434
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
374
435
  lib_name: @config.lib_name, lib_version: @config.lib_version,
375
436
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
437
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
376
438
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
377
439
 
378
440
  header_params = {}
@@ -391,9 +453,8 @@ module Google
391
453
  metadata: @config.metadata,
392
454
  retry_policy: @config.retry_policy
393
455
 
394
- @publisher_stub.call_rpc :update_topic, request, options: options do |response, operation|
456
+ @topic_admin_stub.call_rpc :update_topic, request, options: options do |response, operation|
395
457
  yield response, operation if block_given?
396
- return response
397
458
  end
398
459
  rescue ::GRPC::BadStatus => e
399
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -436,7 +497,7 @@ module Google
436
497
  # require "google/cloud/pubsub/v1"
437
498
  #
438
499
  # # Create a client object. The client can be reused for multiple calls.
439
- # client = Google::Cloud::PubSub::V1::Publisher::Client.new
500
+ # client = Google::Cloud::PubSub::V1::TopicAdmin::Client.new
440
501
  #
441
502
  # # Create a request. To set request fields, pass in keyword arguments.
442
503
  # request = Google::Cloud::PubSub::V1::PublishRequest.new
@@ -458,10 +519,11 @@ module Google
458
519
  # Customize the options with defaults
459
520
  metadata = @config.rpcs.publish.metadata.to_h
460
521
 
461
- # Set x-goog-api-client and x-goog-user-project headers
522
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
462
523
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
463
524
  lib_name: @config.lib_name, lib_version: @config.lib_version,
464
525
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
526
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
465
527
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
466
528
 
467
529
  header_params = {}
@@ -480,9 +542,8 @@ module Google
480
542
  metadata: @config.metadata,
481
543
  retry_policy: @config.retry_policy
482
544
 
483
- @publisher_stub.call_rpc :publish, request, options: options do |response, operation|
545
+ @topic_admin_stub.call_rpc :publish, request, options: options do |response, operation|
484
546
  yield response, operation if block_given?
485
- return response
486
547
  end
487
548
  rescue ::GRPC::BadStatus => e
488
549
  raise ::Google::Cloud::Error.from_error(e)
@@ -522,7 +583,7 @@ module Google
522
583
  # require "google/cloud/pubsub/v1"
523
584
  #
524
585
  # # Create a client object. The client can be reused for multiple calls.
525
- # client = Google::Cloud::PubSub::V1::Publisher::Client.new
586
+ # client = Google::Cloud::PubSub::V1::TopicAdmin::Client.new
526
587
  #
527
588
  # # Create a request. To set request fields, pass in keyword arguments.
528
589
  # request = Google::Cloud::PubSub::V1::GetTopicRequest.new
@@ -544,10 +605,11 @@ module Google
544
605
  # Customize the options with defaults
545
606
  metadata = @config.rpcs.get_topic.metadata.to_h
546
607
 
547
- # Set x-goog-api-client and x-goog-user-project headers
608
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
548
609
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
549
610
  lib_name: @config.lib_name, lib_version: @config.lib_version,
550
611
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
612
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
551
613
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
552
614
 
553
615
  header_params = {}
@@ -566,9 +628,8 @@ module Google
566
628
  metadata: @config.metadata,
567
629
  retry_policy: @config.retry_policy
568
630
 
569
- @publisher_stub.call_rpc :get_topic, request, options: options do |response, operation|
631
+ @topic_admin_stub.call_rpc :get_topic, request, options: options do |response, operation|
570
632
  yield response, operation if block_given?
571
- return response
572
633
  end
573
634
  rescue ::GRPC::BadStatus => e
574
635
  raise ::Google::Cloud::Error.from_error(e)
@@ -596,11 +657,11 @@ module Google
596
657
  # Required. The name of the project in which to list topics.
597
658
  # Format is `projects/{project-id}`.
598
659
  # @param page_size [::Integer]
599
- # Maximum number of topics to return.
660
+ # Optional. Maximum number of topics to return.
600
661
  # @param page_token [::String]
601
- # The value returned by the last `ListTopicsResponse`; indicates that this is
602
- # a continuation of a prior `ListTopics` call, and that the system should
603
- # return the next page of data.
662
+ # Optional. The value returned by the last `ListTopicsResponse`; indicates
663
+ # that this is a continuation of a prior `ListTopics` call, and that the
664
+ # system should return the next page of data.
604
665
  #
605
666
  # @yield [response, operation] Access the result along with the RPC operation
606
667
  # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Topic>]
@@ -614,7 +675,7 @@ module Google
614
675
  # require "google/cloud/pubsub/v1"
615
676
  #
616
677
  # # Create a client object. The client can be reused for multiple calls.
617
- # client = Google::Cloud::PubSub::V1::Publisher::Client.new
678
+ # client = Google::Cloud::PubSub::V1::TopicAdmin::Client.new
618
679
  #
619
680
  # # Create a request. To set request fields, pass in keyword arguments.
620
681
  # request = Google::Cloud::PubSub::V1::ListTopicsRequest.new
@@ -622,13 +683,11 @@ module Google
622
683
  # # Call the list_topics method.
623
684
  # result = client.list_topics request
624
685
  #
625
- # # The returned object is of type Gapic::PagedEnumerable. You can
626
- # # iterate over all elements by calling #each, and the enumerable
627
- # # will lazily make API calls to fetch subsequent pages. Other
628
- # # methods are also available for managing paging directly.
629
- # result.each do |response|
686
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
687
+ # # over elements, and API calls will be issued to fetch pages as needed.
688
+ # result.each do |item|
630
689
  # # Each element is of type ::Google::Cloud::PubSub::V1::Topic.
631
- # p response
690
+ # p item
632
691
  # end
633
692
  #
634
693
  def list_topics request, options = nil
@@ -642,10 +701,11 @@ module Google
642
701
  # Customize the options with defaults
643
702
  metadata = @config.rpcs.list_topics.metadata.to_h
644
703
 
645
- # Set x-goog-api-client and x-goog-user-project headers
704
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
646
705
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
647
706
  lib_name: @config.lib_name, lib_version: @config.lib_version,
648
707
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
708
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
649
709
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
650
710
 
651
711
  header_params = {}
@@ -664,10 +724,10 @@ module Google
664
724
  metadata: @config.metadata,
665
725
  retry_policy: @config.retry_policy
666
726
 
667
- @publisher_stub.call_rpc :list_topics, request, options: options do |response, operation|
668
- response = ::Gapic::PagedEnumerable.new @publisher_stub, :list_topics, request, response, operation, options
727
+ @topic_admin_stub.call_rpc :list_topics, request, options: options do |response, operation|
728
+ response = ::Gapic::PagedEnumerable.new @topic_admin_stub, :list_topics, request, response, operation, options
669
729
  yield response, operation if block_given?
670
- return response
730
+ throw :response, response
671
731
  end
672
732
  rescue ::GRPC::BadStatus => e
673
733
  raise ::Google::Cloud::Error.from_error(e)
@@ -695,11 +755,11 @@ module Google
695
755
  # Required. The name of the topic that subscriptions are attached to.
696
756
  # Format is `projects/{project}/topics/{topic}`.
697
757
  # @param page_size [::Integer]
698
- # Maximum number of subscription names to return.
758
+ # Optional. Maximum number of subscription names to return.
699
759
  # @param page_token [::String]
700
- # The value returned by the last `ListTopicSubscriptionsResponse`; indicates
701
- # that this is a continuation of a prior `ListTopicSubscriptions` call, and
702
- # that the system should return the next page of data.
760
+ # Optional. The value returned by the last `ListTopicSubscriptionsResponse`;
761
+ # indicates that this is a continuation of a prior `ListTopicSubscriptions`
762
+ # call, and that the system should return the next page of data.
703
763
  #
704
764
  # @yield [response, operation] Access the result along with the RPC operation
705
765
  # @yieldparam response [::Google::Cloud::PubSub::V1::ListTopicSubscriptionsResponse]
@@ -713,7 +773,7 @@ module Google
713
773
  # require "google/cloud/pubsub/v1"
714
774
  #
715
775
  # # Create a client object. The client can be reused for multiple calls.
716
- # client = Google::Cloud::PubSub::V1::Publisher::Client.new
776
+ # client = Google::Cloud::PubSub::V1::TopicAdmin::Client.new
717
777
  #
718
778
  # # Create a request. To set request fields, pass in keyword arguments.
719
779
  # request = Google::Cloud::PubSub::V1::ListTopicSubscriptionsRequest.new
@@ -735,10 +795,11 @@ module Google
735
795
  # Customize the options with defaults
736
796
  metadata = @config.rpcs.list_topic_subscriptions.metadata.to_h
737
797
 
738
- # Set x-goog-api-client and x-goog-user-project headers
798
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
739
799
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
740
800
  lib_name: @config.lib_name, lib_version: @config.lib_version,
741
801
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
802
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
742
803
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
743
804
 
744
805
  header_params = {}
@@ -757,9 +818,8 @@ module Google
757
818
  metadata: @config.metadata,
758
819
  retry_policy: @config.retry_policy
759
820
 
760
- @publisher_stub.call_rpc :list_topic_subscriptions, request, options: options do |response, operation|
821
+ @topic_admin_stub.call_rpc :list_topic_subscriptions, request, options: options do |response, operation|
761
822
  yield response, operation if block_given?
762
- return response
763
823
  end
764
824
  rescue ::GRPC::BadStatus => e
765
825
  raise ::Google::Cloud::Error.from_error(e)
@@ -791,11 +851,11 @@ module Google
791
851
  # Required. The name of the topic that snapshots are attached to.
792
852
  # Format is `projects/{project}/topics/{topic}`.
793
853
  # @param page_size [::Integer]
794
- # Maximum number of snapshot names to return.
854
+ # Optional. Maximum number of snapshot names to return.
795
855
  # @param page_token [::String]
796
- # The value returned by the last `ListTopicSnapshotsResponse`; indicates
797
- # that this is a continuation of a prior `ListTopicSnapshots` call, and
798
- # that the system should return the next page of data.
856
+ # Optional. The value returned by the last `ListTopicSnapshotsResponse`;
857
+ # indicates that this is a continuation of a prior `ListTopicSnapshots` call,
858
+ # and that the system should return the next page of data.
799
859
  #
800
860
  # @yield [response, operation] Access the result along with the RPC operation
801
861
  # @yieldparam response [::Google::Cloud::PubSub::V1::ListTopicSnapshotsResponse]
@@ -809,7 +869,7 @@ module Google
809
869
  # require "google/cloud/pubsub/v1"
810
870
  #
811
871
  # # Create a client object. The client can be reused for multiple calls.
812
- # client = Google::Cloud::PubSub::V1::Publisher::Client.new
872
+ # client = Google::Cloud::PubSub::V1::TopicAdmin::Client.new
813
873
  #
814
874
  # # Create a request. To set request fields, pass in keyword arguments.
815
875
  # request = Google::Cloud::PubSub::V1::ListTopicSnapshotsRequest.new
@@ -831,10 +891,11 @@ module Google
831
891
  # Customize the options with defaults
832
892
  metadata = @config.rpcs.list_topic_snapshots.metadata.to_h
833
893
 
834
- # Set x-goog-api-client and x-goog-user-project headers
894
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
835
895
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
836
896
  lib_name: @config.lib_name, lib_version: @config.lib_version,
837
897
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
898
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
838
899
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
839
900
 
840
901
  header_params = {}
@@ -853,9 +914,8 @@ module Google
853
914
  metadata: @config.metadata,
854
915
  retry_policy: @config.retry_policy
855
916
 
856
- @publisher_stub.call_rpc :list_topic_snapshots, request, options: options do |response, operation|
917
+ @topic_admin_stub.call_rpc :list_topic_snapshots, request, options: options do |response, operation|
857
918
  yield response, operation if block_given?
858
- return response
859
919
  end
860
920
  rescue ::GRPC::BadStatus => e
861
921
  raise ::Google::Cloud::Error.from_error(e)
@@ -899,7 +959,7 @@ module Google
899
959
  # require "google/cloud/pubsub/v1"
900
960
  #
901
961
  # # Create a client object. The client can be reused for multiple calls.
902
- # client = Google::Cloud::PubSub::V1::Publisher::Client.new
962
+ # client = Google::Cloud::PubSub::V1::TopicAdmin::Client.new
903
963
  #
904
964
  # # Create a request. To set request fields, pass in keyword arguments.
905
965
  # request = Google::Cloud::PubSub::V1::DeleteTopicRequest.new
@@ -921,10 +981,11 @@ module Google
921
981
  # Customize the options with defaults
922
982
  metadata = @config.rpcs.delete_topic.metadata.to_h
923
983
 
924
- # Set x-goog-api-client and x-goog-user-project headers
984
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
925
985
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
926
986
  lib_name: @config.lib_name, lib_version: @config.lib_version,
927
987
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
988
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
928
989
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
929
990
 
930
991
  header_params = {}
@@ -943,9 +1004,8 @@ module Google
943
1004
  metadata: @config.metadata,
944
1005
  retry_policy: @config.retry_policy
945
1006
 
946
- @publisher_stub.call_rpc :delete_topic, request, options: options do |response, operation|
1007
+ @topic_admin_stub.call_rpc :delete_topic, request, options: options do |response, operation|
947
1008
  yield response, operation if block_given?
948
- return response
949
1009
  end
950
1010
  rescue ::GRPC::BadStatus => e
951
1011
  raise ::Google::Cloud::Error.from_error(e)
@@ -988,7 +1048,7 @@ module Google
988
1048
  # require "google/cloud/pubsub/v1"
989
1049
  #
990
1050
  # # Create a client object. The client can be reused for multiple calls.
991
- # client = Google::Cloud::PubSub::V1::Publisher::Client.new
1051
+ # client = Google::Cloud::PubSub::V1::TopicAdmin::Client.new
992
1052
  #
993
1053
  # # Create a request. To set request fields, pass in keyword arguments.
994
1054
  # request = Google::Cloud::PubSub::V1::DetachSubscriptionRequest.new
@@ -1010,10 +1070,11 @@ module Google
1010
1070
  # Customize the options with defaults
1011
1071
  metadata = @config.rpcs.detach_subscription.metadata.to_h
1012
1072
 
1013
- # Set x-goog-api-client and x-goog-user-project headers
1073
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1014
1074
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1015
1075
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1016
1076
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
1077
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1017
1078
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1018
1079
 
1019
1080
  header_params = {}
@@ -1032,22 +1093,21 @@ module Google
1032
1093
  metadata: @config.metadata,
1033
1094
  retry_policy: @config.retry_policy
1034
1095
 
1035
- @publisher_stub.call_rpc :detach_subscription, request, options: options do |response, operation|
1096
+ @topic_admin_stub.call_rpc :detach_subscription, request, options: options do |response, operation|
1036
1097
  yield response, operation if block_given?
1037
- return response
1038
1098
  end
1039
1099
  rescue ::GRPC::BadStatus => e
1040
1100
  raise ::Google::Cloud::Error.from_error(e)
1041
1101
  end
1042
1102
 
1043
1103
  ##
1044
- # Configuration class for the Publisher API.
1104
+ # Configuration class for the TopicAdmin API.
1045
1105
  #
1046
- # This class represents the configuration for Publisher,
1106
+ # This class represents the configuration for TopicAdmin,
1047
1107
  # providing control over timeouts, retry behavior, logging, transport
1048
1108
  # parameters, and other low-level controls. Certain parameters can also be
1049
1109
  # applied individually to specific RPCs. See
1050
- # {::Google::Cloud::PubSub::V1::Publisher::Client::Configuration::Rpcs}
1110
+ # {::Google::Cloud::PubSub::V1::TopicAdmin::Client::Configuration::Rpcs}
1051
1111
  # for a list of RPCs that can be configured independently.
1052
1112
  #
1053
1113
  # Configuration can be applied globally to all clients, or to a single client
@@ -1058,32 +1118,39 @@ module Google
1058
1118
  # # Modify the global config, setting the timeout for
1059
1119
  # # create_topic to 20 seconds,
1060
1120
  # # and all remaining timeouts to 10 seconds.
1061
- # ::Google::Cloud::PubSub::V1::Publisher::Client.configure do |config|
1121
+ # ::Google::Cloud::PubSub::V1::TopicAdmin::Client.configure do |config|
1062
1122
  # config.timeout = 10.0
1063
1123
  # config.rpcs.create_topic.timeout = 20.0
1064
1124
  # end
1065
1125
  #
1066
1126
  # # Apply the above configuration only to a new client.
1067
- # client = ::Google::Cloud::PubSub::V1::Publisher::Client.new do |config|
1127
+ # client = ::Google::Cloud::PubSub::V1::TopicAdmin::Client.new do |config|
1068
1128
  # config.timeout = 10.0
1069
1129
  # config.rpcs.create_topic.timeout = 20.0
1070
1130
  # end
1071
1131
  #
1072
1132
  # @!attribute [rw] endpoint
1073
- # The hostname or hostname:port of the service endpoint.
1074
- # Defaults to `"pubsub.googleapis.com"`.
1075
- # @return [::String]
1133
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1134
+ # nil, indicating to use the default endpoint in the current universe domain.
1135
+ # @return [::String,nil]
1076
1136
  # @!attribute [rw] credentials
1077
1137
  # Credentials to send with calls. You may provide any of the following types:
1078
1138
  # * (`String`) The path to a service account key file in JSON format
1079
1139
  # * (`Hash`) A service account key as a Hash
1080
1140
  # * (`Google::Auth::Credentials`) A googleauth credentials object
1081
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1141
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
1082
1142
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
1083
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1143
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
1084
1144
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
1085
1145
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
1086
1146
  # * (`nil`) indicating no credentials
1147
+ #
1148
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1149
+ # external source for authentication to Google Cloud, you must validate it before
1150
+ # providing it to a Google API client library. Providing an unvalidated credential
1151
+ # configuration to Google APIs can compromise the security of your systems and data.
1152
+ # For more information, refer to [Validate credential configurations from external
1153
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
1087
1154
  # @return [::Object]
1088
1155
  # @!attribute [rw] scope
1089
1156
  # The OAuth scopes
@@ -1118,14 +1185,28 @@ module Google
1118
1185
  # @!attribute [rw] quota_project
1119
1186
  # A separate project against which to charge quota.
1120
1187
  # @return [::String]
1188
+ # @!attribute [rw] universe_domain
1189
+ # The universe domain within which to make requests. This determines the
1190
+ # default endpoint URL. The default value of nil uses the environment
1191
+ # universe (usually the default "googleapis.com" universe).
1192
+ # @return [::String,nil]
1193
+ # @!attribute [rw] logger
1194
+ # A custom logger to use for request/response debug logging, or the value
1195
+ # `:default` (the default) to construct a default logger, or `nil` to
1196
+ # explicitly disable logging.
1197
+ # @return [::Logger,:default,nil]
1121
1198
  #
1122
1199
  class Configuration
1123
1200
  extend ::Gapic::Config
1124
1201
 
1125
- config_attr :endpoint, "pubsub.googleapis.com", ::String
1202
+ # @private
1203
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1204
+ DEFAULT_ENDPOINT = "pubsub.googleapis.com"
1205
+
1206
+ config_attr :endpoint, nil, ::String, nil
1126
1207
  config_attr :credentials, nil do |value|
1127
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
1128
- allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1208
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1209
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
1129
1210
  allowed.any? { |klass| klass === value }
1130
1211
  end
1131
1212
  config_attr :scope, nil, ::String, ::Array, nil
@@ -1137,6 +1218,8 @@ module Google
1137
1218
  config_attr :metadata, nil, ::Hash, nil
1138
1219
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1139
1220
  config_attr :quota_project, nil, ::String, nil
1221
+ config_attr :universe_domain, nil, ::String, nil
1222
+ config_attr :logger, :default, ::Logger, nil, :default
1140
1223
 
1141
1224
  # @private
1142
1225
  def initialize parent_config = nil
@@ -1158,7 +1241,15 @@ module Google
1158
1241
  end
1159
1242
 
1160
1243
  ##
1161
- # Configuration RPC class for the Publisher API.
1244
+ # Configuration for the channel pool
1245
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
1246
+ #
1247
+ def channel_pool
1248
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
1249
+ end
1250
+
1251
+ ##
1252
+ # Configuration RPC class for the TopicAdmin API.
1162
1253
  #
1163
1254
  # Includes fields providing the configuration for each RPC in this service.
1164
1255
  # Each configuration object is of type `Gapic::Config::Method` and includes