google-cloud-spanner-admin-instance-v1 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin/client.rb +28 -34
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin/operations.rb +12 -14
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin/rest/client.rb +1701 -0
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin/rest/operations.rb +824 -0
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin/rest/service_stub.rb +885 -0
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin/rest.rb +77 -0
- data/lib/google/cloud/spanner/admin/instance/v1/instance_admin.rb +7 -1
- data/lib/google/cloud/spanner/admin/instance/v1/rest.rb +41 -0
- data/lib/google/cloud/spanner/admin/instance/v1/version.rb +1 -1
- data/lib/google/cloud/spanner/admin/instance/v1.rb +7 -2
- data/proto_docs/google/api/client.rb +318 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/rpc/status.rb +4 -2
- metadata +14 -7
@@ -0,0 +1,824 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2023 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/operation"
|
20
|
+
|
21
|
+
module Google
|
22
|
+
module Cloud
|
23
|
+
module Spanner
|
24
|
+
module Admin
|
25
|
+
module Instance
|
26
|
+
module V1
|
27
|
+
module InstanceAdmin
|
28
|
+
module Rest
|
29
|
+
# Service that implements Longrunning Operations API.
|
30
|
+
class Operations
|
31
|
+
# @private
|
32
|
+
attr_reader :operations_stub
|
33
|
+
|
34
|
+
##
|
35
|
+
# Configuration for the InstanceAdmin Operations API.
|
36
|
+
#
|
37
|
+
# @yield [config] Configure the Operations client.
|
38
|
+
# @yieldparam config [Operations::Configuration]
|
39
|
+
#
|
40
|
+
# @return [Operations::Configuration]
|
41
|
+
#
|
42
|
+
def self.configure
|
43
|
+
@configure ||= Operations::Configuration.new
|
44
|
+
yield @configure if block_given?
|
45
|
+
@configure
|
46
|
+
end
|
47
|
+
|
48
|
+
##
|
49
|
+
# Configure the InstanceAdmin Operations instance.
|
50
|
+
#
|
51
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
52
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
53
|
+
# should be made on {Operations.configure}.
|
54
|
+
#
|
55
|
+
# @yield [config] Configure the Operations client.
|
56
|
+
# @yieldparam config [Operations::Configuration]
|
57
|
+
#
|
58
|
+
# @return [Operations::Configuration]
|
59
|
+
#
|
60
|
+
def configure
|
61
|
+
yield @config if block_given?
|
62
|
+
@config
|
63
|
+
end
|
64
|
+
|
65
|
+
##
|
66
|
+
# Create a new Operations client object.
|
67
|
+
#
|
68
|
+
# @yield [config] Configure the Client client.
|
69
|
+
# @yieldparam config [Operations::Configuration]
|
70
|
+
#
|
71
|
+
def initialize
|
72
|
+
# Create the configuration object
|
73
|
+
@config = Configuration.new Operations.configure
|
74
|
+
|
75
|
+
# Yield the configuration if needed
|
76
|
+
yield @config if block_given?
|
77
|
+
|
78
|
+
# Create credentials
|
79
|
+
credentials = @config.credentials
|
80
|
+
credentials ||= Credentials.default scope: @config.scope
|
81
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
82
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
83
|
+
end
|
84
|
+
|
85
|
+
@quota_project_id = @config.quota_project
|
86
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
87
|
+
|
88
|
+
@operations_stub = OperationsServiceStub.new(
|
89
|
+
endpoint: @config.endpoint,
|
90
|
+
credentials: credentials
|
91
|
+
)
|
92
|
+
|
93
|
+
# Used by an LRO wrapper for some methods of this service
|
94
|
+
@operations_client = self
|
95
|
+
end
|
96
|
+
|
97
|
+
# Service calls
|
98
|
+
|
99
|
+
##
|
100
|
+
# Lists operations that match the specified filter in the request. If the
|
101
|
+
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
102
|
+
#
|
103
|
+
# NOTE: the `name` binding allows API services to override the binding
|
104
|
+
# to use different resource name schemes, such as `users/*/operations`. To
|
105
|
+
# override the binding, API services can add a binding such as
|
106
|
+
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
107
|
+
# For backwards compatibility, the default name includes the operations
|
108
|
+
# collection id, however overriding users must ensure the name binding
|
109
|
+
# is the parent resource, without the operations collection id.
|
110
|
+
#
|
111
|
+
# @overload list_operations(request, options = nil)
|
112
|
+
# Pass arguments to `list_operations` via a request object, either of type
|
113
|
+
# {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
114
|
+
#
|
115
|
+
# @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
|
116
|
+
# A request object representing the call parameters. Required. To specify no
|
117
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
118
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
119
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
120
|
+
#
|
121
|
+
# @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
|
122
|
+
# Pass arguments to `list_operations` via keyword arguments. Note that at
|
123
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
124
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
125
|
+
#
|
126
|
+
# @param name [::String]
|
127
|
+
# The name of the operation's parent resource.
|
128
|
+
# @param filter [::String]
|
129
|
+
# The standard list filter.
|
130
|
+
# @param page_size [::Integer]
|
131
|
+
# The standard list page size.
|
132
|
+
# @param page_token [::String]
|
133
|
+
# The standard list page token.
|
134
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
135
|
+
# @yieldparam result [::Gapic::Operation]
|
136
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
137
|
+
#
|
138
|
+
# @return [::Gapic::Operation]
|
139
|
+
#
|
140
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
141
|
+
def list_operations request, options = nil
|
142
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
143
|
+
|
144
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
|
145
|
+
|
146
|
+
# Converts hash and nil to an options object
|
147
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
148
|
+
|
149
|
+
# Customize the options with defaults
|
150
|
+
call_metadata = @config.rpcs.list_operations.metadata.to_h
|
151
|
+
|
152
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
153
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
154
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
155
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
|
156
|
+
transports_version_send: [:rest]
|
157
|
+
|
158
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
159
|
+
|
160
|
+
options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
|
161
|
+
metadata: call_metadata,
|
162
|
+
retry_policy: @config.rpcs.list_operations.retry_policy
|
163
|
+
|
164
|
+
options.apply_defaults timeout: @config.timeout,
|
165
|
+
metadata: @config.metadata,
|
166
|
+
retry_policy: @config.retry_policy
|
167
|
+
|
168
|
+
@operations_stub.list_operations request, options do |result, operation|
|
169
|
+
result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
|
170
|
+
yield result, operation if block_given?
|
171
|
+
return result
|
172
|
+
end
|
173
|
+
rescue ::Gapic::Rest::Error => e
|
174
|
+
raise ::Google::Cloud::Error.from_error(e)
|
175
|
+
end
|
176
|
+
|
177
|
+
##
|
178
|
+
# Gets the latest state of a long-running operation. Clients can use this
|
179
|
+
# method to poll the operation result at intervals as recommended by the API
|
180
|
+
# service.
|
181
|
+
#
|
182
|
+
# @overload get_operation(request, options = nil)
|
183
|
+
# Pass arguments to `get_operation` via a request object, either of type
|
184
|
+
# {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
|
185
|
+
#
|
186
|
+
# @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
|
187
|
+
# A request object representing the call parameters. Required. To specify no
|
188
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
189
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
190
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
191
|
+
#
|
192
|
+
# @overload get_operation(name: nil)
|
193
|
+
# Pass arguments to `get_operation` via keyword arguments. Note that at
|
194
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
195
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
196
|
+
#
|
197
|
+
# @param name [::String]
|
198
|
+
# The name of the operation resource.
|
199
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
200
|
+
# @yieldparam result [::Gapic::Operation]
|
201
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
202
|
+
#
|
203
|
+
# @return [::Gapic::Operation]
|
204
|
+
#
|
205
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
206
|
+
def get_operation request, options = nil
|
207
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
208
|
+
|
209
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
|
210
|
+
|
211
|
+
# Converts hash and nil to an options object
|
212
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
213
|
+
|
214
|
+
# Customize the options with defaults
|
215
|
+
call_metadata = @config.rpcs.get_operation.metadata.to_h
|
216
|
+
|
217
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
218
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
219
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
220
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
|
221
|
+
transports_version_send: [:rest]
|
222
|
+
|
223
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
224
|
+
|
225
|
+
options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
|
226
|
+
metadata: call_metadata,
|
227
|
+
retry_policy: @config.rpcs.get_operation.retry_policy
|
228
|
+
|
229
|
+
options.apply_defaults timeout: @config.timeout,
|
230
|
+
metadata: @config.metadata,
|
231
|
+
retry_policy: @config.retry_policy
|
232
|
+
|
233
|
+
@operations_stub.get_operation request, options do |result, operation|
|
234
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
235
|
+
yield result, operation if block_given?
|
236
|
+
return result
|
237
|
+
end
|
238
|
+
rescue ::Gapic::Rest::Error => e
|
239
|
+
raise ::Google::Cloud::Error.from_error(e)
|
240
|
+
end
|
241
|
+
|
242
|
+
##
|
243
|
+
# Deletes a long-running operation. This method indicates that the client is
|
244
|
+
# no longer interested in the operation result. It does not cancel the
|
245
|
+
# operation. If the server doesn't support this method, it returns
|
246
|
+
# `google.rpc.Code.UNIMPLEMENTED`.
|
247
|
+
#
|
248
|
+
# @overload delete_operation(request, options = nil)
|
249
|
+
# Pass arguments to `delete_operation` via a request object, either of type
|
250
|
+
# {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
|
251
|
+
#
|
252
|
+
# @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
|
253
|
+
# A request object representing the call parameters. Required. To specify no
|
254
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
255
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
256
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
257
|
+
#
|
258
|
+
# @overload delete_operation(name: nil)
|
259
|
+
# Pass arguments to `delete_operation` via keyword arguments. Note that at
|
260
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
261
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
262
|
+
#
|
263
|
+
# @param name [::String]
|
264
|
+
# The name of the operation resource to be deleted.
|
265
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
266
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
267
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
268
|
+
#
|
269
|
+
# @return [::Google::Protobuf::Empty]
|
270
|
+
#
|
271
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
272
|
+
def delete_operation request, options = nil
|
273
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
274
|
+
|
275
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
|
276
|
+
|
277
|
+
# Converts hash and nil to an options object
|
278
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
279
|
+
|
280
|
+
# Customize the options with defaults
|
281
|
+
call_metadata = @config.rpcs.delete_operation.metadata.to_h
|
282
|
+
|
283
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
284
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
285
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
286
|
+
gapic_version: ::Google::Cloud::Spanner::Admin::Instance::V1::VERSION,
|
287
|
+
transports_version_send: [:rest]
|
288
|
+
|
289
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
290
|
+
|
291
|
+
options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
|
292
|
+
metadata: call_metadata,
|
293
|
+
retry_policy: @config.rpcs.delete_operation.retry_policy
|
294
|
+
|
295
|
+
options.apply_defaults timeout: @config.timeout,
|
296
|
+
metadata: @config.metadata,
|
297
|
+
retry_policy: @config.retry_policy
|
298
|
+
|
299
|
+
@operations_stub.delete_operation request, options do |result, operation|
|
300
|
+
yield result, operation if block_given?
|
301
|
+
return result
|
302
|
+
end
|
303
|
+
rescue ::Gapic::Rest::Error => e
|
304
|
+
raise ::Google::Cloud::Error.from_error(e)
|
305
|
+
end
|
306
|
+
|
307
|
+
##
|
308
|
+
# Starts asynchronous cancellation on a long-running operation. The server
|
309
|
+
# makes a best effort to cancel the operation, but success is not
|
310
|
+
# guaranteed. If the server doesn't support this method, it returns
|
311
|
+
# `google.rpc.Code.UNIMPLEMENTED`. Clients can use
|
312
|
+
# Operations.GetOperation or
|
313
|
+
# other methods to check whether the cancellation succeeded or whether the
|
314
|
+
# operation completed despite cancellation. On successful cancellation,
|
315
|
+
# the operation is not deleted; instead, it becomes an operation with
|
316
|
+
# an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
|
317
|
+
# corresponding to `Code.CANCELLED`.
|
318
|
+
#
|
319
|
+
# @overload cancel_operation(request, options = nil)
|
320
|
+
# Pass arguments to `cancel_operation` via a request object, either of type
|
321
|
+
# {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
|
322
|
+
#
|
323
|
+
# @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
|
324
|
+
# A request object representing the call parameters. Required. To specify no
|
325
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
326
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
327
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
328
|
+
#
|
329
|
+
# @overload cancel_operation(name: nil)
|
330
|
+
# Pass arguments to `cancel_operation` via keyword arguments. Note that at
|
331
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
332
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
333
|
+
#
|
334
|
+
# @param name [::String]
|
335
|
+
# The name of the operation resource to be cancelled.
|
336
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
337
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
338
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
339
|
+
#
|
340
|
+
# @return [::Google::Protobuf::Empty]
|
341
|
+
#
|
342
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
343
|
+
def cancel_operation request, options = nil
|
344
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
345
|
+
|
346
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
|
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
|
+
call_metadata = @config.rpcs.cancel_operation.metadata.to_h
|
353
|
+
|
354
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
355
|
+
call_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::Spanner::Admin::Instance::V1::VERSION,
|
358
|
+
transports_version_send: [:rest]
|
359
|
+
|
360
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
361
|
+
|
362
|
+
options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
|
363
|
+
metadata: call_metadata,
|
364
|
+
retry_policy: @config.rpcs.cancel_operation.retry_policy
|
365
|
+
|
366
|
+
options.apply_defaults timeout: @config.timeout,
|
367
|
+
metadata: @config.metadata,
|
368
|
+
retry_policy: @config.retry_policy
|
369
|
+
|
370
|
+
@operations_stub.cancel_operation request, options do |result, operation|
|
371
|
+
yield result, operation if block_given?
|
372
|
+
return result
|
373
|
+
end
|
374
|
+
rescue ::Gapic::Rest::Error => e
|
375
|
+
raise ::Google::Cloud::Error.from_error(e)
|
376
|
+
end
|
377
|
+
|
378
|
+
##
|
379
|
+
# Configuration class for the Operations REST API.
|
380
|
+
#
|
381
|
+
# This class represents the configuration for Operations REST,
|
382
|
+
# providing control over timeouts, retry behavior, logging, transport
|
383
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
384
|
+
# applied individually to specific RPCs. See
|
385
|
+
# {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs}
|
386
|
+
# for a list of RPCs that can be configured independently.
|
387
|
+
#
|
388
|
+
# Configuration can be applied globally to all clients, or to a single client
|
389
|
+
# on construction.
|
390
|
+
#
|
391
|
+
# @example
|
392
|
+
#
|
393
|
+
# # Modify the global config, setting the timeout for
|
394
|
+
# # list_operations to 20 seconds,
|
395
|
+
# # and all remaining timeouts to 10 seconds.
|
396
|
+
# ::Google::Longrunning::Operations::Rest::Client.configure do |config|
|
397
|
+
# config.timeout = 10.0
|
398
|
+
# config.rpcs.list_operations.timeout = 20.0
|
399
|
+
# end
|
400
|
+
#
|
401
|
+
# # Apply the above configuration only to a new client.
|
402
|
+
# client = ::Google::Longrunning::Operations::Rest::Client.new do |config|
|
403
|
+
# config.timeout = 10.0
|
404
|
+
# config.rpcs.list_operations.timeout = 20.0
|
405
|
+
# end
|
406
|
+
#
|
407
|
+
# @!attribute [rw] endpoint
|
408
|
+
# The hostname or hostname:port of the service endpoint.
|
409
|
+
# Defaults to `"spanner.googleapis.com"`.
|
410
|
+
# @return [::String]
|
411
|
+
# @!attribute [rw] credentials
|
412
|
+
# Credentials to send with calls. You may provide any of the following types:
|
413
|
+
# * (`String`) The path to a service account key file in JSON format
|
414
|
+
# * (`Hash`) A service account key as a Hash
|
415
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
416
|
+
# (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
|
417
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
418
|
+
# (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
|
419
|
+
# * (`nil`) indicating no credentials
|
420
|
+
# @return [::Object]
|
421
|
+
# @!attribute [rw] scope
|
422
|
+
# The OAuth scopes
|
423
|
+
# @return [::Array<::String>]
|
424
|
+
# @!attribute [rw] lib_name
|
425
|
+
# The library name as recorded in instrumentation and logging
|
426
|
+
# @return [::String]
|
427
|
+
# @!attribute [rw] lib_version
|
428
|
+
# The library version as recorded in instrumentation and logging
|
429
|
+
# @return [::String]
|
430
|
+
# @!attribute [rw] timeout
|
431
|
+
# The call timeout in seconds.
|
432
|
+
# @return [::Numeric]
|
433
|
+
# @!attribute [rw] metadata
|
434
|
+
# Additional headers to be sent with the call.
|
435
|
+
# @return [::Hash{::Symbol=>::String}]
|
436
|
+
# @!attribute [rw] retry_policy
|
437
|
+
# The retry policy. The value is a hash with the following keys:
|
438
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
439
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
440
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
441
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
442
|
+
# trigger a retry.
|
443
|
+
# @return [::Hash]
|
444
|
+
# @!attribute [rw] quota_project
|
445
|
+
# A separate project against which to charge quota.
|
446
|
+
# @return [::String]
|
447
|
+
#
|
448
|
+
class Configuration
|
449
|
+
extend ::Gapic::Config
|
450
|
+
|
451
|
+
config_attr :endpoint, "spanner.googleapis.com", ::String
|
452
|
+
config_attr :credentials, nil do |value|
|
453
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
454
|
+
allowed.any? { |klass| klass === value }
|
455
|
+
end
|
456
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
457
|
+
config_attr :lib_name, nil, ::String, nil
|
458
|
+
config_attr :lib_version, nil, ::String, nil
|
459
|
+
config_attr :timeout, nil, ::Numeric, nil
|
460
|
+
config_attr :metadata, nil, ::Hash, nil
|
461
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
462
|
+
config_attr :quota_project, nil, ::String, nil
|
463
|
+
|
464
|
+
# @private
|
465
|
+
def initialize parent_config = nil
|
466
|
+
@parent_config = parent_config unless parent_config.nil?
|
467
|
+
|
468
|
+
yield self if block_given?
|
469
|
+
end
|
470
|
+
|
471
|
+
##
|
472
|
+
# Configurations for individual RPCs
|
473
|
+
# @return [Rpcs]
|
474
|
+
#
|
475
|
+
def rpcs
|
476
|
+
@rpcs ||= begin
|
477
|
+
parent_rpcs = nil
|
478
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
479
|
+
Rpcs.new parent_rpcs
|
480
|
+
end
|
481
|
+
end
|
482
|
+
|
483
|
+
##
|
484
|
+
# Configuration RPC class for the Operations API.
|
485
|
+
#
|
486
|
+
# Includes fields providing the configuration for each RPC in this service.
|
487
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
488
|
+
# the following configuration fields:
|
489
|
+
#
|
490
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
491
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
492
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
493
|
+
# include the following keys:
|
494
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
495
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
496
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
497
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
498
|
+
# trigger a retry.
|
499
|
+
#
|
500
|
+
class Rpcs
|
501
|
+
##
|
502
|
+
# RPC-specific configuration for `list_operations`
|
503
|
+
# @return [::Gapic::Config::Method]
|
504
|
+
#
|
505
|
+
attr_reader :list_operations
|
506
|
+
##
|
507
|
+
# RPC-specific configuration for `get_operation`
|
508
|
+
# @return [::Gapic::Config::Method]
|
509
|
+
#
|
510
|
+
attr_reader :get_operation
|
511
|
+
##
|
512
|
+
# RPC-specific configuration for `delete_operation`
|
513
|
+
# @return [::Gapic::Config::Method]
|
514
|
+
#
|
515
|
+
attr_reader :delete_operation
|
516
|
+
##
|
517
|
+
# RPC-specific configuration for `cancel_operation`
|
518
|
+
# @return [::Gapic::Config::Method]
|
519
|
+
#
|
520
|
+
attr_reader :cancel_operation
|
521
|
+
|
522
|
+
# @private
|
523
|
+
def initialize parent_rpcs = nil
|
524
|
+
list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
|
525
|
+
@list_operations = ::Gapic::Config::Method.new list_operations_config
|
526
|
+
get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
|
527
|
+
@get_operation = ::Gapic::Config::Method.new get_operation_config
|
528
|
+
delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
|
529
|
+
@delete_operation = ::Gapic::Config::Method.new delete_operation_config
|
530
|
+
cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
|
531
|
+
@cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
|
532
|
+
|
533
|
+
yield self if block_given?
|
534
|
+
end
|
535
|
+
end
|
536
|
+
end
|
537
|
+
end
|
538
|
+
|
539
|
+
##
|
540
|
+
# @private
|
541
|
+
# REST service stub for the Longrunning Operations API.
|
542
|
+
# Service stub contains baseline method implementations
|
543
|
+
# including transcoding, making the REST call, and deserialing the response.
|
544
|
+
class OperationsServiceStub
|
545
|
+
def initialize endpoint:, credentials:
|
546
|
+
# These require statements are intentionally placed here to initialize
|
547
|
+
# the REST modules only when it's required.
|
548
|
+
require "gapic/rest"
|
549
|
+
|
550
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint, credentials: credentials
|
551
|
+
end
|
552
|
+
|
553
|
+
##
|
554
|
+
# Baseline implementation for the list_operations REST call
|
555
|
+
#
|
556
|
+
# @param request_pb [::Google::Longrunning::ListOperationsRequest]
|
557
|
+
# A request object representing the call parameters. Required.
|
558
|
+
# @param options [::Gapic::CallOptions]
|
559
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
560
|
+
#
|
561
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
562
|
+
# @yieldparam result [::Google::Longrunning::ListOperationsResponse]
|
563
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
564
|
+
#
|
565
|
+
# @return [::Google::Longrunning::ListOperationsResponse]
|
566
|
+
# A result object deserialized from the server's reply
|
567
|
+
def list_operations request_pb, options = nil
|
568
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
569
|
+
|
570
|
+
verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb
|
571
|
+
query_string_params = if query_string_params.any?
|
572
|
+
query_string_params.to_h { |p| p.split("=", 2) }
|
573
|
+
else
|
574
|
+
{}
|
575
|
+
end
|
576
|
+
|
577
|
+
response = @client_stub.make_http_request(
|
578
|
+
verb,
|
579
|
+
uri: uri,
|
580
|
+
body: body || "",
|
581
|
+
params: query_string_params,
|
582
|
+
options: options
|
583
|
+
)
|
584
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
585
|
+
result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
|
586
|
+
|
587
|
+
yield result, operation if block_given?
|
588
|
+
result
|
589
|
+
end
|
590
|
+
|
591
|
+
##
|
592
|
+
# Baseline implementation for the get_operation REST call
|
593
|
+
#
|
594
|
+
# @param request_pb [::Google::Longrunning::GetOperationRequest]
|
595
|
+
# A request object representing the call parameters. Required.
|
596
|
+
# @param options [::Gapic::CallOptions]
|
597
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
598
|
+
#
|
599
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
600
|
+
# @yieldparam result [::Google::Longrunning::Operation]
|
601
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
602
|
+
#
|
603
|
+
# @return [::Google::Longrunning::Operation]
|
604
|
+
# A result object deserialized from the server's reply
|
605
|
+
def get_operation request_pb, options = nil
|
606
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
607
|
+
|
608
|
+
verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb
|
609
|
+
query_string_params = if query_string_params.any?
|
610
|
+
query_string_params.to_h { |p| p.split("=", 2) }
|
611
|
+
else
|
612
|
+
{}
|
613
|
+
end
|
614
|
+
|
615
|
+
response = @client_stub.make_http_request(
|
616
|
+
verb,
|
617
|
+
uri: uri,
|
618
|
+
body: body || "",
|
619
|
+
params: query_string_params,
|
620
|
+
options: options
|
621
|
+
)
|
622
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
623
|
+
result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
|
624
|
+
|
625
|
+
yield result, operation if block_given?
|
626
|
+
result
|
627
|
+
end
|
628
|
+
|
629
|
+
##
|
630
|
+
# Baseline implementation for the delete_operation REST call
|
631
|
+
#
|
632
|
+
# @param request_pb [::Google::Longrunning::DeleteOperationRequest]
|
633
|
+
# A request object representing the call parameters. Required.
|
634
|
+
# @param options [::Gapic::CallOptions]
|
635
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
636
|
+
#
|
637
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
638
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
639
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
640
|
+
#
|
641
|
+
# @return [::Google::Protobuf::Empty]
|
642
|
+
# A result object deserialized from the server's reply
|
643
|
+
def delete_operation request_pb, options = nil
|
644
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
645
|
+
|
646
|
+
verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb
|
647
|
+
query_string_params = if query_string_params.any?
|
648
|
+
query_string_params.to_h { |p| p.split("=", 2) }
|
649
|
+
else
|
650
|
+
{}
|
651
|
+
end
|
652
|
+
|
653
|
+
response = @client_stub.make_http_request(
|
654
|
+
verb,
|
655
|
+
uri: uri,
|
656
|
+
body: body || "",
|
657
|
+
params: query_string_params,
|
658
|
+
options: options
|
659
|
+
)
|
660
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
661
|
+
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
|
662
|
+
|
663
|
+
yield result, operation if block_given?
|
664
|
+
result
|
665
|
+
end
|
666
|
+
|
667
|
+
##
|
668
|
+
# Baseline implementation for the cancel_operation REST call
|
669
|
+
#
|
670
|
+
# @param request_pb [::Google::Longrunning::CancelOperationRequest]
|
671
|
+
# A request object representing the call parameters. Required.
|
672
|
+
# @param options [::Gapic::CallOptions]
|
673
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
674
|
+
#
|
675
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
676
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
677
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
678
|
+
#
|
679
|
+
# @return [::Google::Protobuf::Empty]
|
680
|
+
# A result object deserialized from the server's reply
|
681
|
+
def cancel_operation request_pb, options = nil
|
682
|
+
raise ::ArgumentError, "request must be provided" if request_pb.nil?
|
683
|
+
|
684
|
+
verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb
|
685
|
+
query_string_params = if query_string_params.any?
|
686
|
+
query_string_params.to_h { |p| p.split("=", 2) }
|
687
|
+
else
|
688
|
+
{}
|
689
|
+
end
|
690
|
+
|
691
|
+
response = @client_stub.make_http_request(
|
692
|
+
verb,
|
693
|
+
uri: uri,
|
694
|
+
body: body || "",
|
695
|
+
params: query_string_params,
|
696
|
+
options: options
|
697
|
+
)
|
698
|
+
operation = ::Gapic::Rest::TransportOperation.new response
|
699
|
+
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
|
700
|
+
|
701
|
+
yield result, operation if block_given?
|
702
|
+
result
|
703
|
+
end
|
704
|
+
|
705
|
+
##
|
706
|
+
# @private
|
707
|
+
#
|
708
|
+
# GRPC transcoding helper method for the list_operations REST call
|
709
|
+
#
|
710
|
+
# @param request_pb [::Google::Longrunning::ListOperationsRequest]
|
711
|
+
# A request object representing the call parameters. Required.
|
712
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
713
|
+
# Uri, Body, Query string parameters
|
714
|
+
def self.transcode_list_operations_request request_pb
|
715
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
716
|
+
.with_bindings(
|
717
|
+
uri_method: :get,
|
718
|
+
uri_template: "/v1/{name}",
|
719
|
+
matches: [
|
720
|
+
["name", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/?$}, false]
|
721
|
+
]
|
722
|
+
)
|
723
|
+
.with_bindings(
|
724
|
+
uri_method: :get,
|
725
|
+
uri_template: "/v1/{name}",
|
726
|
+
matches: [
|
727
|
+
["name", %r{^projects/[^/]+/instances/[^/]+/operations/?$}, false]
|
728
|
+
]
|
729
|
+
)
|
730
|
+
transcoder.transcode request_pb
|
731
|
+
end
|
732
|
+
|
733
|
+
##
|
734
|
+
# @private
|
735
|
+
#
|
736
|
+
# GRPC transcoding helper method for the get_operation REST call
|
737
|
+
#
|
738
|
+
# @param request_pb [::Google::Longrunning::GetOperationRequest]
|
739
|
+
# A request object representing the call parameters. Required.
|
740
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
741
|
+
# Uri, Body, Query string parameters
|
742
|
+
def self.transcode_get_operation_request request_pb
|
743
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
744
|
+
.with_bindings(
|
745
|
+
uri_method: :get,
|
746
|
+
uri_template: "/v1/{name}",
|
747
|
+
matches: [
|
748
|
+
["name", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/[^/]+/?$}, false]
|
749
|
+
]
|
750
|
+
)
|
751
|
+
.with_bindings(
|
752
|
+
uri_method: :get,
|
753
|
+
uri_template: "/v1/{name}",
|
754
|
+
matches: [
|
755
|
+
["name", %r{^projects/[^/]+/instances/[^/]+/operations/[^/]+/?$}, false]
|
756
|
+
]
|
757
|
+
)
|
758
|
+
transcoder.transcode request_pb
|
759
|
+
end
|
760
|
+
|
761
|
+
##
|
762
|
+
# @private
|
763
|
+
#
|
764
|
+
# GRPC transcoding helper method for the delete_operation REST call
|
765
|
+
#
|
766
|
+
# @param request_pb [::Google::Longrunning::DeleteOperationRequest]
|
767
|
+
# A request object representing the call parameters. Required.
|
768
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
769
|
+
# Uri, Body, Query string parameters
|
770
|
+
def self.transcode_delete_operation_request request_pb
|
771
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
772
|
+
.with_bindings(
|
773
|
+
uri_method: :delete,
|
774
|
+
uri_template: "/v1/{name}",
|
775
|
+
matches: [
|
776
|
+
["name", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/[^/]+/?$}, false]
|
777
|
+
]
|
778
|
+
)
|
779
|
+
.with_bindings(
|
780
|
+
uri_method: :delete,
|
781
|
+
uri_template: "/v1/{name}",
|
782
|
+
matches: [
|
783
|
+
["name", %r{^projects/[^/]+/instances/[^/]+/operations/[^/]+/?$}, false]
|
784
|
+
]
|
785
|
+
)
|
786
|
+
transcoder.transcode request_pb
|
787
|
+
end
|
788
|
+
|
789
|
+
##
|
790
|
+
# @private
|
791
|
+
#
|
792
|
+
# GRPC transcoding helper method for the cancel_operation REST call
|
793
|
+
#
|
794
|
+
# @param request_pb [::Google::Longrunning::CancelOperationRequest]
|
795
|
+
# A request object representing the call parameters. Required.
|
796
|
+
# @return [Array(String, [String, nil], Hash{String => String})]
|
797
|
+
# Uri, Body, Query string parameters
|
798
|
+
def self.transcode_cancel_operation_request request_pb
|
799
|
+
transcoder = Gapic::Rest::GrpcTranscoder.new
|
800
|
+
.with_bindings(
|
801
|
+
uri_method: :post,
|
802
|
+
uri_template: "/v1/{name}:cancel",
|
803
|
+
matches: [
|
804
|
+
["name", %r{^projects/[^/]+/instances/[^/]+/databases/[^/]+/operations/[^/]+/?$}, false]
|
805
|
+
]
|
806
|
+
)
|
807
|
+
.with_bindings(
|
808
|
+
uri_method: :post,
|
809
|
+
uri_template: "/v1/{name}:cancel",
|
810
|
+
matches: [
|
811
|
+
["name", %r{^projects/[^/]+/instances/[^/]+/operations/[^/]+/?$}, false]
|
812
|
+
]
|
813
|
+
)
|
814
|
+
transcoder.transcode request_pb
|
815
|
+
end
|
816
|
+
end
|
817
|
+
end
|
818
|
+
end
|
819
|
+
end
|
820
|
+
end
|
821
|
+
end
|
822
|
+
end
|
823
|
+
end
|
824
|
+
end
|