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
@@ -18,6 +18,7 @@
18
18
 
19
19
  require "google/cloud/errors"
20
20
  require "google/pubsub/v1/schema_pb"
21
+ require "google/iam/v1"
21
22
 
22
23
  module Google
23
24
  module Cloud
@@ -30,6 +31,12 @@ module Google
30
31
  # Service for doing schema-related operations.
31
32
  #
32
33
  class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
37
+ # @private
38
+ DEFAULT_ENDPOINT_TEMPLATE = "pubsub.$UNIVERSE_DOMAIN$"
39
+
33
40
  include Paths
34
41
 
35
42
  # @private
@@ -64,6 +71,56 @@ module Google
64
71
  end
65
72
  default_config = Client::Configuration.new parent_config
66
73
 
74
+ default_config.rpcs.create_schema.timeout = 60.0
75
+ default_config.rpcs.create_schema.retry_policy = {
76
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
77
+ }
78
+
79
+ default_config.rpcs.get_schema.timeout = 60.0
80
+ default_config.rpcs.get_schema.retry_policy = {
81
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
82
+ }
83
+
84
+ default_config.rpcs.list_schemas.timeout = 60.0
85
+ default_config.rpcs.list_schemas.retry_policy = {
86
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
87
+ }
88
+
89
+ default_config.rpcs.list_schema_revisions.timeout = 60.0
90
+ default_config.rpcs.list_schema_revisions.retry_policy = {
91
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
92
+ }
93
+
94
+ default_config.rpcs.commit_schema.timeout = 60.0
95
+ default_config.rpcs.commit_schema.retry_policy = {
96
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
97
+ }
98
+
99
+ default_config.rpcs.rollback_schema.timeout = 60.0
100
+ default_config.rpcs.rollback_schema.retry_policy = {
101
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
102
+ }
103
+
104
+ default_config.rpcs.delete_schema_revision.timeout = 60.0
105
+ default_config.rpcs.delete_schema_revision.retry_policy = {
106
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
107
+ }
108
+
109
+ default_config.rpcs.delete_schema.timeout = 60.0
110
+ default_config.rpcs.delete_schema.retry_policy = {
111
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
112
+ }
113
+
114
+ default_config.rpcs.validate_schema.timeout = 60.0
115
+ default_config.rpcs.validate_schema.retry_policy = {
116
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
117
+ }
118
+
119
+ default_config.rpcs.validate_message.timeout = 60.0
120
+ default_config.rpcs.validate_message.retry_policy = {
121
+ initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
122
+ }
123
+
67
124
  default_config
68
125
  end
69
126
  yield @configure if block_given?
@@ -90,6 +147,15 @@ module Google
90
147
  @config
91
148
  end
92
149
 
150
+ ##
151
+ # The effective universe domain
152
+ #
153
+ # @return [String]
154
+ #
155
+ def universe_domain
156
+ @schema_service_stub.universe_domain
157
+ end
158
+
93
159
  ##
94
160
  # Create a new SchemaService client object.
95
161
  #
@@ -123,8 +189,9 @@ module Google
123
189
  credentials = @config.credentials
124
190
  # Use self-signed JWT if the endpoint is unchanged from default,
125
191
  # but only if the default endpoint does not have a region prefix.
126
- enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
127
- !@config.endpoint.split(".").first.include?("-")
192
+ enable_self_signed_jwt = @config.endpoint.nil? ||
193
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
194
+ !@config.endpoint.split(".").first.include?("-"))
128
195
  credentials ||= Credentials.default scope: @config.scope,
129
196
  enable_self_signed_jwt: enable_self_signed_jwt
130
197
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
@@ -135,11 +202,49 @@ module Google
135
202
 
136
203
  @schema_service_stub = ::Gapic::ServiceStub.new(
137
204
  ::Google::Cloud::PubSub::V1::SchemaService::Stub,
138
- credentials: credentials,
139
- endpoint: @config.endpoint,
205
+ credentials: credentials,
206
+ endpoint: @config.endpoint,
207
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
208
+ universe_domain: @config.universe_domain,
140
209
  channel_args: @config.channel_args,
141
- interceptors: @config.interceptors
210
+ interceptors: @config.interceptors,
211
+ channel_pool_config: @config.channel_pool,
212
+ logger: @config.logger
142
213
  )
214
+
215
+ @schema_service_stub.stub_logger&.info do |entry|
216
+ entry.set_system_name
217
+ entry.set_service
218
+ entry.message = "Created client for #{entry.service}"
219
+ entry.set_credentials_fields credentials
220
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
221
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
222
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
223
+ end
224
+
225
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
226
+ config.credentials = credentials
227
+ config.quota_project = @quota_project_id
228
+ config.endpoint = @schema_service_stub.endpoint
229
+ config.universe_domain = @schema_service_stub.universe_domain
230
+ config.logger = @schema_service_stub.logger if config.respond_to? :logger=
231
+ end
232
+ end
233
+
234
+ ##
235
+ # Get the associated client for mix-in of the IAMPolicy.
236
+ #
237
+ # @return [Google::Iam::V1::IAMPolicy::Client]
238
+ #
239
+ attr_reader :iam_policy_client
240
+
241
+ ##
242
+ # The logger used for request/response debug logging.
243
+ #
244
+ # @return [Logger]
245
+ #
246
+ def logger
247
+ @schema_service_stub.logger
143
248
  end
144
249
 
145
250
  # Service calls
@@ -175,8 +280,8 @@ module Google
175
280
  # The ID to use for the schema, which will become the final component of
176
281
  # the schema's resource name.
177
282
  #
178
- # See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
179
- # name constraints.
283
+ # See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
284
+ # resource name constraints.
180
285
  #
181
286
  # @yield [response, operation] Access the result along with the RPC operation
182
287
  # @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
@@ -212,10 +317,11 @@ module Google
212
317
  # Customize the options with defaults
213
318
  metadata = @config.rpcs.create_schema.metadata.to_h
214
319
 
215
- # Set x-goog-api-client and x-goog-user-project headers
320
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
216
321
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
217
322
  lib_name: @config.lib_name, lib_version: @config.lib_version,
218
323
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
324
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
219
325
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
220
326
 
221
327
  header_params = {}
@@ -236,7 +342,6 @@ module Google
236
342
 
237
343
  @schema_service_stub.call_rpc :create_schema, request, options: options do |response, operation|
238
344
  yield response, operation if block_given?
239
- return response
240
345
  end
241
346
  rescue ::GRPC::BadStatus => e
242
347
  raise ::Google::Cloud::Error.from_error(e)
@@ -265,8 +370,7 @@ module Google
265
370
  # Format is `projects/{project}/schemas/{schema}`.
266
371
  # @param view [::Google::Cloud::PubSub::V1::SchemaView]
267
372
  # The set of fields to return in the response. If not set, returns a Schema
268
- # with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
269
- # fields.
373
+ # with all fields filled out. Set to `BASIC` to omit the `definition`.
270
374
  #
271
375
  # @yield [response, operation] Access the result along with the RPC operation
272
376
  # @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
@@ -302,10 +406,11 @@ module Google
302
406
  # Customize the options with defaults
303
407
  metadata = @config.rpcs.get_schema.metadata.to_h
304
408
 
305
- # Set x-goog-api-client and x-goog-user-project headers
409
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
306
410
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
307
411
  lib_name: @config.lib_name, lib_version: @config.lib_version,
308
412
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
413
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
309
414
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
310
415
 
311
416
  header_params = {}
@@ -326,7 +431,6 @@ module Google
326
431
 
327
432
  @schema_service_stub.call_rpc :get_schema, request, options: options do |response, operation|
328
433
  yield response, operation if block_given?
329
- return response
330
434
  end
331
435
  rescue ::GRPC::BadStatus => e
332
436
  raise ::Google::Cloud::Error.from_error(e)
@@ -384,13 +488,11 @@ module Google
384
488
  # # Call the list_schemas method.
385
489
  # result = client.list_schemas request
386
490
  #
387
- # # The returned object is of type Gapic::PagedEnumerable. You can
388
- # # iterate over all elements by calling #each, and the enumerable
389
- # # will lazily make API calls to fetch subsequent pages. Other
390
- # # methods are also available for managing paging directly.
391
- # result.each do |response|
491
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
492
+ # # over elements, and API calls will be issued to fetch pages as needed.
493
+ # result.each do |item|
392
494
  # # Each element is of type ::Google::Cloud::PubSub::V1::Schema.
393
- # p response
495
+ # p item
394
496
  # end
395
497
  #
396
498
  def list_schemas request, options = nil
@@ -404,10 +506,11 @@ module Google
404
506
  # Customize the options with defaults
405
507
  metadata = @config.rpcs.list_schemas.metadata.to_h
406
508
 
407
- # Set x-goog-api-client and x-goog-user-project headers
509
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
408
510
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
409
511
  lib_name: @config.lib_name, lib_version: @config.lib_version,
410
512
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
513
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
411
514
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
412
515
 
413
516
  header_params = {}
@@ -429,7 +532,377 @@ module Google
429
532
  @schema_service_stub.call_rpc :list_schemas, request, options: options do |response, operation|
430
533
  response = ::Gapic::PagedEnumerable.new @schema_service_stub, :list_schemas, request, response, operation, options
431
534
  yield response, operation if block_given?
432
- return response
535
+ throw :response, response
536
+ end
537
+ rescue ::GRPC::BadStatus => e
538
+ raise ::Google::Cloud::Error.from_error(e)
539
+ end
540
+
541
+ ##
542
+ # Lists all schema revisions for the named schema.
543
+ #
544
+ # @overload list_schema_revisions(request, options = nil)
545
+ # Pass arguments to `list_schema_revisions` via a request object, either of type
546
+ # {::Google::Cloud::PubSub::V1::ListSchemaRevisionsRequest} or an equivalent Hash.
547
+ #
548
+ # @param request [::Google::Cloud::PubSub::V1::ListSchemaRevisionsRequest, ::Hash]
549
+ # A request object representing the call parameters. Required. To specify no
550
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
551
+ # @param options [::Gapic::CallOptions, ::Hash]
552
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
553
+ #
554
+ # @overload list_schema_revisions(name: nil, view: nil, page_size: nil, page_token: nil)
555
+ # Pass arguments to `list_schema_revisions` via keyword arguments. Note that at
556
+ # least one keyword argument is required. To specify no parameters, or to keep all
557
+ # the default parameter values, pass an empty Hash as a request object (see above).
558
+ #
559
+ # @param name [::String]
560
+ # Required. The name of the schema to list revisions for.
561
+ # @param view [::Google::Cloud::PubSub::V1::SchemaView]
562
+ # The set of Schema fields to return in the response. If not set, returns
563
+ # Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
564
+ # retrieve all fields.
565
+ # @param page_size [::Integer]
566
+ # The maximum number of revisions to return per page.
567
+ # @param page_token [::String]
568
+ # The page token, received from a previous ListSchemaRevisions call.
569
+ # Provide this to retrieve the subsequent page.
570
+ #
571
+ # @yield [response, operation] Access the result along with the RPC operation
572
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>]
573
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
574
+ #
575
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>]
576
+ #
577
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
578
+ #
579
+ # @example Basic example
580
+ # require "google/cloud/pubsub/v1"
581
+ #
582
+ # # Create a client object. The client can be reused for multiple calls.
583
+ # client = Google::Cloud::PubSub::V1::SchemaService::Client.new
584
+ #
585
+ # # Create a request. To set request fields, pass in keyword arguments.
586
+ # request = Google::Cloud::PubSub::V1::ListSchemaRevisionsRequest.new
587
+ #
588
+ # # Call the list_schema_revisions method.
589
+ # result = client.list_schema_revisions request
590
+ #
591
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
592
+ # # over elements, and API calls will be issued to fetch pages as needed.
593
+ # result.each do |item|
594
+ # # Each element is of type ::Google::Cloud::PubSub::V1::Schema.
595
+ # p item
596
+ # end
597
+ #
598
+ def list_schema_revisions request, options = nil
599
+ raise ::ArgumentError, "request must be provided" if request.nil?
600
+
601
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListSchemaRevisionsRequest
602
+
603
+ # Converts hash and nil to an options object
604
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
605
+
606
+ # Customize the options with defaults
607
+ metadata = @config.rpcs.list_schema_revisions.metadata.to_h
608
+
609
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
610
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
611
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
612
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
613
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
614
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
615
+
616
+ header_params = {}
617
+ if request.name
618
+ header_params["name"] = request.name
619
+ end
620
+
621
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
622
+ metadata[:"x-goog-request-params"] ||= request_params_header
623
+
624
+ options.apply_defaults timeout: @config.rpcs.list_schema_revisions.timeout,
625
+ metadata: metadata,
626
+ retry_policy: @config.rpcs.list_schema_revisions.retry_policy
627
+
628
+ options.apply_defaults timeout: @config.timeout,
629
+ metadata: @config.metadata,
630
+ retry_policy: @config.retry_policy
631
+
632
+ @schema_service_stub.call_rpc :list_schema_revisions, request, options: options do |response, operation|
633
+ response = ::Gapic::PagedEnumerable.new @schema_service_stub, :list_schema_revisions, request, response, operation, options
634
+ yield response, operation if block_given?
635
+ throw :response, response
636
+ end
637
+ rescue ::GRPC::BadStatus => e
638
+ raise ::Google::Cloud::Error.from_error(e)
639
+ end
640
+
641
+ ##
642
+ # Commits a new schema revision to an existing schema.
643
+ #
644
+ # @overload commit_schema(request, options = nil)
645
+ # Pass arguments to `commit_schema` via a request object, either of type
646
+ # {::Google::Cloud::PubSub::V1::CommitSchemaRequest} or an equivalent Hash.
647
+ #
648
+ # @param request [::Google::Cloud::PubSub::V1::CommitSchemaRequest, ::Hash]
649
+ # A request object representing the call parameters. Required. To specify no
650
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
651
+ # @param options [::Gapic::CallOptions, ::Hash]
652
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
653
+ #
654
+ # @overload commit_schema(name: nil, schema: nil)
655
+ # Pass arguments to `commit_schema` via keyword arguments. Note that at
656
+ # least one keyword argument is required. To specify no parameters, or to keep all
657
+ # the default parameter values, pass an empty Hash as a request object (see above).
658
+ #
659
+ # @param name [::String]
660
+ # Required. The name of the schema we are revising.
661
+ # Format is `projects/{project}/schemas/{schema}`.
662
+ # @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
663
+ # Required. The schema revision to commit.
664
+ #
665
+ # @yield [response, operation] Access the result along with the RPC operation
666
+ # @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
667
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
668
+ #
669
+ # @return [::Google::Cloud::PubSub::V1::Schema]
670
+ #
671
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
672
+ #
673
+ # @example Basic example
674
+ # require "google/cloud/pubsub/v1"
675
+ #
676
+ # # Create a client object. The client can be reused for multiple calls.
677
+ # client = Google::Cloud::PubSub::V1::SchemaService::Client.new
678
+ #
679
+ # # Create a request. To set request fields, pass in keyword arguments.
680
+ # request = Google::Cloud::PubSub::V1::CommitSchemaRequest.new
681
+ #
682
+ # # Call the commit_schema method.
683
+ # result = client.commit_schema request
684
+ #
685
+ # # The returned object is of type Google::Cloud::PubSub::V1::Schema.
686
+ # p result
687
+ #
688
+ def commit_schema request, options = nil
689
+ raise ::ArgumentError, "request must be provided" if request.nil?
690
+
691
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::CommitSchemaRequest
692
+
693
+ # Converts hash and nil to an options object
694
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
695
+
696
+ # Customize the options with defaults
697
+ metadata = @config.rpcs.commit_schema.metadata.to_h
698
+
699
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
700
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
701
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
702
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
703
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
704
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
705
+
706
+ header_params = {}
707
+ if request.name
708
+ header_params["name"] = request.name
709
+ end
710
+
711
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
712
+ metadata[:"x-goog-request-params"] ||= request_params_header
713
+
714
+ options.apply_defaults timeout: @config.rpcs.commit_schema.timeout,
715
+ metadata: metadata,
716
+ retry_policy: @config.rpcs.commit_schema.retry_policy
717
+
718
+ options.apply_defaults timeout: @config.timeout,
719
+ metadata: @config.metadata,
720
+ retry_policy: @config.retry_policy
721
+
722
+ @schema_service_stub.call_rpc :commit_schema, request, options: options do |response, operation|
723
+ yield response, operation if block_given?
724
+ end
725
+ rescue ::GRPC::BadStatus => e
726
+ raise ::Google::Cloud::Error.from_error(e)
727
+ end
728
+
729
+ ##
730
+ # Creates a new schema revision that is a copy of the provided revision_id.
731
+ #
732
+ # @overload rollback_schema(request, options = nil)
733
+ # Pass arguments to `rollback_schema` via a request object, either of type
734
+ # {::Google::Cloud::PubSub::V1::RollbackSchemaRequest} or an equivalent Hash.
735
+ #
736
+ # @param request [::Google::Cloud::PubSub::V1::RollbackSchemaRequest, ::Hash]
737
+ # A request object representing the call parameters. Required. To specify no
738
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
739
+ # @param options [::Gapic::CallOptions, ::Hash]
740
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
741
+ #
742
+ # @overload rollback_schema(name: nil, revision_id: nil)
743
+ # Pass arguments to `rollback_schema` via keyword arguments. Note that at
744
+ # least one keyword argument is required. To specify no parameters, or to keep all
745
+ # the default parameter values, pass an empty Hash as a request object (see above).
746
+ #
747
+ # @param name [::String]
748
+ # Required. The schema being rolled back with revision id.
749
+ # @param revision_id [::String]
750
+ # Required. The revision ID to roll back to.
751
+ # It must be a revision of the same schema.
752
+ #
753
+ # Example: c7cfa2a8
754
+ #
755
+ # @yield [response, operation] Access the result along with the RPC operation
756
+ # @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
757
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
758
+ #
759
+ # @return [::Google::Cloud::PubSub::V1::Schema]
760
+ #
761
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
762
+ #
763
+ # @example Basic example
764
+ # require "google/cloud/pubsub/v1"
765
+ #
766
+ # # Create a client object. The client can be reused for multiple calls.
767
+ # client = Google::Cloud::PubSub::V1::SchemaService::Client.new
768
+ #
769
+ # # Create a request. To set request fields, pass in keyword arguments.
770
+ # request = Google::Cloud::PubSub::V1::RollbackSchemaRequest.new
771
+ #
772
+ # # Call the rollback_schema method.
773
+ # result = client.rollback_schema request
774
+ #
775
+ # # The returned object is of type Google::Cloud::PubSub::V1::Schema.
776
+ # p result
777
+ #
778
+ def rollback_schema request, options = nil
779
+ raise ::ArgumentError, "request must be provided" if request.nil?
780
+
781
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::RollbackSchemaRequest
782
+
783
+ # Converts hash and nil to an options object
784
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
785
+
786
+ # Customize the options with defaults
787
+ metadata = @config.rpcs.rollback_schema.metadata.to_h
788
+
789
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
790
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
791
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
792
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
793
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
794
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
795
+
796
+ header_params = {}
797
+ if request.name
798
+ header_params["name"] = request.name
799
+ end
800
+
801
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
802
+ metadata[:"x-goog-request-params"] ||= request_params_header
803
+
804
+ options.apply_defaults timeout: @config.rpcs.rollback_schema.timeout,
805
+ metadata: metadata,
806
+ retry_policy: @config.rpcs.rollback_schema.retry_policy
807
+
808
+ options.apply_defaults timeout: @config.timeout,
809
+ metadata: @config.metadata,
810
+ retry_policy: @config.retry_policy
811
+
812
+ @schema_service_stub.call_rpc :rollback_schema, request, options: options do |response, operation|
813
+ yield response, operation if block_given?
814
+ end
815
+ rescue ::GRPC::BadStatus => e
816
+ raise ::Google::Cloud::Error.from_error(e)
817
+ end
818
+
819
+ ##
820
+ # Deletes a specific schema revision.
821
+ #
822
+ # @overload delete_schema_revision(request, options = nil)
823
+ # Pass arguments to `delete_schema_revision` via a request object, either of type
824
+ # {::Google::Cloud::PubSub::V1::DeleteSchemaRevisionRequest} or an equivalent Hash.
825
+ #
826
+ # @param request [::Google::Cloud::PubSub::V1::DeleteSchemaRevisionRequest, ::Hash]
827
+ # A request object representing the call parameters. Required. To specify no
828
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
829
+ # @param options [::Gapic::CallOptions, ::Hash]
830
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
831
+ #
832
+ # @overload delete_schema_revision(name: nil, revision_id: nil)
833
+ # Pass arguments to `delete_schema_revision` via keyword arguments. Note that at
834
+ # least one keyword argument is required. To specify no parameters, or to keep all
835
+ # the default parameter values, pass an empty Hash as a request object (see above).
836
+ #
837
+ # @param name [::String]
838
+ # Required. The name of the schema revision to be deleted, with a revision ID
839
+ # explicitly included.
840
+ #
841
+ # Example: `projects/123/schemas/my-schema@c7cfa2a8`
842
+ # @param revision_id [::String]
843
+ # Optional. This field is deprecated and should not be used for specifying
844
+ # the revision ID. The revision ID should be specified via the `name`
845
+ # parameter.
846
+ #
847
+ # @yield [response, operation] Access the result along with the RPC operation
848
+ # @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
849
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
850
+ #
851
+ # @return [::Google::Cloud::PubSub::V1::Schema]
852
+ #
853
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
854
+ #
855
+ # @example Basic example
856
+ # require "google/cloud/pubsub/v1"
857
+ #
858
+ # # Create a client object. The client can be reused for multiple calls.
859
+ # client = Google::Cloud::PubSub::V1::SchemaService::Client.new
860
+ #
861
+ # # Create a request. To set request fields, pass in keyword arguments.
862
+ # request = Google::Cloud::PubSub::V1::DeleteSchemaRevisionRequest.new
863
+ #
864
+ # # Call the delete_schema_revision method.
865
+ # result = client.delete_schema_revision request
866
+ #
867
+ # # The returned object is of type Google::Cloud::PubSub::V1::Schema.
868
+ # p result
869
+ #
870
+ def delete_schema_revision request, options = nil
871
+ raise ::ArgumentError, "request must be provided" if request.nil?
872
+
873
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::DeleteSchemaRevisionRequest
874
+
875
+ # Converts hash and nil to an options object
876
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
877
+
878
+ # Customize the options with defaults
879
+ metadata = @config.rpcs.delete_schema_revision.metadata.to_h
880
+
881
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
882
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
883
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
884
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
885
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
886
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
887
+
888
+ header_params = {}
889
+ if request.name
890
+ header_params["name"] = request.name
891
+ end
892
+
893
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
894
+ metadata[:"x-goog-request-params"] ||= request_params_header
895
+
896
+ options.apply_defaults timeout: @config.rpcs.delete_schema_revision.timeout,
897
+ metadata: metadata,
898
+ retry_policy: @config.rpcs.delete_schema_revision.retry_policy
899
+
900
+ options.apply_defaults timeout: @config.timeout,
901
+ metadata: @config.metadata,
902
+ retry_policy: @config.retry_policy
903
+
904
+ @schema_service_stub.call_rpc :delete_schema_revision, request, options: options do |response, operation|
905
+ yield response, operation if block_given?
433
906
  end
434
907
  rescue ::GRPC::BadStatus => e
435
908
  raise ::Google::Cloud::Error.from_error(e)
@@ -491,10 +964,11 @@ module Google
491
964
  # Customize the options with defaults
492
965
  metadata = @config.rpcs.delete_schema.metadata.to_h
493
966
 
494
- # Set x-goog-api-client and x-goog-user-project headers
967
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
495
968
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
496
969
  lib_name: @config.lib_name, lib_version: @config.lib_version,
497
970
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
971
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
498
972
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
499
973
 
500
974
  header_params = {}
@@ -515,7 +989,6 @@ module Google
515
989
 
516
990
  @schema_service_stub.call_rpc :delete_schema, request, options: options do |response, operation|
517
991
  yield response, operation if block_given?
518
- return response
519
992
  end
520
993
  rescue ::GRPC::BadStatus => e
521
994
  raise ::Google::Cloud::Error.from_error(e)
@@ -579,10 +1052,11 @@ module Google
579
1052
  # Customize the options with defaults
580
1053
  metadata = @config.rpcs.validate_schema.metadata.to_h
581
1054
 
582
- # Set x-goog-api-client and x-goog-user-project headers
1055
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
583
1056
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
584
1057
  lib_name: @config.lib_name, lib_version: @config.lib_version,
585
1058
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
1059
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
586
1060
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
587
1061
 
588
1062
  header_params = {}
@@ -603,7 +1077,6 @@ module Google
603
1077
 
604
1078
  @schema_service_stub.call_rpc :validate_schema, request, options: options do |response, operation|
605
1079
  yield response, operation if block_given?
606
- return response
607
1080
  end
608
1081
  rescue ::GRPC::BadStatus => e
609
1082
  raise ::Google::Cloud::Error.from_error(e)
@@ -634,8 +1107,12 @@ module Google
634
1107
  # Name of the schema against which to validate.
635
1108
  #
636
1109
  # Format is `projects/{project}/schemas/{schema}`.
1110
+ #
1111
+ # Note: The following parameters are mutually exclusive: `name`, `schema`. 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.
637
1112
  # @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
638
1113
  # Ad-hoc schema against which to validate
1114
+ #
1115
+ # Note: The following parameters are mutually exclusive: `schema`, `name`. 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.
639
1116
  # @param message [::String]
640
1117
  # Message to validate against the provided `schema_spec`.
641
1118
  # @param encoding [::Google::Cloud::PubSub::V1::Encoding]
@@ -675,10 +1152,11 @@ module Google
675
1152
  # Customize the options with defaults
676
1153
  metadata = @config.rpcs.validate_message.metadata.to_h
677
1154
 
678
- # Set x-goog-api-client and x-goog-user-project headers
1155
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
679
1156
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
680
1157
  lib_name: @config.lib_name, lib_version: @config.lib_version,
681
1158
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
1159
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
682
1160
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
683
1161
 
684
1162
  header_params = {}
@@ -699,7 +1177,6 @@ module Google
699
1177
 
700
1178
  @schema_service_stub.call_rpc :validate_message, request, options: options do |response, operation|
701
1179
  yield response, operation if block_given?
702
- return response
703
1180
  end
704
1181
  rescue ::GRPC::BadStatus => e
705
1182
  raise ::Google::Cloud::Error.from_error(e)
@@ -735,20 +1212,27 @@ module Google
735
1212
  # end
736
1213
  #
737
1214
  # @!attribute [rw] endpoint
738
- # The hostname or hostname:port of the service endpoint.
739
- # Defaults to `"pubsub.googleapis.com"`.
740
- # @return [::String]
1215
+ # A custom service endpoint, as a hostname or hostname:port. The default is
1216
+ # nil, indicating to use the default endpoint in the current universe domain.
1217
+ # @return [::String,nil]
741
1218
  # @!attribute [rw] credentials
742
1219
  # Credentials to send with calls. You may provide any of the following types:
743
1220
  # * (`String`) The path to a service account key file in JSON format
744
1221
  # * (`Hash`) A service account key as a Hash
745
1222
  # * (`Google::Auth::Credentials`) A googleauth credentials object
746
- # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
1223
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
747
1224
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
748
- # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
1225
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
749
1226
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
750
1227
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
751
1228
  # * (`nil`) indicating no credentials
1229
+ #
1230
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
1231
+ # external source for authentication to Google Cloud, you must validate it before
1232
+ # providing it to a Google API client library. Providing an unvalidated credential
1233
+ # configuration to Google APIs can compromise the security of your systems and data.
1234
+ # For more information, refer to [Validate credential configurations from external
1235
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
752
1236
  # @return [::Object]
753
1237
  # @!attribute [rw] scope
754
1238
  # The OAuth scopes
@@ -783,14 +1267,28 @@ module Google
783
1267
  # @!attribute [rw] quota_project
784
1268
  # A separate project against which to charge quota.
785
1269
  # @return [::String]
1270
+ # @!attribute [rw] universe_domain
1271
+ # The universe domain within which to make requests. This determines the
1272
+ # default endpoint URL. The default value of nil uses the environment
1273
+ # universe (usually the default "googleapis.com" universe).
1274
+ # @return [::String,nil]
1275
+ # @!attribute [rw] logger
1276
+ # A custom logger to use for request/response debug logging, or the value
1277
+ # `:default` (the default) to construct a default logger, or `nil` to
1278
+ # explicitly disable logging.
1279
+ # @return [::Logger,:default,nil]
786
1280
  #
787
1281
  class Configuration
788
1282
  extend ::Gapic::Config
789
1283
 
790
- config_attr :endpoint, "pubsub.googleapis.com", ::String
1284
+ # @private
1285
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
1286
+ DEFAULT_ENDPOINT = "pubsub.googleapis.com"
1287
+
1288
+ config_attr :endpoint, nil, ::String, nil
791
1289
  config_attr :credentials, nil do |value|
792
- allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
793
- allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
1290
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
1291
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
794
1292
  allowed.any? { |klass| klass === value }
795
1293
  end
796
1294
  config_attr :scope, nil, ::String, ::Array, nil
@@ -802,6 +1300,8 @@ module Google
802
1300
  config_attr :metadata, nil, ::Hash, nil
803
1301
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
804
1302
  config_attr :quota_project, nil, ::String, nil
1303
+ config_attr :universe_domain, nil, ::String, nil
1304
+ config_attr :logger, :default, ::Logger, nil, :default
805
1305
 
806
1306
  # @private
807
1307
  def initialize parent_config = nil
@@ -822,6 +1322,14 @@ module Google
822
1322
  end
823
1323
  end
824
1324
 
1325
+ ##
1326
+ # Configuration for the channel pool
1327
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
1328
+ #
1329
+ def channel_pool
1330
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
1331
+ end
1332
+
825
1333
  ##
826
1334
  # Configuration RPC class for the SchemaService API.
827
1335
  #
@@ -856,6 +1364,26 @@ module Google
856
1364
  #
857
1365
  attr_reader :list_schemas
858
1366
  ##
1367
+ # RPC-specific configuration for `list_schema_revisions`
1368
+ # @return [::Gapic::Config::Method]
1369
+ #
1370
+ attr_reader :list_schema_revisions
1371
+ ##
1372
+ # RPC-specific configuration for `commit_schema`
1373
+ # @return [::Gapic::Config::Method]
1374
+ #
1375
+ attr_reader :commit_schema
1376
+ ##
1377
+ # RPC-specific configuration for `rollback_schema`
1378
+ # @return [::Gapic::Config::Method]
1379
+ #
1380
+ attr_reader :rollback_schema
1381
+ ##
1382
+ # RPC-specific configuration for `delete_schema_revision`
1383
+ # @return [::Gapic::Config::Method]
1384
+ #
1385
+ attr_reader :delete_schema_revision
1386
+ ##
859
1387
  # RPC-specific configuration for `delete_schema`
860
1388
  # @return [::Gapic::Config::Method]
861
1389
  #
@@ -879,6 +1407,14 @@ module Google
879
1407
  @get_schema = ::Gapic::Config::Method.new get_schema_config
880
1408
  list_schemas_config = parent_rpcs.list_schemas if parent_rpcs.respond_to? :list_schemas
881
1409
  @list_schemas = ::Gapic::Config::Method.new list_schemas_config
1410
+ list_schema_revisions_config = parent_rpcs.list_schema_revisions if parent_rpcs.respond_to? :list_schema_revisions
1411
+ @list_schema_revisions = ::Gapic::Config::Method.new list_schema_revisions_config
1412
+ commit_schema_config = parent_rpcs.commit_schema if parent_rpcs.respond_to? :commit_schema
1413
+ @commit_schema = ::Gapic::Config::Method.new commit_schema_config
1414
+ rollback_schema_config = parent_rpcs.rollback_schema if parent_rpcs.respond_to? :rollback_schema
1415
+ @rollback_schema = ::Gapic::Config::Method.new rollback_schema_config
1416
+ delete_schema_revision_config = parent_rpcs.delete_schema_revision if parent_rpcs.respond_to? :delete_schema_revision
1417
+ @delete_schema_revision = ::Gapic::Config::Method.new delete_schema_revision_config
882
1418
  delete_schema_config = parent_rpcs.delete_schema if parent_rpcs.respond_to? :delete_schema
883
1419
  @delete_schema = ::Gapic::Config::Method.new delete_schema_config
884
1420
  validate_schema_config = parent_rpcs.validate_schema if parent_rpcs.respond_to? :validate_schema