google-cloud-pubsub-v1 0.1.2 → 0.4.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.
@@ -16,6 +16,7 @@
16
16
 
17
17
  # Auto-generated by gapic-generator-ruby. DO NOT EDIT!
18
18
 
19
+ require "google/cloud/pubsub/v1/schema_service"
19
20
  require "google/cloud/pubsub/v1/publisher"
20
21
  require "google/cloud/pubsub/v1/subscriber"
21
22
  require "google/cloud/pubsub/v1/iam_policy"
@@ -28,10 +29,13 @@ module Google
28
29
  # To load this package, including all its services, and instantiate a client:
29
30
  #
30
31
  # require "google/cloud/pubsub/v1"
31
- # client = ::Google::Cloud::PubSub::V1::Publisher::Client.new
32
+ # client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new
32
33
  #
33
34
  module V1
34
35
  end
35
36
  end
36
37
  end
37
38
  end
39
+
40
+ helper_path = ::File.join __dir__, "v1", "_helpers.rb"
41
+ require "google/cloud/pubsub/v1/_helpers" if ::File.file? helper_path
@@ -82,7 +82,7 @@ module Google
82
82
  parent_config = while namespace.any?
83
83
  parent_name = namespace.join "::"
84
84
  parent_const = const_get parent_name
85
- break parent_const.configure if parent_const&.respond_to? :configure
85
+ break parent_const.configure if parent_const.respond_to? :configure
86
86
  namespace.pop
87
87
  end
88
88
  default_config = Client::Configuration.new parent_config
@@ -148,7 +148,13 @@ module Google
148
148
 
149
149
  # Create credentials
150
150
  credentials = @config.credentials
151
- credentials ||= Credentials.default scope: @config.scope
151
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
152
+ # but only if the default endpoint does not have a region prefix.
153
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
154
+ @config.endpoint == Client.configure.endpoint &&
155
+ !@config.endpoint.split(".").first.include?("-")
156
+ credentials ||= Credentials.default scope: @config.scope,
157
+ enable_self_signed_jwt: enable_self_signed_jwt
152
158
  if credentials.is_a?(String) || credentials.is_a?(Hash)
153
159
  credentials = Credentials.new credentials, scope: @config.scope
154
160
  end
@@ -481,7 +487,7 @@ module Google
481
487
  config_attr :scope, nil, ::String, ::Array, nil
482
488
  config_attr :lib_name, nil, ::String, nil
483
489
  config_attr :lib_version, nil, ::String, nil
484
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
490
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
485
491
  config_attr :interceptors, nil, ::Array, nil
486
492
  config_attr :timeout, nil, ::Numeric, nil
487
493
  config_attr :metadata, nil, ::Hash, nil
@@ -502,7 +508,7 @@ module Google
502
508
  def rpcs
503
509
  @rpcs ||= begin
504
510
  parent_rpcs = nil
505
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
511
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
506
512
  Rpcs.new parent_rpcs
507
513
  end
508
514
  end
@@ -514,7 +520,7 @@ module Google
514
520
  # Each configuration object is of type `Gapic::Config::Method` and includes
515
521
  # the following configuration fields:
516
522
  #
517
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
523
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
518
524
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
519
525
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
520
526
  # include the following keys:
@@ -543,11 +549,11 @@ module Google
543
549
 
544
550
  # @private
545
551
  def initialize parent_rpcs = nil
546
- set_iam_policy_config = parent_rpcs&.set_iam_policy if parent_rpcs&.respond_to? :set_iam_policy
552
+ set_iam_policy_config = parent_rpcs.set_iam_policy if parent_rpcs.respond_to? :set_iam_policy
547
553
  @set_iam_policy = ::Gapic::Config::Method.new set_iam_policy_config
548
- get_iam_policy_config = parent_rpcs&.get_iam_policy if parent_rpcs&.respond_to? :get_iam_policy
554
+ get_iam_policy_config = parent_rpcs.get_iam_policy if parent_rpcs.respond_to? :get_iam_policy
549
555
  @get_iam_policy = ::Gapic::Config::Method.new get_iam_policy_config
550
- test_iam_permissions_config = parent_rpcs&.test_iam_permissions if parent_rpcs&.respond_to? :test_iam_permissions
556
+ test_iam_permissions_config = parent_rpcs.test_iam_permissions if parent_rpcs.respond_to? :test_iam_permissions
551
557
  @test_iam_permissions = ::Gapic::Config::Method.new test_iam_permissions_config
552
558
 
553
559
  yield self if block_given?
@@ -61,7 +61,7 @@ module Google
61
61
  parent_config = while namespace.any?
62
62
  parent_name = namespace.join "::"
63
63
  parent_const = const_get parent_name
64
- break parent_const.configure if parent_const&.respond_to? :configure
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
65
  namespace.pop
66
66
  end
67
67
  default_config = Client::Configuration.new parent_config
@@ -69,73 +69,73 @@ module Google
69
69
  default_config.rpcs.create_topic.timeout = 60.0
70
70
  default_config.rpcs.create_topic.retry_policy = {
71
71
  initial_delay: 0.1,
72
- max_delay: 60.0,
73
- multiplier: 1.3,
74
- retry_codes: [14]
72
+ max_delay: 60.0,
73
+ multiplier: 1.3,
74
+ retry_codes: [14]
75
75
  }
76
76
 
77
77
  default_config.rpcs.update_topic.timeout = 60.0
78
78
  default_config.rpcs.update_topic.retry_policy = {
79
79
  initial_delay: 0.1,
80
- max_delay: 60.0,
81
- multiplier: 1.3,
82
- retry_codes: [14]
80
+ max_delay: 60.0,
81
+ multiplier: 1.3,
82
+ retry_codes: [14]
83
83
  }
84
84
 
85
85
  default_config.rpcs.publish.timeout = 60.0
86
86
  default_config.rpcs.publish.retry_policy = {
87
87
  initial_delay: 0.1,
88
- max_delay: 60.0,
89
- multiplier: 1.3,
90
- retry_codes: [10, 1, 13, 8, 2, 14, 4]
88
+ max_delay: 60.0,
89
+ multiplier: 1.3,
90
+ retry_codes: [10, 1, 13, 8, 2, 14, 4]
91
91
  }
92
92
 
93
93
  default_config.rpcs.get_topic.timeout = 60.0
94
94
  default_config.rpcs.get_topic.retry_policy = {
95
95
  initial_delay: 0.1,
96
- max_delay: 60.0,
97
- multiplier: 1.3,
98
- retry_codes: [2, 10, 14]
96
+ max_delay: 60.0,
97
+ multiplier: 1.3,
98
+ retry_codes: [2, 10, 14]
99
99
  }
100
100
 
101
101
  default_config.rpcs.list_topics.timeout = 60.0
102
102
  default_config.rpcs.list_topics.retry_policy = {
103
103
  initial_delay: 0.1,
104
- max_delay: 60.0,
105
- multiplier: 1.3,
106
- retry_codes: [2, 10, 14]
104
+ max_delay: 60.0,
105
+ multiplier: 1.3,
106
+ retry_codes: [2, 10, 14]
107
107
  }
108
108
 
109
109
  default_config.rpcs.list_topic_subscriptions.timeout = 60.0
110
110
  default_config.rpcs.list_topic_subscriptions.retry_policy = {
111
111
  initial_delay: 0.1,
112
- max_delay: 60.0,
113
- multiplier: 1.3,
114
- retry_codes: [2, 10, 14]
112
+ max_delay: 60.0,
113
+ multiplier: 1.3,
114
+ retry_codes: [2, 10, 14]
115
115
  }
116
116
 
117
117
  default_config.rpcs.list_topic_snapshots.timeout = 60.0
118
118
  default_config.rpcs.list_topic_snapshots.retry_policy = {
119
119
  initial_delay: 0.1,
120
- max_delay: 60.0,
121
- multiplier: 1.3,
122
- retry_codes: [2, 10, 14]
120
+ max_delay: 60.0,
121
+ multiplier: 1.3,
122
+ retry_codes: [2, 10, 14]
123
123
  }
124
124
 
125
125
  default_config.rpcs.delete_topic.timeout = 60.0
126
126
  default_config.rpcs.delete_topic.retry_policy = {
127
127
  initial_delay: 0.1,
128
- max_delay: 60.0,
129
- multiplier: 1.3,
130
- retry_codes: [14]
128
+ max_delay: 60.0,
129
+ multiplier: 1.3,
130
+ retry_codes: [14]
131
131
  }
132
132
 
133
133
  default_config.rpcs.detach_subscription.timeout = 60.0
134
134
  default_config.rpcs.detach_subscription.retry_policy = {
135
135
  initial_delay: 0.1,
136
- max_delay: 60.0,
137
- multiplier: 1.3,
138
- retry_codes: [14]
136
+ max_delay: 60.0,
137
+ multiplier: 1.3,
138
+ retry_codes: [14]
139
139
  }
140
140
 
141
141
  default_config
@@ -199,7 +199,13 @@ module Google
199
199
 
200
200
  # Create credentials
201
201
  credentials = @config.credentials
202
- credentials ||= Credentials.default scope: @config.scope
202
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
203
+ # but only if the default endpoint does not have a region prefix.
204
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
205
+ @config.endpoint == Client.configure.endpoint &&
206
+ !@config.endpoint.split(".").first.include?("-")
207
+ credentials ||= Credentials.default scope: @config.scope,
208
+ enable_self_signed_jwt: enable_self_signed_jwt
203
209
  if credentials.is_a?(String) || credentials.is_a?(Hash)
204
210
  credentials = Credentials.new credentials, scope: @config.scope
205
211
  end
@@ -218,8 +224,8 @@ module Google
218
224
  # Service calls
219
225
 
220
226
  ##
221
- # Creates the given topic with the given name. See the [resource name rules](
222
- # https://cloud.google.com/pubsub/docs/admin#resource_names).
227
+ # Creates the given topic with the given name. See the [resource name rules]
228
+ # (https://cloud.google.com/pubsub/docs/admin#resource_names).
223
229
  #
224
230
  # @overload create_topic(request, options = nil)
225
231
  # Pass arguments to `create_topic` via a request object, either of type
@@ -231,7 +237,7 @@ module Google
231
237
  # @param options [::Gapic::CallOptions, ::Hash]
232
238
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
233
239
  #
234
- # @overload create_topic(name: nil, labels: nil, message_storage_policy: nil, kms_key_name: nil)
240
+ # @overload create_topic(name: nil, labels: nil, message_storage_policy: nil, kms_key_name: nil, schema_settings: nil, satisfies_pzs: nil)
235
241
  # Pass arguments to `create_topic` via keyword arguments. Note that at
236
242
  # least one keyword argument is required. To specify no parameters, or to keep all
237
243
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -255,6 +261,11 @@ module Google
255
261
  # to messages published on this topic.
256
262
  #
257
263
  # The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`.
264
+ # @param schema_settings [::Google::Cloud::PubSub::V1::SchemaSettings, ::Hash]
265
+ # Settings for validating messages published against a schema.
266
+ # @param satisfies_pzs [::Boolean]
267
+ # Reserved for future use. This field is set only in responses from the
268
+ # server; it is ignored if it is set in any requests.
258
269
  #
259
270
  # @yield [response, operation] Access the result along with the RPC operation
260
271
  # @yieldparam response [::Google::Cloud::PubSub::V1::Topic]
@@ -968,7 +979,7 @@ module Google
968
979
  config_attr :scope, nil, ::String, ::Array, nil
969
980
  config_attr :lib_name, nil, ::String, nil
970
981
  config_attr :lib_version, nil, ::String, nil
971
- config_attr(:channel_args, { "grpc.service_config_disable_resolution"=>1 }, ::Hash, nil)
982
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
972
983
  config_attr :interceptors, nil, ::Array, nil
973
984
  config_attr :timeout, nil, ::Numeric, nil
974
985
  config_attr :metadata, nil, ::Hash, nil
@@ -989,7 +1000,7 @@ module Google
989
1000
  def rpcs
990
1001
  @rpcs ||= begin
991
1002
  parent_rpcs = nil
992
- parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config&.respond_to?(:rpcs)
1003
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
993
1004
  Rpcs.new parent_rpcs
994
1005
  end
995
1006
  end
@@ -1001,7 +1012,7 @@ module Google
1001
1012
  # Each configuration object is of type `Gapic::Config::Method` and includes
1002
1013
  # the following configuration fields:
1003
1014
  #
1004
- # * `timeout` (*type:* `Numeric`) - The call timeout in milliseconds
1015
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
1005
1016
  # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
1006
1017
  # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
1007
1018
  # include the following keys:
@@ -1060,23 +1071,23 @@ module Google
1060
1071
 
1061
1072
  # @private
1062
1073
  def initialize parent_rpcs = nil
1063
- create_topic_config = parent_rpcs&.create_topic if parent_rpcs&.respond_to? :create_topic
1074
+ create_topic_config = parent_rpcs.create_topic if parent_rpcs.respond_to? :create_topic
1064
1075
  @create_topic = ::Gapic::Config::Method.new create_topic_config
1065
- update_topic_config = parent_rpcs&.update_topic if parent_rpcs&.respond_to? :update_topic
1076
+ update_topic_config = parent_rpcs.update_topic if parent_rpcs.respond_to? :update_topic
1066
1077
  @update_topic = ::Gapic::Config::Method.new update_topic_config
1067
- publish_config = parent_rpcs&.publish if parent_rpcs&.respond_to? :publish
1078
+ publish_config = parent_rpcs.publish if parent_rpcs.respond_to? :publish
1068
1079
  @publish = ::Gapic::Config::Method.new publish_config
1069
- get_topic_config = parent_rpcs&.get_topic if parent_rpcs&.respond_to? :get_topic
1080
+ get_topic_config = parent_rpcs.get_topic if parent_rpcs.respond_to? :get_topic
1070
1081
  @get_topic = ::Gapic::Config::Method.new get_topic_config
1071
- list_topics_config = parent_rpcs&.list_topics if parent_rpcs&.respond_to? :list_topics
1082
+ list_topics_config = parent_rpcs.list_topics if parent_rpcs.respond_to? :list_topics
1072
1083
  @list_topics = ::Gapic::Config::Method.new list_topics_config
1073
- list_topic_subscriptions_config = parent_rpcs&.list_topic_subscriptions if parent_rpcs&.respond_to? :list_topic_subscriptions
1084
+ list_topic_subscriptions_config = parent_rpcs.list_topic_subscriptions if parent_rpcs.respond_to? :list_topic_subscriptions
1074
1085
  @list_topic_subscriptions = ::Gapic::Config::Method.new list_topic_subscriptions_config
1075
- list_topic_snapshots_config = parent_rpcs&.list_topic_snapshots if parent_rpcs&.respond_to? :list_topic_snapshots
1086
+ list_topic_snapshots_config = parent_rpcs.list_topic_snapshots if parent_rpcs.respond_to? :list_topic_snapshots
1076
1087
  @list_topic_snapshots = ::Gapic::Config::Method.new list_topic_snapshots_config
1077
- delete_topic_config = parent_rpcs&.delete_topic if parent_rpcs&.respond_to? :delete_topic
1088
+ delete_topic_config = parent_rpcs.delete_topic if parent_rpcs.respond_to? :delete_topic
1078
1089
  @delete_topic = ::Gapic::Config::Method.new delete_topic_config
1079
- detach_subscription_config = parent_rpcs&.detach_subscription if parent_rpcs&.respond_to? :detach_subscription
1090
+ detach_subscription_config = parent_rpcs.detach_subscription if parent_rpcs.respond_to? :detach_subscription
1080
1091
  @detach_subscription = ::Gapic::Config::Method.new detach_subscription_config
1081
1092
 
1082
1093
  yield self if block_given?
@@ -38,6 +38,23 @@ module Google
38
38
  "projects/#{project}"
39
39
  end
40
40
 
41
+ ##
42
+ # Create a fully-qualified Schema resource string.
43
+ #
44
+ # The resource will be in the following format:
45
+ #
46
+ # `projects/{project}/schemas/{schema}`
47
+ #
48
+ # @param project [String]
49
+ # @param schema [String]
50
+ #
51
+ # @return [::String]
52
+ def schema_path project:, schema:
53
+ raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"
54
+
55
+ "projects/#{project}/schemas/#{schema}"
56
+ end
57
+
41
58
  ##
42
59
  # Create a fully-qualified Subscription resource string.
43
60
  #
@@ -79,7 +96,7 @@ module Google
79
96
 
80
97
  "projects/#{project}/topics/#{topic}"
81
98
  end),
82
- "" => (proc do
99
+ "" => (proc do
83
100
  "_deleted-topic_"
84
101
  end)
85
102
  }
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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 "gapic/common"
20
+ require "gapic/config"
21
+ require "gapic/config/method"
22
+
23
+ require "google/cloud/pubsub/v1/version"
24
+
25
+ require "google/cloud/pubsub/v1/schema_service/credentials"
26
+ require "google/cloud/pubsub/v1/schema_service/paths"
27
+ require "google/cloud/pubsub/v1/schema_service/client"
28
+
29
+ module Google
30
+ module Cloud
31
+ module PubSub
32
+ module V1
33
+ ##
34
+ # Service for doing schema-related operations.
35
+ #
36
+ # To load this service and instantiate a client:
37
+ #
38
+ # require "google/cloud/pubsub/v1/schema_service"
39
+ # client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new
40
+ #
41
+ module SchemaService
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ helper_path = ::File.join __dir__, "schema_service", "helpers.rb"
49
+ require "google/cloud/pubsub/v1/schema_service/helpers" if ::File.file? helper_path
@@ -0,0 +1,785 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2020 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/schema_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module PubSub
25
+ module V1
26
+ module SchemaService
27
+ ##
28
+ # Client for the SchemaService service.
29
+ #
30
+ # Service for doing schema-related operations.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :schema_service_stub
37
+
38
+ ##
39
+ # Configure the SchemaService Client class.
40
+ #
41
+ # See {::Google::Cloud::PubSub::V1::SchemaService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # ## Example
45
+ #
46
+ # To modify the configuration for all SchemaService clients:
47
+ #
48
+ # ::Google::Cloud::PubSub::V1::SchemaService::Client.configure do |config|
49
+ # config.timeout = 10.0
50
+ # end
51
+ #
52
+ # @yield [config] Configure the Client client.
53
+ # @yieldparam config [Client::Configuration]
54
+ #
55
+ # @return [Client::Configuration]
56
+ #
57
+ def self.configure
58
+ @configure ||= begin
59
+ namespace = ["Google", "Cloud", "PubSub", "V1"]
60
+ parent_config = while namespace.any?
61
+ parent_name = namespace.join "::"
62
+ parent_const = const_get parent_name
63
+ break parent_const.configure if parent_const.respond_to? :configure
64
+ namespace.pop
65
+ end
66
+ default_config = Client::Configuration.new parent_config
67
+
68
+ default_config
69
+ end
70
+ yield @configure if block_given?
71
+ @configure
72
+ end
73
+
74
+ ##
75
+ # Configure the SchemaService Client instance.
76
+ #
77
+ # The configuration is set to the derived mode, meaning that values can be changed,
78
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
79
+ # should be made on {Client.configure}.
80
+ #
81
+ # See {::Google::Cloud::PubSub::V1::SchemaService::Client::Configuration}
82
+ # for a description of the configuration fields.
83
+ #
84
+ # @yield [config] Configure the Client client.
85
+ # @yieldparam config [Client::Configuration]
86
+ #
87
+ # @return [Client::Configuration]
88
+ #
89
+ def configure
90
+ yield @config if block_given?
91
+ @config
92
+ end
93
+
94
+ ##
95
+ # Create a new SchemaService client object.
96
+ #
97
+ # ## Examples
98
+ #
99
+ # To create a new SchemaService client with the default
100
+ # configuration:
101
+ #
102
+ # client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new
103
+ #
104
+ # To create a new SchemaService client with a custom
105
+ # configuration:
106
+ #
107
+ # client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
110
+ #
111
+ # @yield [config] Configure the SchemaService client.
112
+ # @yieldparam config [Client::Configuration]
113
+ #
114
+ def initialize
115
+ # These require statements are intentionally placed here to initialize
116
+ # the gRPC module only when it's required.
117
+ # See https://github.com/googleapis/toolkit/issues/446
118
+ require "gapic/grpc"
119
+ require "google/pubsub/v1/schema_services_pb"
120
+
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ # Use self-signed JWT if the scope and endpoint are unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.scope == Client.configure.scope &&
132
+ @config.endpoint == Client.configure.endpoint &&
133
+ !@config.endpoint.split(".").first.include?("-")
134
+ credentials ||= Credentials.default scope: @config.scope,
135
+ enable_self_signed_jwt: enable_self_signed_jwt
136
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
137
+ credentials = Credentials.new credentials, scope: @config.scope
138
+ end
139
+ @quota_project_id = @config.quota_project
140
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
141
+
142
+ @schema_service_stub = ::Gapic::ServiceStub.new(
143
+ ::Google::Cloud::PubSub::V1::SchemaService::Stub,
144
+ credentials: credentials,
145
+ endpoint: @config.endpoint,
146
+ channel_args: @config.channel_args,
147
+ interceptors: @config.interceptors
148
+ )
149
+ end
150
+
151
+ # Service calls
152
+
153
+ ##
154
+ # Creates a schema.
155
+ #
156
+ # @overload create_schema(request, options = nil)
157
+ # Pass arguments to `create_schema` via a request object, either of type
158
+ # {::Google::Cloud::PubSub::V1::CreateSchemaRequest} or an equivalent Hash.
159
+ #
160
+ # @param request [::Google::Cloud::PubSub::V1::CreateSchemaRequest, ::Hash]
161
+ # A request object representing the call parameters. Required. To specify no
162
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
163
+ # @param options [::Gapic::CallOptions, ::Hash]
164
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
165
+ #
166
+ # @overload create_schema(parent: nil, schema: nil, schema_id: nil)
167
+ # Pass arguments to `create_schema` via keyword arguments. Note that at
168
+ # least one keyword argument is required. To specify no parameters, or to keep all
169
+ # the default parameter values, pass an empty Hash as a request object (see above).
170
+ #
171
+ # @param parent [::String]
172
+ # Required. The name of the project in which to create the schema.
173
+ # Format is `projects/{project-id}`.
174
+ # @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
175
+ # Required. The schema object to create.
176
+ #
177
+ # This schema's `name` parameter is ignored. The schema object returned
178
+ # by CreateSchema will have a `name` made using the given `parent` and
179
+ # `schema_id`.
180
+ # @param schema_id [::String]
181
+ # The ID to use for the schema, which will become the final component of
182
+ # the schema's resource name.
183
+ #
184
+ # See https://cloud.google.com/pubsub/docs/admin#resource_names for resource
185
+ # name constraints.
186
+ #
187
+ # @yield [response, operation] Access the result along with the RPC operation
188
+ # @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
189
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
190
+ #
191
+ # @return [::Google::Cloud::PubSub::V1::Schema]
192
+ #
193
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
194
+ #
195
+ def create_schema request, options = nil
196
+ raise ::ArgumentError, "request must be provided" if request.nil?
197
+
198
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::CreateSchemaRequest
199
+
200
+ # Converts hash and nil to an options object
201
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
202
+
203
+ # Customize the options with defaults
204
+ metadata = @config.rpcs.create_schema.metadata.to_h
205
+
206
+ # Set x-goog-api-client and x-goog-user-project headers
207
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
208
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
209
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
210
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
211
+
212
+ header_params = {
213
+ "parent" => request.parent
214
+ }
215
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
216
+ metadata[:"x-goog-request-params"] ||= request_params_header
217
+
218
+ options.apply_defaults timeout: @config.rpcs.create_schema.timeout,
219
+ metadata: metadata,
220
+ retry_policy: @config.rpcs.create_schema.retry_policy
221
+ options.apply_defaults metadata: @config.metadata,
222
+ retry_policy: @config.retry_policy
223
+
224
+ @schema_service_stub.call_rpc :create_schema, request, options: options do |response, operation|
225
+ yield response, operation if block_given?
226
+ return response
227
+ end
228
+ rescue ::GRPC::BadStatus => e
229
+ raise ::Google::Cloud::Error.from_error(e)
230
+ end
231
+
232
+ ##
233
+ # Gets a schema.
234
+ #
235
+ # @overload get_schema(request, options = nil)
236
+ # Pass arguments to `get_schema` via a request object, either of type
237
+ # {::Google::Cloud::PubSub::V1::GetSchemaRequest} or an equivalent Hash.
238
+ #
239
+ # @param request [::Google::Cloud::PubSub::V1::GetSchemaRequest, ::Hash]
240
+ # A request object representing the call parameters. Required. To specify no
241
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
242
+ # @param options [::Gapic::CallOptions, ::Hash]
243
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
244
+ #
245
+ # @overload get_schema(name: nil, view: nil)
246
+ # Pass arguments to `get_schema` via keyword arguments. Note that at
247
+ # least one keyword argument is required. To specify no parameters, or to keep all
248
+ # the default parameter values, pass an empty Hash as a request object (see above).
249
+ #
250
+ # @param name [::String]
251
+ # Required. The name of the schema to get.
252
+ # Format is `projects/{project}/schemas/{schema}`.
253
+ # @param view [::Google::Cloud::PubSub::V1::SchemaView]
254
+ # The set of fields to return in the response. If not set, returns a Schema
255
+ # with `name` and `type`, but not `definition`. Set to `FULL` to retrieve all
256
+ # fields.
257
+ #
258
+ # @yield [response, operation] Access the result along with the RPC operation
259
+ # @yieldparam response [::Google::Cloud::PubSub::V1::Schema]
260
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
261
+ #
262
+ # @return [::Google::Cloud::PubSub::V1::Schema]
263
+ #
264
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
265
+ #
266
+ def get_schema request, options = nil
267
+ raise ::ArgumentError, "request must be provided" if request.nil?
268
+
269
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::GetSchemaRequest
270
+
271
+ # Converts hash and nil to an options object
272
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
273
+
274
+ # Customize the options with defaults
275
+ metadata = @config.rpcs.get_schema.metadata.to_h
276
+
277
+ # Set x-goog-api-client and x-goog-user-project headers
278
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
279
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
280
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
281
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
282
+
283
+ header_params = {
284
+ "name" => request.name
285
+ }
286
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
287
+ metadata[:"x-goog-request-params"] ||= request_params_header
288
+
289
+ options.apply_defaults timeout: @config.rpcs.get_schema.timeout,
290
+ metadata: metadata,
291
+ retry_policy: @config.rpcs.get_schema.retry_policy
292
+ options.apply_defaults metadata: @config.metadata,
293
+ retry_policy: @config.retry_policy
294
+
295
+ @schema_service_stub.call_rpc :get_schema, request, options: options do |response, operation|
296
+ yield response, operation if block_given?
297
+ return response
298
+ end
299
+ rescue ::GRPC::BadStatus => e
300
+ raise ::Google::Cloud::Error.from_error(e)
301
+ end
302
+
303
+ ##
304
+ # Lists schemas in a project.
305
+ #
306
+ # @overload list_schemas(request, options = nil)
307
+ # Pass arguments to `list_schemas` via a request object, either of type
308
+ # {::Google::Cloud::PubSub::V1::ListSchemasRequest} or an equivalent Hash.
309
+ #
310
+ # @param request [::Google::Cloud::PubSub::V1::ListSchemasRequest, ::Hash]
311
+ # A request object representing the call parameters. Required. To specify no
312
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
313
+ # @param options [::Gapic::CallOptions, ::Hash]
314
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
315
+ #
316
+ # @overload list_schemas(parent: nil, view: nil, page_size: nil, page_token: nil)
317
+ # Pass arguments to `list_schemas` via keyword arguments. Note that at
318
+ # least one keyword argument is required. To specify no parameters, or to keep all
319
+ # the default parameter values, pass an empty Hash as a request object (see above).
320
+ #
321
+ # @param parent [::String]
322
+ # Required. The name of the project in which to list schemas.
323
+ # Format is `projects/{project-id}`.
324
+ # @param view [::Google::Cloud::PubSub::V1::SchemaView]
325
+ # The set of Schema fields to return in the response. If not set, returns
326
+ # Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
327
+ # retrieve all fields.
328
+ # @param page_size [::Integer]
329
+ # Maximum number of schemas to return.
330
+ # @param page_token [::String]
331
+ # The value returned by the last `ListSchemasResponse`; indicates that
332
+ # this is a continuation of a prior `ListSchemas` call, and that the
333
+ # system should return the next page of data.
334
+ #
335
+ # @yield [response, operation] Access the result along with the RPC operation
336
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>]
337
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
338
+ #
339
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>]
340
+ #
341
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
342
+ #
343
+ def list_schemas request, options = nil
344
+ raise ::ArgumentError, "request must be provided" if request.nil?
345
+
346
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListSchemasRequest
347
+
348
+ # Converts hash and nil to an options object
349
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
350
+
351
+ # Customize the options with defaults
352
+ metadata = @config.rpcs.list_schemas.metadata.to_h
353
+
354
+ # Set x-goog-api-client and x-goog-user-project headers
355
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
356
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
357
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
358
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
359
+
360
+ header_params = {
361
+ "parent" => request.parent
362
+ }
363
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
364
+ metadata[:"x-goog-request-params"] ||= request_params_header
365
+
366
+ options.apply_defaults timeout: @config.rpcs.list_schemas.timeout,
367
+ metadata: metadata,
368
+ retry_policy: @config.rpcs.list_schemas.retry_policy
369
+ options.apply_defaults metadata: @config.metadata,
370
+ retry_policy: @config.retry_policy
371
+
372
+ @schema_service_stub.call_rpc :list_schemas, request, options: options do |response, operation|
373
+ response = ::Gapic::PagedEnumerable.new @schema_service_stub, :list_schemas, request, response, operation, options
374
+ yield response, operation if block_given?
375
+ return response
376
+ end
377
+ rescue ::GRPC::BadStatus => e
378
+ raise ::Google::Cloud::Error.from_error(e)
379
+ end
380
+
381
+ ##
382
+ # Deletes a schema.
383
+ #
384
+ # @overload delete_schema(request, options = nil)
385
+ # Pass arguments to `delete_schema` via a request object, either of type
386
+ # {::Google::Cloud::PubSub::V1::DeleteSchemaRequest} or an equivalent Hash.
387
+ #
388
+ # @param request [::Google::Cloud::PubSub::V1::DeleteSchemaRequest, ::Hash]
389
+ # A request object representing the call parameters. Required. To specify no
390
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
391
+ # @param options [::Gapic::CallOptions, ::Hash]
392
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
393
+ #
394
+ # @overload delete_schema(name: nil)
395
+ # Pass arguments to `delete_schema` via keyword arguments. Note that at
396
+ # least one keyword argument is required. To specify no parameters, or to keep all
397
+ # the default parameter values, pass an empty Hash as a request object (see above).
398
+ #
399
+ # @param name [::String]
400
+ # Required. Name of the schema to delete.
401
+ # Format is `projects/{project}/schemas/{schema}`.
402
+ #
403
+ # @yield [response, operation] Access the result along with the RPC operation
404
+ # @yieldparam response [::Google::Protobuf::Empty]
405
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
406
+ #
407
+ # @return [::Google::Protobuf::Empty]
408
+ #
409
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
410
+ #
411
+ def delete_schema request, options = nil
412
+ raise ::ArgumentError, "request must be provided" if request.nil?
413
+
414
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::DeleteSchemaRequest
415
+
416
+ # Converts hash and nil to an options object
417
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
418
+
419
+ # Customize the options with defaults
420
+ metadata = @config.rpcs.delete_schema.metadata.to_h
421
+
422
+ # Set x-goog-api-client and x-goog-user-project headers
423
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
424
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
425
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
426
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
427
+
428
+ header_params = {
429
+ "name" => request.name
430
+ }
431
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
432
+ metadata[:"x-goog-request-params"] ||= request_params_header
433
+
434
+ options.apply_defaults timeout: @config.rpcs.delete_schema.timeout,
435
+ metadata: metadata,
436
+ retry_policy: @config.rpcs.delete_schema.retry_policy
437
+ options.apply_defaults metadata: @config.metadata,
438
+ retry_policy: @config.retry_policy
439
+
440
+ @schema_service_stub.call_rpc :delete_schema, request, options: options do |response, operation|
441
+ yield response, operation if block_given?
442
+ return response
443
+ end
444
+ rescue ::GRPC::BadStatus => e
445
+ raise ::Google::Cloud::Error.from_error(e)
446
+ end
447
+
448
+ ##
449
+ # Validates a schema.
450
+ #
451
+ # @overload validate_schema(request, options = nil)
452
+ # Pass arguments to `validate_schema` via a request object, either of type
453
+ # {::Google::Cloud::PubSub::V1::ValidateSchemaRequest} or an equivalent Hash.
454
+ #
455
+ # @param request [::Google::Cloud::PubSub::V1::ValidateSchemaRequest, ::Hash]
456
+ # A request object representing the call parameters. Required. To specify no
457
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
458
+ # @param options [::Gapic::CallOptions, ::Hash]
459
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
460
+ #
461
+ # @overload validate_schema(parent: nil, schema: nil)
462
+ # Pass arguments to `validate_schema` via keyword arguments. Note that at
463
+ # least one keyword argument is required. To specify no parameters, or to keep all
464
+ # the default parameter values, pass an empty Hash as a request object (see above).
465
+ #
466
+ # @param parent [::String]
467
+ # Required. The name of the project in which to validate schemas.
468
+ # Format is `projects/{project-id}`.
469
+ # @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
470
+ # Required. The schema object to validate.
471
+ #
472
+ # @yield [response, operation] Access the result along with the RPC operation
473
+ # @yieldparam response [::Google::Cloud::PubSub::V1::ValidateSchemaResponse]
474
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
475
+ #
476
+ # @return [::Google::Cloud::PubSub::V1::ValidateSchemaResponse]
477
+ #
478
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
479
+ #
480
+ def validate_schema request, options = nil
481
+ raise ::ArgumentError, "request must be provided" if request.nil?
482
+
483
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ValidateSchemaRequest
484
+
485
+ # Converts hash and nil to an options object
486
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
487
+
488
+ # Customize the options with defaults
489
+ metadata = @config.rpcs.validate_schema.metadata.to_h
490
+
491
+ # Set x-goog-api-client and x-goog-user-project headers
492
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
493
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
494
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
495
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
496
+
497
+ header_params = {
498
+ "parent" => request.parent
499
+ }
500
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
501
+ metadata[:"x-goog-request-params"] ||= request_params_header
502
+
503
+ options.apply_defaults timeout: @config.rpcs.validate_schema.timeout,
504
+ metadata: metadata,
505
+ retry_policy: @config.rpcs.validate_schema.retry_policy
506
+ options.apply_defaults metadata: @config.metadata,
507
+ retry_policy: @config.retry_policy
508
+
509
+ @schema_service_stub.call_rpc :validate_schema, request, options: options do |response, operation|
510
+ yield response, operation if block_given?
511
+ return response
512
+ end
513
+ rescue ::GRPC::BadStatus => e
514
+ raise ::Google::Cloud::Error.from_error(e)
515
+ end
516
+
517
+ ##
518
+ # Validates a message against a schema.
519
+ #
520
+ # @overload validate_message(request, options = nil)
521
+ # Pass arguments to `validate_message` via a request object, either of type
522
+ # {::Google::Cloud::PubSub::V1::ValidateMessageRequest} or an equivalent Hash.
523
+ #
524
+ # @param request [::Google::Cloud::PubSub::V1::ValidateMessageRequest, ::Hash]
525
+ # A request object representing the call parameters. Required. To specify no
526
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
527
+ # @param options [::Gapic::CallOptions, ::Hash]
528
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
529
+ #
530
+ # @overload validate_message(parent: nil, name: nil, schema: nil, message: nil, encoding: nil)
531
+ # Pass arguments to `validate_message` via keyword arguments. Note that at
532
+ # least one keyword argument is required. To specify no parameters, or to keep all
533
+ # the default parameter values, pass an empty Hash as a request object (see above).
534
+ #
535
+ # @param parent [::String]
536
+ # Required. The name of the project in which to validate schemas.
537
+ # Format is `projects/{project-id}`.
538
+ # @param name [::String]
539
+ # Name of the schema against which to validate.
540
+ #
541
+ # Format is `projects/{project}/schemas/{schema}`.
542
+ # @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
543
+ # Ad-hoc schema against which to validate
544
+ # @param message [::String]
545
+ # Message to validate against the provided `schema_spec`.
546
+ # @param encoding [::Google::Cloud::PubSub::V1::Encoding]
547
+ # The encoding expected for messages
548
+ #
549
+ # @yield [response, operation] Access the result along with the RPC operation
550
+ # @yieldparam response [::Google::Cloud::PubSub::V1::ValidateMessageResponse]
551
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
552
+ #
553
+ # @return [::Google::Cloud::PubSub::V1::ValidateMessageResponse]
554
+ #
555
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
556
+ #
557
+ def validate_message request, options = nil
558
+ raise ::ArgumentError, "request must be provided" if request.nil?
559
+
560
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ValidateMessageRequest
561
+
562
+ # Converts hash and nil to an options object
563
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
564
+
565
+ # Customize the options with defaults
566
+ metadata = @config.rpcs.validate_message.metadata.to_h
567
+
568
+ # Set x-goog-api-client and x-goog-user-project headers
569
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
570
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
571
+ gapic_version: ::Google::Cloud::PubSub::V1::VERSION
572
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
573
+
574
+ header_params = {
575
+ "parent" => request.parent
576
+ }
577
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
578
+ metadata[:"x-goog-request-params"] ||= request_params_header
579
+
580
+ options.apply_defaults timeout: @config.rpcs.validate_message.timeout,
581
+ metadata: metadata,
582
+ retry_policy: @config.rpcs.validate_message.retry_policy
583
+ options.apply_defaults metadata: @config.metadata,
584
+ retry_policy: @config.retry_policy
585
+
586
+ @schema_service_stub.call_rpc :validate_message, request, options: options do |response, operation|
587
+ yield response, operation if block_given?
588
+ return response
589
+ end
590
+ rescue ::GRPC::BadStatus => e
591
+ raise ::Google::Cloud::Error.from_error(e)
592
+ end
593
+
594
+ ##
595
+ # Configuration class for the SchemaService API.
596
+ #
597
+ # This class represents the configuration for SchemaService,
598
+ # providing control over timeouts, retry behavior, logging, transport
599
+ # parameters, and other low-level controls. Certain parameters can also be
600
+ # applied individually to specific RPCs. See
601
+ # {::Google::Cloud::PubSub::V1::SchemaService::Client::Configuration::Rpcs}
602
+ # for a list of RPCs that can be configured independently.
603
+ #
604
+ # Configuration can be applied globally to all clients, or to a single client
605
+ # on construction.
606
+ #
607
+ # # Examples
608
+ #
609
+ # To modify the global config, setting the timeout for create_schema
610
+ # to 20 seconds, and all remaining timeouts to 10 seconds:
611
+ #
612
+ # ::Google::Cloud::PubSub::V1::SchemaService::Client.configure do |config|
613
+ # config.timeout = 10.0
614
+ # config.rpcs.create_schema.timeout = 20.0
615
+ # end
616
+ #
617
+ # To apply the above configuration only to a new client:
618
+ #
619
+ # client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config|
620
+ # config.timeout = 10.0
621
+ # config.rpcs.create_schema.timeout = 20.0
622
+ # end
623
+ #
624
+ # @!attribute [rw] endpoint
625
+ # The hostname or hostname:port of the service endpoint.
626
+ # Defaults to `"pubsub.googleapis.com"`.
627
+ # @return [::String]
628
+ # @!attribute [rw] credentials
629
+ # Credentials to send with calls. You may provide any of the following types:
630
+ # * (`String`) The path to a service account key file in JSON format
631
+ # * (`Hash`) A service account key as a Hash
632
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
633
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
634
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
635
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
636
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
637
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
638
+ # * (`nil`) indicating no credentials
639
+ # @return [::Object]
640
+ # @!attribute [rw] scope
641
+ # The OAuth scopes
642
+ # @return [::Array<::String>]
643
+ # @!attribute [rw] lib_name
644
+ # The library name as recorded in instrumentation and logging
645
+ # @return [::String]
646
+ # @!attribute [rw] lib_version
647
+ # The library version as recorded in instrumentation and logging
648
+ # @return [::String]
649
+ # @!attribute [rw] channel_args
650
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
651
+ # `GRPC::Core::Channel` object is provided as the credential.
652
+ # @return [::Hash]
653
+ # @!attribute [rw] interceptors
654
+ # An array of interceptors that are run before calls are executed.
655
+ # @return [::Array<::GRPC::ClientInterceptor>]
656
+ # @!attribute [rw] timeout
657
+ # The call timeout in seconds.
658
+ # @return [::Numeric]
659
+ # @!attribute [rw] metadata
660
+ # Additional gRPC headers to be sent with the call.
661
+ # @return [::Hash{::Symbol=>::String}]
662
+ # @!attribute [rw] retry_policy
663
+ # The retry policy. The value is a hash with the following keys:
664
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
665
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
666
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
667
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
668
+ # trigger a retry.
669
+ # @return [::Hash]
670
+ # @!attribute [rw] quota_project
671
+ # A separate project against which to charge quota.
672
+ # @return [::String]
673
+ #
674
+ class Configuration
675
+ extend ::Gapic::Config
676
+
677
+ config_attr :endpoint, "pubsub.googleapis.com", ::String
678
+ config_attr :credentials, nil do |value|
679
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
680
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
681
+ allowed.any? { |klass| klass === value }
682
+ end
683
+ config_attr :scope, nil, ::String, ::Array, nil
684
+ config_attr :lib_name, nil, ::String, nil
685
+ config_attr :lib_version, nil, ::String, nil
686
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
687
+ config_attr :interceptors, nil, ::Array, nil
688
+ config_attr :timeout, nil, ::Numeric, nil
689
+ config_attr :metadata, nil, ::Hash, nil
690
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
691
+ config_attr :quota_project, nil, ::String, nil
692
+
693
+ # @private
694
+ def initialize parent_config = nil
695
+ @parent_config = parent_config unless parent_config.nil?
696
+
697
+ yield self if block_given?
698
+ end
699
+
700
+ ##
701
+ # Configurations for individual RPCs
702
+ # @return [Rpcs]
703
+ #
704
+ def rpcs
705
+ @rpcs ||= begin
706
+ parent_rpcs = nil
707
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
708
+ Rpcs.new parent_rpcs
709
+ end
710
+ end
711
+
712
+ ##
713
+ # Configuration RPC class for the SchemaService API.
714
+ #
715
+ # Includes fields providing the configuration for each RPC in this service.
716
+ # Each configuration object is of type `Gapic::Config::Method` and includes
717
+ # the following configuration fields:
718
+ #
719
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
720
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
721
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
722
+ # include the following keys:
723
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
724
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
725
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
726
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
727
+ # trigger a retry.
728
+ #
729
+ class Rpcs
730
+ ##
731
+ # RPC-specific configuration for `create_schema`
732
+ # @return [::Gapic::Config::Method]
733
+ #
734
+ attr_reader :create_schema
735
+ ##
736
+ # RPC-specific configuration for `get_schema`
737
+ # @return [::Gapic::Config::Method]
738
+ #
739
+ attr_reader :get_schema
740
+ ##
741
+ # RPC-specific configuration for `list_schemas`
742
+ # @return [::Gapic::Config::Method]
743
+ #
744
+ attr_reader :list_schemas
745
+ ##
746
+ # RPC-specific configuration for `delete_schema`
747
+ # @return [::Gapic::Config::Method]
748
+ #
749
+ attr_reader :delete_schema
750
+ ##
751
+ # RPC-specific configuration for `validate_schema`
752
+ # @return [::Gapic::Config::Method]
753
+ #
754
+ attr_reader :validate_schema
755
+ ##
756
+ # RPC-specific configuration for `validate_message`
757
+ # @return [::Gapic::Config::Method]
758
+ #
759
+ attr_reader :validate_message
760
+
761
+ # @private
762
+ def initialize parent_rpcs = nil
763
+ create_schema_config = parent_rpcs.create_schema if parent_rpcs.respond_to? :create_schema
764
+ @create_schema = ::Gapic::Config::Method.new create_schema_config
765
+ get_schema_config = parent_rpcs.get_schema if parent_rpcs.respond_to? :get_schema
766
+ @get_schema = ::Gapic::Config::Method.new get_schema_config
767
+ list_schemas_config = parent_rpcs.list_schemas if parent_rpcs.respond_to? :list_schemas
768
+ @list_schemas = ::Gapic::Config::Method.new list_schemas_config
769
+ delete_schema_config = parent_rpcs.delete_schema if parent_rpcs.respond_to? :delete_schema
770
+ @delete_schema = ::Gapic::Config::Method.new delete_schema_config
771
+ validate_schema_config = parent_rpcs.validate_schema if parent_rpcs.respond_to? :validate_schema
772
+ @validate_schema = ::Gapic::Config::Method.new validate_schema_config
773
+ validate_message_config = parent_rpcs.validate_message if parent_rpcs.respond_to? :validate_message
774
+ @validate_message = ::Gapic::Config::Method.new validate_message_config
775
+
776
+ yield self if block_given?
777
+ end
778
+ end
779
+ end
780
+ end
781
+ end
782
+ end
783
+ end
784
+ end
785
+ end