google-cloud-pubsub-v1 1.15.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/lib/google/cloud/pubsub/v1/bindings_override.rb +158 -0
- data/lib/google/cloud/pubsub/v1/rest.rb +40 -0
- data/lib/google/cloud/pubsub/v1/schema_service/client.rb +3 -1
- data/lib/google/cloud/pubsub/v1/schema_service/credentials.rb +1 -1
- data/lib/google/cloud/pubsub/v1/schema_service/paths.rb +1 -1
- data/lib/google/cloud/pubsub/v1/schema_service/rest/client.rb +1348 -0
- data/lib/google/cloud/pubsub/v1/schema_service/rest/service_stub.rb +696 -0
- data/lib/google/cloud/pubsub/v1/schema_service/rest.rb +53 -0
- data/lib/google/cloud/pubsub/v1/schema_service.rb +7 -1
- data/lib/google/cloud/pubsub/v1/subscription_admin/client.rb +9 -5
- data/lib/google/cloud/pubsub/v1/subscription_admin/credentials.rb +1 -1
- data/lib/google/cloud/pubsub/v1/subscription_admin/paths.rb +1 -1
- data/lib/google/cloud/pubsub/v1/subscription_admin/rest/client.rb +2035 -0
- data/lib/google/cloud/pubsub/v1/subscription_admin/rest/service_stub.rb +1005 -0
- data/lib/google/cloud/pubsub/v1/subscription_admin/rest.rb +55 -0
- data/lib/google/cloud/pubsub/v1/subscription_admin.rb +7 -1
- data/lib/google/cloud/pubsub/v1/topic_admin/client.rb +6 -3
- data/lib/google/cloud/pubsub/v1/topic_admin/credentials.rb +1 -1
- data/lib/google/cloud/pubsub/v1/topic_admin/paths.rb +1 -1
- data/lib/google/cloud/pubsub/v1/topic_admin/rest/client.rb +1274 -0
- data/lib/google/cloud/pubsub/v1/topic_admin/rest/service_stub.rb +633 -0
- data/lib/google/cloud/pubsub/v1/topic_admin/rest.rb +54 -0
- data/lib/google/cloud/pubsub/v1/topic_admin.rb +7 -1
- data/lib/google/cloud/pubsub/v1/version.rb +1 -1
- data/lib/google/cloud/pubsub/v1.rb +6 -1
- data/lib/google/pubsub/v1/pubsub_pb.rb +4 -1
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +1 -1
- data/lib/google/pubsub/v1/schema_pb.rb +2 -1
- data/lib/google/pubsub/v1/schema_services_pb.rb +1 -1
- data/lib/google-cloud-pubsub-v1.rb +1 -1
- data/proto_docs/google/api/client.rb +1 -1
- data/proto_docs/google/api/field_behavior.rb +1 -1
- data/proto_docs/google/api/launch_stage.rb +1 -1
- data/proto_docs/google/api/resource.rb +1 -1
- data/proto_docs/google/protobuf/duration.rb +1 -1
- data/proto_docs/google/protobuf/empty.rb +1 -1
- data/proto_docs/google/protobuf/field_mask.rb +1 -1
- data/proto_docs/google/protobuf/timestamp.rb +8 -7
- data/proto_docs/google/pubsub/v1/pubsub.rb +101 -25
- data/proto_docs/google/pubsub/v1/schema.rb +18 -1
- metadata +18 -8
- data/proto_docs/google/type/expr.rb +0 -75
|
@@ -0,0 +1,1348 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright 2026 Google LLC
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
|
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
|
18
|
+
|
|
19
|
+
require "google/cloud/errors"
|
|
20
|
+
require "google/pubsub/v1/schema_pb"
|
|
21
|
+
require "google/cloud/pubsub/v1/schema_service/rest/service_stub"
|
|
22
|
+
require "google/iam/v1/rest"
|
|
23
|
+
|
|
24
|
+
module Google
|
|
25
|
+
module Cloud
|
|
26
|
+
module PubSub
|
|
27
|
+
module V1
|
|
28
|
+
module SchemaService
|
|
29
|
+
module Rest
|
|
30
|
+
##
|
|
31
|
+
# REST client for the SchemaService service.
|
|
32
|
+
#
|
|
33
|
+
# Service for doing schema-related operations.
|
|
34
|
+
#
|
|
35
|
+
class Client
|
|
36
|
+
# @private
|
|
37
|
+
API_VERSION = ""
|
|
38
|
+
|
|
39
|
+
# @private
|
|
40
|
+
DEFAULT_ENDPOINT_TEMPLATE = "pubsub.$UNIVERSE_DOMAIN$"
|
|
41
|
+
|
|
42
|
+
include Paths
|
|
43
|
+
|
|
44
|
+
# @private
|
|
45
|
+
attr_reader :schema_service_stub
|
|
46
|
+
|
|
47
|
+
##
|
|
48
|
+
# Configure the SchemaService Client class.
|
|
49
|
+
#
|
|
50
|
+
# See {::Google::Cloud::PubSub::V1::SchemaService::Rest::Client::Configuration}
|
|
51
|
+
# for a description of the configuration fields.
|
|
52
|
+
#
|
|
53
|
+
# @example
|
|
54
|
+
#
|
|
55
|
+
# # Modify the configuration for all SchemaService clients
|
|
56
|
+
# ::Google::Cloud::PubSub::V1::SchemaService::Rest::Client.configure do |config|
|
|
57
|
+
# config.timeout = 10.0
|
|
58
|
+
# end
|
|
59
|
+
#
|
|
60
|
+
# @yield [config] Configure the Client client.
|
|
61
|
+
# @yieldparam config [Client::Configuration]
|
|
62
|
+
#
|
|
63
|
+
# @return [Client::Configuration]
|
|
64
|
+
#
|
|
65
|
+
def self.configure
|
|
66
|
+
@configure ||= begin
|
|
67
|
+
namespace = ["Google", "Cloud", "PubSub", "V1"]
|
|
68
|
+
parent_config = while namespace.any?
|
|
69
|
+
parent_name = namespace.join "::"
|
|
70
|
+
parent_const = const_get parent_name
|
|
71
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
72
|
+
namespace.pop
|
|
73
|
+
end
|
|
74
|
+
default_config = Client::Configuration.new parent_config
|
|
75
|
+
|
|
76
|
+
default_config.rpcs.create_schema.timeout = 60.0
|
|
77
|
+
default_config.rpcs.create_schema.retry_policy = {
|
|
78
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
default_config.rpcs.get_schema.timeout = 60.0
|
|
82
|
+
default_config.rpcs.get_schema.retry_policy = {
|
|
83
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
default_config.rpcs.list_schemas.timeout = 60.0
|
|
87
|
+
default_config.rpcs.list_schemas.retry_policy = {
|
|
88
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
default_config.rpcs.list_schema_revisions.timeout = 60.0
|
|
92
|
+
default_config.rpcs.list_schema_revisions.retry_policy = {
|
|
93
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
default_config.rpcs.commit_schema.timeout = 60.0
|
|
97
|
+
default_config.rpcs.commit_schema.retry_policy = {
|
|
98
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
default_config.rpcs.rollback_schema.timeout = 60.0
|
|
102
|
+
default_config.rpcs.rollback_schema.retry_policy = {
|
|
103
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
default_config.rpcs.delete_schema_revision.timeout = 60.0
|
|
107
|
+
default_config.rpcs.delete_schema_revision.retry_policy = {
|
|
108
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
default_config.rpcs.delete_schema.timeout = 60.0
|
|
112
|
+
default_config.rpcs.delete_schema.retry_policy = {
|
|
113
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
default_config.rpcs.validate_schema.timeout = 60.0
|
|
117
|
+
default_config.rpcs.validate_schema.retry_policy = {
|
|
118
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
default_config.rpcs.validate_message.timeout = 60.0
|
|
122
|
+
default_config.rpcs.validate_message.retry_policy = {
|
|
123
|
+
initial_delay: 0.1, max_delay: 60.0, multiplier: 1.3, retry_codes: [14]
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
default_config
|
|
127
|
+
end
|
|
128
|
+
yield @configure if block_given?
|
|
129
|
+
@configure
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
##
|
|
133
|
+
# Configure the SchemaService Client instance.
|
|
134
|
+
#
|
|
135
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
136
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
137
|
+
# should be made on {Client.configure}.
|
|
138
|
+
#
|
|
139
|
+
# See {::Google::Cloud::PubSub::V1::SchemaService::Rest::Client::Configuration}
|
|
140
|
+
# for a description of the configuration fields.
|
|
141
|
+
#
|
|
142
|
+
# @yield [config] Configure the Client client.
|
|
143
|
+
# @yieldparam config [Client::Configuration]
|
|
144
|
+
#
|
|
145
|
+
# @return [Client::Configuration]
|
|
146
|
+
#
|
|
147
|
+
def configure
|
|
148
|
+
yield @config if block_given?
|
|
149
|
+
@config
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
##
|
|
153
|
+
# The effective universe domain
|
|
154
|
+
#
|
|
155
|
+
# @return [String]
|
|
156
|
+
#
|
|
157
|
+
def universe_domain
|
|
158
|
+
@schema_service_stub.universe_domain
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
##
|
|
162
|
+
# Create a new SchemaService REST client object.
|
|
163
|
+
#
|
|
164
|
+
# @example
|
|
165
|
+
#
|
|
166
|
+
# # Create a client using the default configuration
|
|
167
|
+
# client = ::Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new
|
|
168
|
+
#
|
|
169
|
+
# # Create a client using a custom configuration
|
|
170
|
+
# client = ::Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new do |config|
|
|
171
|
+
# config.timeout = 10.0
|
|
172
|
+
# end
|
|
173
|
+
#
|
|
174
|
+
# @yield [config] Configure the SchemaService client.
|
|
175
|
+
# @yieldparam config [Client::Configuration]
|
|
176
|
+
#
|
|
177
|
+
def initialize
|
|
178
|
+
# Create the configuration object
|
|
179
|
+
@config = Configuration.new Client.configure
|
|
180
|
+
|
|
181
|
+
# Yield the configuration if needed
|
|
182
|
+
yield @config if block_given?
|
|
183
|
+
|
|
184
|
+
# Create credentials
|
|
185
|
+
credentials = @config.credentials
|
|
186
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
187
|
+
# but only if the default endpoint does not have a region prefix.
|
|
188
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
|
189
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
|
190
|
+
!@config.endpoint.split(".").first.include?("-"))
|
|
191
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
192
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
193
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
194
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
195
|
+
end
|
|
196
|
+
|
|
197
|
+
@quota_project_id = @config.quota_project
|
|
198
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
199
|
+
|
|
200
|
+
@schema_service_stub = ::Google::Cloud::PubSub::V1::SchemaService::Rest::ServiceStub.new(
|
|
201
|
+
endpoint: @config.endpoint,
|
|
202
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
|
203
|
+
universe_domain: @config.universe_domain,
|
|
204
|
+
credentials: credentials,
|
|
205
|
+
logger: @config.logger
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
@schema_service_stub.logger(stub: true)&.info do |entry|
|
|
209
|
+
entry.set_system_name
|
|
210
|
+
entry.set_service
|
|
211
|
+
entry.message = "Created client for #{entry.service}"
|
|
212
|
+
entry.set_credentials_fields credentials
|
|
213
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
|
214
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
|
215
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
@iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
|
|
219
|
+
config.credentials = credentials
|
|
220
|
+
config.quota_project = @quota_project_id
|
|
221
|
+
config.endpoint = @schema_service_stub.endpoint
|
|
222
|
+
config.universe_domain = @schema_service_stub.universe_domain
|
|
223
|
+
config.bindings_override = @config.bindings_override
|
|
224
|
+
config.logger = @schema_service_stub.logger if config.respond_to? :logger=
|
|
225
|
+
end
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
##
|
|
229
|
+
# Get the associated client for mix-in of the IAMPolicy.
|
|
230
|
+
#
|
|
231
|
+
# @return [Google::Iam::V1::IAMPolicy::Rest::Client]
|
|
232
|
+
#
|
|
233
|
+
attr_reader :iam_policy_client
|
|
234
|
+
|
|
235
|
+
##
|
|
236
|
+
# The logger used for request/response debug logging.
|
|
237
|
+
#
|
|
238
|
+
# @return [Logger]
|
|
239
|
+
#
|
|
240
|
+
def logger
|
|
241
|
+
@schema_service_stub.logger
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Service calls
|
|
245
|
+
|
|
246
|
+
##
|
|
247
|
+
# Creates a schema.
|
|
248
|
+
#
|
|
249
|
+
# @overload create_schema(request, options = nil)
|
|
250
|
+
# Pass arguments to `create_schema` via a request object, either of type
|
|
251
|
+
# {::Google::Cloud::PubSub::V1::CreateSchemaRequest} or an equivalent Hash.
|
|
252
|
+
#
|
|
253
|
+
# @param request [::Google::Cloud::PubSub::V1::CreateSchemaRequest, ::Hash]
|
|
254
|
+
# A request object representing the call parameters. Required. To specify no
|
|
255
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
256
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
257
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
258
|
+
#
|
|
259
|
+
# @overload create_schema(parent: nil, schema: nil, schema_id: nil)
|
|
260
|
+
# Pass arguments to `create_schema` via keyword arguments. Note that at
|
|
261
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
262
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
263
|
+
#
|
|
264
|
+
# @param parent [::String]
|
|
265
|
+
# Required. The name of the project in which to create the schema.
|
|
266
|
+
# Format is `projects/{project-id}`.
|
|
267
|
+
# @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
|
|
268
|
+
# Required. The schema object to create.
|
|
269
|
+
#
|
|
270
|
+
# This schema's `name` parameter is ignored. The schema object returned
|
|
271
|
+
# by CreateSchema will have a `name` made using the given `parent` and
|
|
272
|
+
# `schema_id`.
|
|
273
|
+
# @param schema_id [::String]
|
|
274
|
+
# The ID to use for the schema, which will become the final component of
|
|
275
|
+
# the schema's resource name.
|
|
276
|
+
#
|
|
277
|
+
# See https://cloud.google.com/pubsub/docs/pubsub-basics#resource_names for
|
|
278
|
+
# resource name constraints.
|
|
279
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
280
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::Schema]
|
|
281
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
282
|
+
#
|
|
283
|
+
# @return [::Google::Cloud::PubSub::V1::Schema]
|
|
284
|
+
#
|
|
285
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
286
|
+
#
|
|
287
|
+
# @example Basic example
|
|
288
|
+
# require "google/cloud/pubsub/v1"
|
|
289
|
+
#
|
|
290
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
291
|
+
# client = Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new
|
|
292
|
+
#
|
|
293
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
294
|
+
# request = Google::Cloud::PubSub::V1::CreateSchemaRequest.new
|
|
295
|
+
#
|
|
296
|
+
# # Call the create_schema method.
|
|
297
|
+
# result = client.create_schema request
|
|
298
|
+
#
|
|
299
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Schema.
|
|
300
|
+
# p result
|
|
301
|
+
#
|
|
302
|
+
def create_schema request, options = nil
|
|
303
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
304
|
+
|
|
305
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::CreateSchemaRequest
|
|
306
|
+
|
|
307
|
+
# Converts hash and nil to an options object
|
|
308
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
309
|
+
|
|
310
|
+
# Customize the options with defaults
|
|
311
|
+
call_metadata = @config.rpcs.create_schema.metadata.to_h
|
|
312
|
+
|
|
313
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
314
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
315
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
316
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
317
|
+
transports_version_send: [:rest]
|
|
318
|
+
|
|
319
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
320
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
321
|
+
|
|
322
|
+
options.apply_defaults timeout: @config.rpcs.create_schema.timeout,
|
|
323
|
+
metadata: call_metadata,
|
|
324
|
+
retry_policy: @config.rpcs.create_schema.retry_policy
|
|
325
|
+
|
|
326
|
+
options.apply_defaults timeout: @config.timeout,
|
|
327
|
+
metadata: @config.metadata,
|
|
328
|
+
retry_policy: @config.retry_policy
|
|
329
|
+
|
|
330
|
+
@schema_service_stub.create_schema request, options do |result, operation|
|
|
331
|
+
yield result, operation if block_given?
|
|
332
|
+
end
|
|
333
|
+
rescue ::Gapic::Rest::Error => e
|
|
334
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
##
|
|
338
|
+
# Gets a schema.
|
|
339
|
+
#
|
|
340
|
+
# @overload get_schema(request, options = nil)
|
|
341
|
+
# Pass arguments to `get_schema` via a request object, either of type
|
|
342
|
+
# {::Google::Cloud::PubSub::V1::GetSchemaRequest} or an equivalent Hash.
|
|
343
|
+
#
|
|
344
|
+
# @param request [::Google::Cloud::PubSub::V1::GetSchemaRequest, ::Hash]
|
|
345
|
+
# A request object representing the call parameters. Required. To specify no
|
|
346
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
347
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
348
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
349
|
+
#
|
|
350
|
+
# @overload get_schema(name: nil, view: nil)
|
|
351
|
+
# Pass arguments to `get_schema` via keyword arguments. Note that at
|
|
352
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
353
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
354
|
+
#
|
|
355
|
+
# @param name [::String]
|
|
356
|
+
# Required. The name of the schema to get.
|
|
357
|
+
# Format is `projects/{project}/schemas/{schema}`.
|
|
358
|
+
# @param view [::Google::Cloud::PubSub::V1::SchemaView]
|
|
359
|
+
# The set of fields to return in the response. If not set, returns a Schema
|
|
360
|
+
# with all fields filled out. Set to `BASIC` to omit the `definition`.
|
|
361
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
362
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::Schema]
|
|
363
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
364
|
+
#
|
|
365
|
+
# @return [::Google::Cloud::PubSub::V1::Schema]
|
|
366
|
+
#
|
|
367
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
368
|
+
#
|
|
369
|
+
# @example Basic example
|
|
370
|
+
# require "google/cloud/pubsub/v1"
|
|
371
|
+
#
|
|
372
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
373
|
+
# client = Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new
|
|
374
|
+
#
|
|
375
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
376
|
+
# request = Google::Cloud::PubSub::V1::GetSchemaRequest.new
|
|
377
|
+
#
|
|
378
|
+
# # Call the get_schema method.
|
|
379
|
+
# result = client.get_schema request
|
|
380
|
+
#
|
|
381
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Schema.
|
|
382
|
+
# p result
|
|
383
|
+
#
|
|
384
|
+
def get_schema request, options = nil
|
|
385
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
386
|
+
|
|
387
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::GetSchemaRequest
|
|
388
|
+
|
|
389
|
+
# Converts hash and nil to an options object
|
|
390
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
391
|
+
|
|
392
|
+
# Customize the options with defaults
|
|
393
|
+
call_metadata = @config.rpcs.get_schema.metadata.to_h
|
|
394
|
+
|
|
395
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
396
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
397
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
398
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
399
|
+
transports_version_send: [:rest]
|
|
400
|
+
|
|
401
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
402
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
403
|
+
|
|
404
|
+
options.apply_defaults timeout: @config.rpcs.get_schema.timeout,
|
|
405
|
+
metadata: call_metadata,
|
|
406
|
+
retry_policy: @config.rpcs.get_schema.retry_policy
|
|
407
|
+
|
|
408
|
+
options.apply_defaults timeout: @config.timeout,
|
|
409
|
+
metadata: @config.metadata,
|
|
410
|
+
retry_policy: @config.retry_policy
|
|
411
|
+
|
|
412
|
+
@schema_service_stub.get_schema request, options do |result, operation|
|
|
413
|
+
yield result, operation if block_given?
|
|
414
|
+
end
|
|
415
|
+
rescue ::Gapic::Rest::Error => e
|
|
416
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
417
|
+
end
|
|
418
|
+
|
|
419
|
+
##
|
|
420
|
+
# Lists schemas in a project.
|
|
421
|
+
#
|
|
422
|
+
# @overload list_schemas(request, options = nil)
|
|
423
|
+
# Pass arguments to `list_schemas` via a request object, either of type
|
|
424
|
+
# {::Google::Cloud::PubSub::V1::ListSchemasRequest} or an equivalent Hash.
|
|
425
|
+
#
|
|
426
|
+
# @param request [::Google::Cloud::PubSub::V1::ListSchemasRequest, ::Hash]
|
|
427
|
+
# A request object representing the call parameters. Required. To specify no
|
|
428
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
429
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
430
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
431
|
+
#
|
|
432
|
+
# @overload list_schemas(parent: nil, view: nil, page_size: nil, page_token: nil)
|
|
433
|
+
# Pass arguments to `list_schemas` via keyword arguments. Note that at
|
|
434
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
435
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
436
|
+
#
|
|
437
|
+
# @param parent [::String]
|
|
438
|
+
# Required. The name of the project in which to list schemas.
|
|
439
|
+
# Format is `projects/{project-id}`.
|
|
440
|
+
# @param view [::Google::Cloud::PubSub::V1::SchemaView]
|
|
441
|
+
# The set of Schema fields to return in the response. If not set, returns
|
|
442
|
+
# Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
|
|
443
|
+
# retrieve all fields.
|
|
444
|
+
# @param page_size [::Integer]
|
|
445
|
+
# Maximum number of schemas to return.
|
|
446
|
+
# @param page_token [::String]
|
|
447
|
+
# The value returned by the last `ListSchemasResponse`; indicates that
|
|
448
|
+
# this is a continuation of a prior `ListSchemas` call, and that the
|
|
449
|
+
# system should return the next page of data.
|
|
450
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
451
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>]
|
|
452
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
453
|
+
#
|
|
454
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>]
|
|
455
|
+
#
|
|
456
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
457
|
+
#
|
|
458
|
+
# @example Basic example
|
|
459
|
+
# require "google/cloud/pubsub/v1"
|
|
460
|
+
#
|
|
461
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
462
|
+
# client = Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new
|
|
463
|
+
#
|
|
464
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
465
|
+
# request = Google::Cloud::PubSub::V1::ListSchemasRequest.new
|
|
466
|
+
#
|
|
467
|
+
# # Call the list_schemas method.
|
|
468
|
+
# result = client.list_schemas request
|
|
469
|
+
#
|
|
470
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
|
471
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
|
472
|
+
# result.each do |item|
|
|
473
|
+
# # Each element is of type ::Google::Cloud::PubSub::V1::Schema.
|
|
474
|
+
# p item
|
|
475
|
+
# end
|
|
476
|
+
#
|
|
477
|
+
def list_schemas request, options = nil
|
|
478
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
479
|
+
|
|
480
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListSchemasRequest
|
|
481
|
+
|
|
482
|
+
# Converts hash and nil to an options object
|
|
483
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
484
|
+
|
|
485
|
+
# Customize the options with defaults
|
|
486
|
+
call_metadata = @config.rpcs.list_schemas.metadata.to_h
|
|
487
|
+
|
|
488
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
489
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
490
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
491
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
492
|
+
transports_version_send: [:rest]
|
|
493
|
+
|
|
494
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
495
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
496
|
+
|
|
497
|
+
options.apply_defaults timeout: @config.rpcs.list_schemas.timeout,
|
|
498
|
+
metadata: call_metadata,
|
|
499
|
+
retry_policy: @config.rpcs.list_schemas.retry_policy
|
|
500
|
+
|
|
501
|
+
options.apply_defaults timeout: @config.timeout,
|
|
502
|
+
metadata: @config.metadata,
|
|
503
|
+
retry_policy: @config.retry_policy
|
|
504
|
+
|
|
505
|
+
@schema_service_stub.list_schemas request, options do |result, operation|
|
|
506
|
+
result = ::Gapic::Rest::PagedEnumerable.new @schema_service_stub, :list_schemas, "schemas", request, result, options
|
|
507
|
+
yield result, operation if block_given?
|
|
508
|
+
throw :response, result
|
|
509
|
+
end
|
|
510
|
+
rescue ::Gapic::Rest::Error => e
|
|
511
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
512
|
+
end
|
|
513
|
+
|
|
514
|
+
##
|
|
515
|
+
# Lists all schema revisions for the named schema.
|
|
516
|
+
#
|
|
517
|
+
# @overload list_schema_revisions(request, options = nil)
|
|
518
|
+
# Pass arguments to `list_schema_revisions` via a request object, either of type
|
|
519
|
+
# {::Google::Cloud::PubSub::V1::ListSchemaRevisionsRequest} or an equivalent Hash.
|
|
520
|
+
#
|
|
521
|
+
# @param request [::Google::Cloud::PubSub::V1::ListSchemaRevisionsRequest, ::Hash]
|
|
522
|
+
# A request object representing the call parameters. Required. To specify no
|
|
523
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
524
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
525
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
526
|
+
#
|
|
527
|
+
# @overload list_schema_revisions(name: nil, view: nil, page_size: nil, page_token: nil)
|
|
528
|
+
# Pass arguments to `list_schema_revisions` via keyword arguments. Note that at
|
|
529
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
530
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
531
|
+
#
|
|
532
|
+
# @param name [::String]
|
|
533
|
+
# Required. The name of the schema to list revisions for.
|
|
534
|
+
# @param view [::Google::Cloud::PubSub::V1::SchemaView]
|
|
535
|
+
# The set of Schema fields to return in the response. If not set, returns
|
|
536
|
+
# Schemas with `name` and `type`, but not `definition`. Set to `FULL` to
|
|
537
|
+
# retrieve all fields.
|
|
538
|
+
# @param page_size [::Integer]
|
|
539
|
+
# The maximum number of revisions to return per page.
|
|
540
|
+
# @param page_token [::String]
|
|
541
|
+
# The page token, received from a previous ListSchemaRevisions call.
|
|
542
|
+
# Provide this to retrieve the subsequent page.
|
|
543
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
544
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>]
|
|
545
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
546
|
+
#
|
|
547
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::PubSub::V1::Schema>]
|
|
548
|
+
#
|
|
549
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
550
|
+
#
|
|
551
|
+
# @example Basic example
|
|
552
|
+
# require "google/cloud/pubsub/v1"
|
|
553
|
+
#
|
|
554
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
555
|
+
# client = Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new
|
|
556
|
+
#
|
|
557
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
558
|
+
# request = Google::Cloud::PubSub::V1::ListSchemaRevisionsRequest.new
|
|
559
|
+
#
|
|
560
|
+
# # Call the list_schema_revisions method.
|
|
561
|
+
# result = client.list_schema_revisions request
|
|
562
|
+
#
|
|
563
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
|
564
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
|
565
|
+
# result.each do |item|
|
|
566
|
+
# # Each element is of type ::Google::Cloud::PubSub::V1::Schema.
|
|
567
|
+
# p item
|
|
568
|
+
# end
|
|
569
|
+
#
|
|
570
|
+
def list_schema_revisions request, options = nil
|
|
571
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
572
|
+
|
|
573
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ListSchemaRevisionsRequest
|
|
574
|
+
|
|
575
|
+
# Converts hash and nil to an options object
|
|
576
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
577
|
+
|
|
578
|
+
# Customize the options with defaults
|
|
579
|
+
call_metadata = @config.rpcs.list_schema_revisions.metadata.to_h
|
|
580
|
+
|
|
581
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
582
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
583
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
584
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
585
|
+
transports_version_send: [:rest]
|
|
586
|
+
|
|
587
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
588
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
589
|
+
|
|
590
|
+
options.apply_defaults timeout: @config.rpcs.list_schema_revisions.timeout,
|
|
591
|
+
metadata: call_metadata,
|
|
592
|
+
retry_policy: @config.rpcs.list_schema_revisions.retry_policy
|
|
593
|
+
|
|
594
|
+
options.apply_defaults timeout: @config.timeout,
|
|
595
|
+
metadata: @config.metadata,
|
|
596
|
+
retry_policy: @config.retry_policy
|
|
597
|
+
|
|
598
|
+
@schema_service_stub.list_schema_revisions request, options do |result, operation|
|
|
599
|
+
result = ::Gapic::Rest::PagedEnumerable.new @schema_service_stub, :list_schema_revisions, "schemas", request, result, options
|
|
600
|
+
yield result, operation if block_given?
|
|
601
|
+
throw :response, result
|
|
602
|
+
end
|
|
603
|
+
rescue ::Gapic::Rest::Error => e
|
|
604
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
605
|
+
end
|
|
606
|
+
|
|
607
|
+
##
|
|
608
|
+
# Commits a new schema revision to an existing schema.
|
|
609
|
+
#
|
|
610
|
+
# @overload commit_schema(request, options = nil)
|
|
611
|
+
# Pass arguments to `commit_schema` via a request object, either of type
|
|
612
|
+
# {::Google::Cloud::PubSub::V1::CommitSchemaRequest} or an equivalent Hash.
|
|
613
|
+
#
|
|
614
|
+
# @param request [::Google::Cloud::PubSub::V1::CommitSchemaRequest, ::Hash]
|
|
615
|
+
# A request object representing the call parameters. Required. To specify no
|
|
616
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
617
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
618
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
619
|
+
#
|
|
620
|
+
# @overload commit_schema(name: nil, schema: nil)
|
|
621
|
+
# Pass arguments to `commit_schema` via keyword arguments. Note that at
|
|
622
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
623
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
624
|
+
#
|
|
625
|
+
# @param name [::String]
|
|
626
|
+
# Required. The name of the schema we are revising.
|
|
627
|
+
# Format is `projects/{project}/schemas/{schema}`.
|
|
628
|
+
# @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
|
|
629
|
+
# Required. The schema revision to commit.
|
|
630
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
631
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::Schema]
|
|
632
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
633
|
+
#
|
|
634
|
+
# @return [::Google::Cloud::PubSub::V1::Schema]
|
|
635
|
+
#
|
|
636
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
637
|
+
#
|
|
638
|
+
# @example Basic example
|
|
639
|
+
# require "google/cloud/pubsub/v1"
|
|
640
|
+
#
|
|
641
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
642
|
+
# client = Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new
|
|
643
|
+
#
|
|
644
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
645
|
+
# request = Google::Cloud::PubSub::V1::CommitSchemaRequest.new
|
|
646
|
+
#
|
|
647
|
+
# # Call the commit_schema method.
|
|
648
|
+
# result = client.commit_schema request
|
|
649
|
+
#
|
|
650
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Schema.
|
|
651
|
+
# p result
|
|
652
|
+
#
|
|
653
|
+
def commit_schema request, options = nil
|
|
654
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
655
|
+
|
|
656
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::CommitSchemaRequest
|
|
657
|
+
|
|
658
|
+
# Converts hash and nil to an options object
|
|
659
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
660
|
+
|
|
661
|
+
# Customize the options with defaults
|
|
662
|
+
call_metadata = @config.rpcs.commit_schema.metadata.to_h
|
|
663
|
+
|
|
664
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
665
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
666
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
667
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
668
|
+
transports_version_send: [:rest]
|
|
669
|
+
|
|
670
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
671
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
672
|
+
|
|
673
|
+
options.apply_defaults timeout: @config.rpcs.commit_schema.timeout,
|
|
674
|
+
metadata: call_metadata,
|
|
675
|
+
retry_policy: @config.rpcs.commit_schema.retry_policy
|
|
676
|
+
|
|
677
|
+
options.apply_defaults timeout: @config.timeout,
|
|
678
|
+
metadata: @config.metadata,
|
|
679
|
+
retry_policy: @config.retry_policy
|
|
680
|
+
|
|
681
|
+
@schema_service_stub.commit_schema request, options do |result, operation|
|
|
682
|
+
yield result, operation if block_given?
|
|
683
|
+
end
|
|
684
|
+
rescue ::Gapic::Rest::Error => e
|
|
685
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
686
|
+
end
|
|
687
|
+
|
|
688
|
+
##
|
|
689
|
+
# Creates a new schema revision that is a copy of the provided revision_id.
|
|
690
|
+
#
|
|
691
|
+
# @overload rollback_schema(request, options = nil)
|
|
692
|
+
# Pass arguments to `rollback_schema` via a request object, either of type
|
|
693
|
+
# {::Google::Cloud::PubSub::V1::RollbackSchemaRequest} or an equivalent Hash.
|
|
694
|
+
#
|
|
695
|
+
# @param request [::Google::Cloud::PubSub::V1::RollbackSchemaRequest, ::Hash]
|
|
696
|
+
# A request object representing the call parameters. Required. To specify no
|
|
697
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
698
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
699
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
700
|
+
#
|
|
701
|
+
# @overload rollback_schema(name: nil, revision_id: nil)
|
|
702
|
+
# Pass arguments to `rollback_schema` via keyword arguments. Note that at
|
|
703
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
704
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
705
|
+
#
|
|
706
|
+
# @param name [::String]
|
|
707
|
+
# Required. The schema being rolled back with revision id.
|
|
708
|
+
# @param revision_id [::String]
|
|
709
|
+
# Required. The revision ID to roll back to.
|
|
710
|
+
# It must be a revision of the same schema.
|
|
711
|
+
#
|
|
712
|
+
# Example: c7cfa2a8
|
|
713
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
714
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::Schema]
|
|
715
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
716
|
+
#
|
|
717
|
+
# @return [::Google::Cloud::PubSub::V1::Schema]
|
|
718
|
+
#
|
|
719
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
720
|
+
#
|
|
721
|
+
# @example Basic example
|
|
722
|
+
# require "google/cloud/pubsub/v1"
|
|
723
|
+
#
|
|
724
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
725
|
+
# client = Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new
|
|
726
|
+
#
|
|
727
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
728
|
+
# request = Google::Cloud::PubSub::V1::RollbackSchemaRequest.new
|
|
729
|
+
#
|
|
730
|
+
# # Call the rollback_schema method.
|
|
731
|
+
# result = client.rollback_schema request
|
|
732
|
+
#
|
|
733
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Schema.
|
|
734
|
+
# p result
|
|
735
|
+
#
|
|
736
|
+
def rollback_schema request, options = nil
|
|
737
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
738
|
+
|
|
739
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::RollbackSchemaRequest
|
|
740
|
+
|
|
741
|
+
# Converts hash and nil to an options object
|
|
742
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
743
|
+
|
|
744
|
+
# Customize the options with defaults
|
|
745
|
+
call_metadata = @config.rpcs.rollback_schema.metadata.to_h
|
|
746
|
+
|
|
747
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
748
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
749
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
750
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
751
|
+
transports_version_send: [:rest]
|
|
752
|
+
|
|
753
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
754
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
755
|
+
|
|
756
|
+
options.apply_defaults timeout: @config.rpcs.rollback_schema.timeout,
|
|
757
|
+
metadata: call_metadata,
|
|
758
|
+
retry_policy: @config.rpcs.rollback_schema.retry_policy
|
|
759
|
+
|
|
760
|
+
options.apply_defaults timeout: @config.timeout,
|
|
761
|
+
metadata: @config.metadata,
|
|
762
|
+
retry_policy: @config.retry_policy
|
|
763
|
+
|
|
764
|
+
@schema_service_stub.rollback_schema request, options do |result, operation|
|
|
765
|
+
yield result, operation if block_given?
|
|
766
|
+
end
|
|
767
|
+
rescue ::Gapic::Rest::Error => e
|
|
768
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
769
|
+
end
|
|
770
|
+
|
|
771
|
+
##
|
|
772
|
+
# Deletes a specific schema revision.
|
|
773
|
+
#
|
|
774
|
+
# @overload delete_schema_revision(request, options = nil)
|
|
775
|
+
# Pass arguments to `delete_schema_revision` via a request object, either of type
|
|
776
|
+
# {::Google::Cloud::PubSub::V1::DeleteSchemaRevisionRequest} or an equivalent Hash.
|
|
777
|
+
#
|
|
778
|
+
# @param request [::Google::Cloud::PubSub::V1::DeleteSchemaRevisionRequest, ::Hash]
|
|
779
|
+
# A request object representing the call parameters. Required. To specify no
|
|
780
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
781
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
782
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
783
|
+
#
|
|
784
|
+
# @overload delete_schema_revision(name: nil, revision_id: nil)
|
|
785
|
+
# Pass arguments to `delete_schema_revision` via keyword arguments. Note that at
|
|
786
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
787
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
788
|
+
#
|
|
789
|
+
# @param name [::String]
|
|
790
|
+
# Required. The name of the schema revision to be deleted, with a revision ID
|
|
791
|
+
# explicitly included.
|
|
792
|
+
#
|
|
793
|
+
# Example: `projects/123/schemas/my-schema@c7cfa2a8`
|
|
794
|
+
# @param revision_id [::String]
|
|
795
|
+
# Optional. This field is deprecated and should not be used for specifying
|
|
796
|
+
# the revision ID. The revision ID should be specified via the `name`
|
|
797
|
+
# parameter.
|
|
798
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
799
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::Schema]
|
|
800
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
801
|
+
#
|
|
802
|
+
# @return [::Google::Cloud::PubSub::V1::Schema]
|
|
803
|
+
#
|
|
804
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
805
|
+
#
|
|
806
|
+
# @example Basic example
|
|
807
|
+
# require "google/cloud/pubsub/v1"
|
|
808
|
+
#
|
|
809
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
810
|
+
# client = Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new
|
|
811
|
+
#
|
|
812
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
813
|
+
# request = Google::Cloud::PubSub::V1::DeleteSchemaRevisionRequest.new
|
|
814
|
+
#
|
|
815
|
+
# # Call the delete_schema_revision method.
|
|
816
|
+
# result = client.delete_schema_revision request
|
|
817
|
+
#
|
|
818
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::Schema.
|
|
819
|
+
# p result
|
|
820
|
+
#
|
|
821
|
+
def delete_schema_revision request, options = nil
|
|
822
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
823
|
+
|
|
824
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::DeleteSchemaRevisionRequest
|
|
825
|
+
|
|
826
|
+
# Converts hash and nil to an options object
|
|
827
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
828
|
+
|
|
829
|
+
# Customize the options with defaults
|
|
830
|
+
call_metadata = @config.rpcs.delete_schema_revision.metadata.to_h
|
|
831
|
+
|
|
832
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
833
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
834
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
835
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
836
|
+
transports_version_send: [:rest]
|
|
837
|
+
|
|
838
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
839
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
840
|
+
|
|
841
|
+
options.apply_defaults timeout: @config.rpcs.delete_schema_revision.timeout,
|
|
842
|
+
metadata: call_metadata,
|
|
843
|
+
retry_policy: @config.rpcs.delete_schema_revision.retry_policy
|
|
844
|
+
|
|
845
|
+
options.apply_defaults timeout: @config.timeout,
|
|
846
|
+
metadata: @config.metadata,
|
|
847
|
+
retry_policy: @config.retry_policy
|
|
848
|
+
|
|
849
|
+
@schema_service_stub.delete_schema_revision request, options do |result, operation|
|
|
850
|
+
yield result, operation if block_given?
|
|
851
|
+
end
|
|
852
|
+
rescue ::Gapic::Rest::Error => e
|
|
853
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
854
|
+
end
|
|
855
|
+
|
|
856
|
+
##
|
|
857
|
+
# Deletes a schema.
|
|
858
|
+
#
|
|
859
|
+
# @overload delete_schema(request, options = nil)
|
|
860
|
+
# Pass arguments to `delete_schema` via a request object, either of type
|
|
861
|
+
# {::Google::Cloud::PubSub::V1::DeleteSchemaRequest} or an equivalent Hash.
|
|
862
|
+
#
|
|
863
|
+
# @param request [::Google::Cloud::PubSub::V1::DeleteSchemaRequest, ::Hash]
|
|
864
|
+
# A request object representing the call parameters. Required. To specify no
|
|
865
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
866
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
867
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
868
|
+
#
|
|
869
|
+
# @overload delete_schema(name: nil)
|
|
870
|
+
# Pass arguments to `delete_schema` via keyword arguments. Note that at
|
|
871
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
872
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
873
|
+
#
|
|
874
|
+
# @param name [::String]
|
|
875
|
+
# Required. Name of the schema to delete.
|
|
876
|
+
# Format is `projects/{project}/schemas/{schema}`.
|
|
877
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
878
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
|
879
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
880
|
+
#
|
|
881
|
+
# @return [::Google::Protobuf::Empty]
|
|
882
|
+
#
|
|
883
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
884
|
+
#
|
|
885
|
+
# @example Basic example
|
|
886
|
+
# require "google/cloud/pubsub/v1"
|
|
887
|
+
#
|
|
888
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
889
|
+
# client = Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new
|
|
890
|
+
#
|
|
891
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
892
|
+
# request = Google::Cloud::PubSub::V1::DeleteSchemaRequest.new
|
|
893
|
+
#
|
|
894
|
+
# # Call the delete_schema method.
|
|
895
|
+
# result = client.delete_schema request
|
|
896
|
+
#
|
|
897
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
|
898
|
+
# p result
|
|
899
|
+
#
|
|
900
|
+
def delete_schema request, options = nil
|
|
901
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
902
|
+
|
|
903
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::DeleteSchemaRequest
|
|
904
|
+
|
|
905
|
+
# Converts hash and nil to an options object
|
|
906
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
907
|
+
|
|
908
|
+
# Customize the options with defaults
|
|
909
|
+
call_metadata = @config.rpcs.delete_schema.metadata.to_h
|
|
910
|
+
|
|
911
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
912
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
913
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
914
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
915
|
+
transports_version_send: [:rest]
|
|
916
|
+
|
|
917
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
918
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
919
|
+
|
|
920
|
+
options.apply_defaults timeout: @config.rpcs.delete_schema.timeout,
|
|
921
|
+
metadata: call_metadata,
|
|
922
|
+
retry_policy: @config.rpcs.delete_schema.retry_policy
|
|
923
|
+
|
|
924
|
+
options.apply_defaults timeout: @config.timeout,
|
|
925
|
+
metadata: @config.metadata,
|
|
926
|
+
retry_policy: @config.retry_policy
|
|
927
|
+
|
|
928
|
+
@schema_service_stub.delete_schema request, options do |result, operation|
|
|
929
|
+
yield result, operation if block_given?
|
|
930
|
+
end
|
|
931
|
+
rescue ::Gapic::Rest::Error => e
|
|
932
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
933
|
+
end
|
|
934
|
+
|
|
935
|
+
##
|
|
936
|
+
# Validates a schema.
|
|
937
|
+
#
|
|
938
|
+
# @overload validate_schema(request, options = nil)
|
|
939
|
+
# Pass arguments to `validate_schema` via a request object, either of type
|
|
940
|
+
# {::Google::Cloud::PubSub::V1::ValidateSchemaRequest} or an equivalent Hash.
|
|
941
|
+
#
|
|
942
|
+
# @param request [::Google::Cloud::PubSub::V1::ValidateSchemaRequest, ::Hash]
|
|
943
|
+
# A request object representing the call parameters. Required. To specify no
|
|
944
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
945
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
946
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
947
|
+
#
|
|
948
|
+
# @overload validate_schema(parent: nil, schema: nil)
|
|
949
|
+
# Pass arguments to `validate_schema` via keyword arguments. Note that at
|
|
950
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
951
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
952
|
+
#
|
|
953
|
+
# @param parent [::String]
|
|
954
|
+
# Required. The name of the project in which to validate schemas.
|
|
955
|
+
# Format is `projects/{project-id}`.
|
|
956
|
+
# @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
|
|
957
|
+
# Required. The schema object to validate.
|
|
958
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
959
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::ValidateSchemaResponse]
|
|
960
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
961
|
+
#
|
|
962
|
+
# @return [::Google::Cloud::PubSub::V1::ValidateSchemaResponse]
|
|
963
|
+
#
|
|
964
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
965
|
+
#
|
|
966
|
+
# @example Basic example
|
|
967
|
+
# require "google/cloud/pubsub/v1"
|
|
968
|
+
#
|
|
969
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
970
|
+
# client = Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new
|
|
971
|
+
#
|
|
972
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
973
|
+
# request = Google::Cloud::PubSub::V1::ValidateSchemaRequest.new
|
|
974
|
+
#
|
|
975
|
+
# # Call the validate_schema method.
|
|
976
|
+
# result = client.validate_schema request
|
|
977
|
+
#
|
|
978
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::ValidateSchemaResponse.
|
|
979
|
+
# p result
|
|
980
|
+
#
|
|
981
|
+
def validate_schema request, options = nil
|
|
982
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
983
|
+
|
|
984
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ValidateSchemaRequest
|
|
985
|
+
|
|
986
|
+
# Converts hash and nil to an options object
|
|
987
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
988
|
+
|
|
989
|
+
# Customize the options with defaults
|
|
990
|
+
call_metadata = @config.rpcs.validate_schema.metadata.to_h
|
|
991
|
+
|
|
992
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
993
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
994
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
995
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
996
|
+
transports_version_send: [:rest]
|
|
997
|
+
|
|
998
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
999
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
1000
|
+
|
|
1001
|
+
options.apply_defaults timeout: @config.rpcs.validate_schema.timeout,
|
|
1002
|
+
metadata: call_metadata,
|
|
1003
|
+
retry_policy: @config.rpcs.validate_schema.retry_policy
|
|
1004
|
+
|
|
1005
|
+
options.apply_defaults timeout: @config.timeout,
|
|
1006
|
+
metadata: @config.metadata,
|
|
1007
|
+
retry_policy: @config.retry_policy
|
|
1008
|
+
|
|
1009
|
+
@schema_service_stub.validate_schema request, options do |result, operation|
|
|
1010
|
+
yield result, operation if block_given?
|
|
1011
|
+
end
|
|
1012
|
+
rescue ::Gapic::Rest::Error => e
|
|
1013
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
1014
|
+
end
|
|
1015
|
+
|
|
1016
|
+
##
|
|
1017
|
+
# Validates a message against a schema.
|
|
1018
|
+
#
|
|
1019
|
+
# @overload validate_message(request, options = nil)
|
|
1020
|
+
# Pass arguments to `validate_message` via a request object, either of type
|
|
1021
|
+
# {::Google::Cloud::PubSub::V1::ValidateMessageRequest} or an equivalent Hash.
|
|
1022
|
+
#
|
|
1023
|
+
# @param request [::Google::Cloud::PubSub::V1::ValidateMessageRequest, ::Hash]
|
|
1024
|
+
# A request object representing the call parameters. Required. To specify no
|
|
1025
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
1026
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
1027
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
1028
|
+
#
|
|
1029
|
+
# @overload validate_message(parent: nil, name: nil, schema: nil, message: nil, encoding: nil)
|
|
1030
|
+
# Pass arguments to `validate_message` via keyword arguments. Note that at
|
|
1031
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
1032
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
1033
|
+
#
|
|
1034
|
+
# @param parent [::String]
|
|
1035
|
+
# Required. The name of the project in which to validate schemas.
|
|
1036
|
+
# Format is `projects/{project-id}`.
|
|
1037
|
+
# @param name [::String]
|
|
1038
|
+
# Name of the schema against which to validate.
|
|
1039
|
+
#
|
|
1040
|
+
# Format is `projects/{project}/schemas/{schema}`.
|
|
1041
|
+
#
|
|
1042
|
+
# 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.
|
|
1043
|
+
# @param schema [::Google::Cloud::PubSub::V1::Schema, ::Hash]
|
|
1044
|
+
# Ad-hoc schema against which to validate
|
|
1045
|
+
#
|
|
1046
|
+
# 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.
|
|
1047
|
+
# @param message [::String]
|
|
1048
|
+
# Message to validate against the provided `schema_spec`.
|
|
1049
|
+
# @param encoding [::Google::Cloud::PubSub::V1::Encoding]
|
|
1050
|
+
# The encoding expected for messages
|
|
1051
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
1052
|
+
# @yieldparam result [::Google::Cloud::PubSub::V1::ValidateMessageResponse]
|
|
1053
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
1054
|
+
#
|
|
1055
|
+
# @return [::Google::Cloud::PubSub::V1::ValidateMessageResponse]
|
|
1056
|
+
#
|
|
1057
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
1058
|
+
#
|
|
1059
|
+
# @example Basic example
|
|
1060
|
+
# require "google/cloud/pubsub/v1"
|
|
1061
|
+
#
|
|
1062
|
+
# # Create a client object. The client can be reused for multiple calls.
|
|
1063
|
+
# client = Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new
|
|
1064
|
+
#
|
|
1065
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
|
1066
|
+
# request = Google::Cloud::PubSub::V1::ValidateMessageRequest.new
|
|
1067
|
+
#
|
|
1068
|
+
# # Call the validate_message method.
|
|
1069
|
+
# result = client.validate_message request
|
|
1070
|
+
#
|
|
1071
|
+
# # The returned object is of type Google::Cloud::PubSub::V1::ValidateMessageResponse.
|
|
1072
|
+
# p result
|
|
1073
|
+
#
|
|
1074
|
+
def validate_message request, options = nil
|
|
1075
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
1076
|
+
|
|
1077
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::PubSub::V1::ValidateMessageRequest
|
|
1078
|
+
|
|
1079
|
+
# Converts hash and nil to an options object
|
|
1080
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
1081
|
+
|
|
1082
|
+
# Customize the options with defaults
|
|
1083
|
+
call_metadata = @config.rpcs.validate_message.metadata.to_h
|
|
1084
|
+
|
|
1085
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
|
1086
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
1087
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
1088
|
+
gapic_version: ::Google::Cloud::PubSub::V1::VERSION,
|
|
1089
|
+
transports_version_send: [:rest]
|
|
1090
|
+
|
|
1091
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
|
1092
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
1093
|
+
|
|
1094
|
+
options.apply_defaults timeout: @config.rpcs.validate_message.timeout,
|
|
1095
|
+
metadata: call_metadata,
|
|
1096
|
+
retry_policy: @config.rpcs.validate_message.retry_policy
|
|
1097
|
+
|
|
1098
|
+
options.apply_defaults timeout: @config.timeout,
|
|
1099
|
+
metadata: @config.metadata,
|
|
1100
|
+
retry_policy: @config.retry_policy
|
|
1101
|
+
|
|
1102
|
+
@schema_service_stub.validate_message request, options do |result, operation|
|
|
1103
|
+
yield result, operation if block_given?
|
|
1104
|
+
end
|
|
1105
|
+
rescue ::Gapic::Rest::Error => e
|
|
1106
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
1107
|
+
end
|
|
1108
|
+
|
|
1109
|
+
##
|
|
1110
|
+
# Configuration class for the SchemaService REST API.
|
|
1111
|
+
#
|
|
1112
|
+
# This class represents the configuration for SchemaService REST,
|
|
1113
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
1114
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
1115
|
+
# applied individually to specific RPCs. See
|
|
1116
|
+
# {::Google::Cloud::PubSub::V1::SchemaService::Rest::Client::Configuration::Rpcs}
|
|
1117
|
+
# for a list of RPCs that can be configured independently.
|
|
1118
|
+
#
|
|
1119
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
1120
|
+
# on construction.
|
|
1121
|
+
#
|
|
1122
|
+
# @example
|
|
1123
|
+
#
|
|
1124
|
+
# # Modify the global config, setting the timeout for
|
|
1125
|
+
# # create_schema to 20 seconds,
|
|
1126
|
+
# # and all remaining timeouts to 10 seconds.
|
|
1127
|
+
# ::Google::Cloud::PubSub::V1::SchemaService::Rest::Client.configure do |config|
|
|
1128
|
+
# config.timeout = 10.0
|
|
1129
|
+
# config.rpcs.create_schema.timeout = 20.0
|
|
1130
|
+
# end
|
|
1131
|
+
#
|
|
1132
|
+
# # Apply the above configuration only to a new client.
|
|
1133
|
+
# client = ::Google::Cloud::PubSub::V1::SchemaService::Rest::Client.new do |config|
|
|
1134
|
+
# config.timeout = 10.0
|
|
1135
|
+
# config.rpcs.create_schema.timeout = 20.0
|
|
1136
|
+
# end
|
|
1137
|
+
#
|
|
1138
|
+
# @!attribute [rw] endpoint
|
|
1139
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
|
1140
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
|
1141
|
+
# @return [::String,nil]
|
|
1142
|
+
# @!attribute [rw] credentials
|
|
1143
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
1144
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
1145
|
+
# * (`Hash`) A service account key as a Hash
|
|
1146
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
1147
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
1148
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
1149
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
1150
|
+
# * (`nil`) indicating no credentials
|
|
1151
|
+
#
|
|
1152
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
|
1153
|
+
# external source for authentication to Google Cloud, you must validate it before
|
|
1154
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
|
1155
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
|
1156
|
+
# For more information, refer to [Validate credential configurations from external
|
|
1157
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
|
1158
|
+
# @return [::Object]
|
|
1159
|
+
# @!attribute [rw] scope
|
|
1160
|
+
# The OAuth scopes
|
|
1161
|
+
# @return [::Array<::String>]
|
|
1162
|
+
# @!attribute [rw] lib_name
|
|
1163
|
+
# The library name as recorded in instrumentation and logging
|
|
1164
|
+
# @return [::String]
|
|
1165
|
+
# @!attribute [rw] lib_version
|
|
1166
|
+
# The library version as recorded in instrumentation and logging
|
|
1167
|
+
# @return [::String]
|
|
1168
|
+
# @!attribute [rw] timeout
|
|
1169
|
+
# The call timeout in seconds.
|
|
1170
|
+
# @return [::Numeric]
|
|
1171
|
+
# @!attribute [rw] metadata
|
|
1172
|
+
# Additional headers to be sent with the call.
|
|
1173
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
1174
|
+
# @!attribute [rw] retry_policy
|
|
1175
|
+
# The retry policy. The value is a hash with the following keys:
|
|
1176
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
1177
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
1178
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
1179
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
1180
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
1181
|
+
# trigger a retry.
|
|
1182
|
+
# @return [::Hash]
|
|
1183
|
+
# @!attribute [rw] quota_project
|
|
1184
|
+
# A separate project against which to charge quota.
|
|
1185
|
+
# @return [::String]
|
|
1186
|
+
# @!attribute [rw] universe_domain
|
|
1187
|
+
# The universe domain within which to make requests. This determines the
|
|
1188
|
+
# default endpoint URL. The default value of nil uses the environment
|
|
1189
|
+
# universe (usually the default "googleapis.com" universe).
|
|
1190
|
+
# @return [::String,nil]
|
|
1191
|
+
# @!attribute [rw] logger
|
|
1192
|
+
# A custom logger to use for request/response debug logging, or the value
|
|
1193
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
|
1194
|
+
# explicitly disable logging.
|
|
1195
|
+
# @return [::Logger,:default,nil]
|
|
1196
|
+
#
|
|
1197
|
+
class Configuration
|
|
1198
|
+
extend ::Gapic::Config
|
|
1199
|
+
|
|
1200
|
+
# @private
|
|
1201
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
|
1202
|
+
DEFAULT_ENDPOINT = "pubsub.googleapis.com"
|
|
1203
|
+
|
|
1204
|
+
config_attr :endpoint, nil, ::String, nil
|
|
1205
|
+
config_attr :credentials, nil do |value|
|
|
1206
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
|
1207
|
+
allowed.any? { |klass| klass === value }
|
|
1208
|
+
end
|
|
1209
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
1210
|
+
config_attr :lib_name, nil, ::String, nil
|
|
1211
|
+
config_attr :lib_version, nil, ::String, nil
|
|
1212
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
1213
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
1214
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
1215
|
+
config_attr :quota_project, nil, ::String, nil
|
|
1216
|
+
config_attr :universe_domain, nil, ::String, nil
|
|
1217
|
+
|
|
1218
|
+
# @private
|
|
1219
|
+
# Overrides for http bindings for the RPCs of this service
|
|
1220
|
+
# are only used when this service is used as mixin, and only
|
|
1221
|
+
# by the host service.
|
|
1222
|
+
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
|
1223
|
+
config_attr :bindings_override, {}, ::Hash, nil
|
|
1224
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
|
1225
|
+
|
|
1226
|
+
# @private
|
|
1227
|
+
def initialize parent_config = nil
|
|
1228
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
1229
|
+
|
|
1230
|
+
yield self if block_given?
|
|
1231
|
+
end
|
|
1232
|
+
|
|
1233
|
+
##
|
|
1234
|
+
# Configurations for individual RPCs
|
|
1235
|
+
# @return [Rpcs]
|
|
1236
|
+
#
|
|
1237
|
+
def rpcs
|
|
1238
|
+
@rpcs ||= begin
|
|
1239
|
+
parent_rpcs = nil
|
|
1240
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
1241
|
+
Rpcs.new parent_rpcs
|
|
1242
|
+
end
|
|
1243
|
+
end
|
|
1244
|
+
|
|
1245
|
+
##
|
|
1246
|
+
# Configuration RPC class for the SchemaService API.
|
|
1247
|
+
#
|
|
1248
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
1249
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
1250
|
+
# the following configuration fields:
|
|
1251
|
+
#
|
|
1252
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
1253
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
|
1254
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
1255
|
+
# include the following keys:
|
|
1256
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
1257
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
1258
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
1259
|
+
# * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
|
|
1260
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
1261
|
+
# trigger a retry.
|
|
1262
|
+
#
|
|
1263
|
+
class Rpcs
|
|
1264
|
+
##
|
|
1265
|
+
# RPC-specific configuration for `create_schema`
|
|
1266
|
+
# @return [::Gapic::Config::Method]
|
|
1267
|
+
#
|
|
1268
|
+
attr_reader :create_schema
|
|
1269
|
+
##
|
|
1270
|
+
# RPC-specific configuration for `get_schema`
|
|
1271
|
+
# @return [::Gapic::Config::Method]
|
|
1272
|
+
#
|
|
1273
|
+
attr_reader :get_schema
|
|
1274
|
+
##
|
|
1275
|
+
# RPC-specific configuration for `list_schemas`
|
|
1276
|
+
# @return [::Gapic::Config::Method]
|
|
1277
|
+
#
|
|
1278
|
+
attr_reader :list_schemas
|
|
1279
|
+
##
|
|
1280
|
+
# RPC-specific configuration for `list_schema_revisions`
|
|
1281
|
+
# @return [::Gapic::Config::Method]
|
|
1282
|
+
#
|
|
1283
|
+
attr_reader :list_schema_revisions
|
|
1284
|
+
##
|
|
1285
|
+
# RPC-specific configuration for `commit_schema`
|
|
1286
|
+
# @return [::Gapic::Config::Method]
|
|
1287
|
+
#
|
|
1288
|
+
attr_reader :commit_schema
|
|
1289
|
+
##
|
|
1290
|
+
# RPC-specific configuration for `rollback_schema`
|
|
1291
|
+
# @return [::Gapic::Config::Method]
|
|
1292
|
+
#
|
|
1293
|
+
attr_reader :rollback_schema
|
|
1294
|
+
##
|
|
1295
|
+
# RPC-specific configuration for `delete_schema_revision`
|
|
1296
|
+
# @return [::Gapic::Config::Method]
|
|
1297
|
+
#
|
|
1298
|
+
attr_reader :delete_schema_revision
|
|
1299
|
+
##
|
|
1300
|
+
# RPC-specific configuration for `delete_schema`
|
|
1301
|
+
# @return [::Gapic::Config::Method]
|
|
1302
|
+
#
|
|
1303
|
+
attr_reader :delete_schema
|
|
1304
|
+
##
|
|
1305
|
+
# RPC-specific configuration for `validate_schema`
|
|
1306
|
+
# @return [::Gapic::Config::Method]
|
|
1307
|
+
#
|
|
1308
|
+
attr_reader :validate_schema
|
|
1309
|
+
##
|
|
1310
|
+
# RPC-specific configuration for `validate_message`
|
|
1311
|
+
# @return [::Gapic::Config::Method]
|
|
1312
|
+
#
|
|
1313
|
+
attr_reader :validate_message
|
|
1314
|
+
|
|
1315
|
+
# @private
|
|
1316
|
+
def initialize parent_rpcs = nil
|
|
1317
|
+
create_schema_config = parent_rpcs.create_schema if parent_rpcs.respond_to? :create_schema
|
|
1318
|
+
@create_schema = ::Gapic::Config::Method.new create_schema_config
|
|
1319
|
+
get_schema_config = parent_rpcs.get_schema if parent_rpcs.respond_to? :get_schema
|
|
1320
|
+
@get_schema = ::Gapic::Config::Method.new get_schema_config
|
|
1321
|
+
list_schemas_config = parent_rpcs.list_schemas if parent_rpcs.respond_to? :list_schemas
|
|
1322
|
+
@list_schemas = ::Gapic::Config::Method.new list_schemas_config
|
|
1323
|
+
list_schema_revisions_config = parent_rpcs.list_schema_revisions if parent_rpcs.respond_to? :list_schema_revisions
|
|
1324
|
+
@list_schema_revisions = ::Gapic::Config::Method.new list_schema_revisions_config
|
|
1325
|
+
commit_schema_config = parent_rpcs.commit_schema if parent_rpcs.respond_to? :commit_schema
|
|
1326
|
+
@commit_schema = ::Gapic::Config::Method.new commit_schema_config
|
|
1327
|
+
rollback_schema_config = parent_rpcs.rollback_schema if parent_rpcs.respond_to? :rollback_schema
|
|
1328
|
+
@rollback_schema = ::Gapic::Config::Method.new rollback_schema_config
|
|
1329
|
+
delete_schema_revision_config = parent_rpcs.delete_schema_revision if parent_rpcs.respond_to? :delete_schema_revision
|
|
1330
|
+
@delete_schema_revision = ::Gapic::Config::Method.new delete_schema_revision_config
|
|
1331
|
+
delete_schema_config = parent_rpcs.delete_schema if parent_rpcs.respond_to? :delete_schema
|
|
1332
|
+
@delete_schema = ::Gapic::Config::Method.new delete_schema_config
|
|
1333
|
+
validate_schema_config = parent_rpcs.validate_schema if parent_rpcs.respond_to? :validate_schema
|
|
1334
|
+
@validate_schema = ::Gapic::Config::Method.new validate_schema_config
|
|
1335
|
+
validate_message_config = parent_rpcs.validate_message if parent_rpcs.respond_to? :validate_message
|
|
1336
|
+
@validate_message = ::Gapic::Config::Method.new validate_message_config
|
|
1337
|
+
|
|
1338
|
+
yield self if block_given?
|
|
1339
|
+
end
|
|
1340
|
+
end
|
|
1341
|
+
end
|
|
1342
|
+
end
|
|
1343
|
+
end
|
|
1344
|
+
end
|
|
1345
|
+
end
|
|
1346
|
+
end
|
|
1347
|
+
end
|
|
1348
|
+
end
|