google-cloud-run-v2 0.28.1 → 0.29.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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/lib/google/cloud/run/v2/build_pb.rb +4 -25
  4. data/lib/google/cloud/run/v2/builds/client.rb +11 -1
  5. data/lib/google/cloud/run/v2/builds/rest/client.rb +11 -1
  6. data/lib/google/cloud/run/v2/condition_pb.rb +3 -25
  7. data/lib/google/cloud/run/v2/container_status_pb.rb +21 -0
  8. data/lib/google/cloud/run/v2/execution_pb.rb +2 -26
  9. data/lib/google/cloud/run/v2/execution_template_pb.rb +2 -24
  10. data/lib/google/cloud/run/v2/executions/client.rb +2 -0
  11. data/lib/google/cloud/run/v2/executions/operations.rb +2 -0
  12. data/lib/google/cloud/run/v2/executions/rest/client.rb +2 -0
  13. data/lib/google/cloud/run/v2/executions/rest/operations.rb +2 -0
  14. data/lib/google/cloud/run/v2/instance_pb.rb +42 -0
  15. data/lib/google/cloud/run/v2/instance_services_pb.rb +55 -0
  16. data/lib/google/cloud/run/v2/instance_split_pb.rb +2 -23
  17. data/lib/google/cloud/run/v2/instances/client.rb +1059 -0
  18. data/lib/google/cloud/run/v2/instances/credentials.rb +47 -0
  19. data/lib/google/cloud/run/v2/instances/operations.rb +851 -0
  20. data/lib/google/cloud/run/v2/instances/paths.rb +178 -0
  21. data/lib/google/cloud/run/v2/instances/rest/client.rb +962 -0
  22. data/lib/google/cloud/run/v2/instances/rest/operations.rb +1095 -0
  23. data/lib/google/cloud/run/v2/instances/rest/service_stub.rb +450 -0
  24. data/lib/google/cloud/run/v2/instances/rest.rb +53 -0
  25. data/lib/google/cloud/run/v2/instances.rb +56 -0
  26. data/lib/google/cloud/run/v2/job_pb.rb +3 -30
  27. data/lib/google/cloud/run/v2/jobs/client.rb +2 -0
  28. data/lib/google/cloud/run/v2/jobs/operations.rb +2 -0
  29. data/lib/google/cloud/run/v2/jobs/rest/client.rb +2 -0
  30. data/lib/google/cloud/run/v2/jobs/rest/operations.rb +2 -0
  31. data/lib/google/cloud/run/v2/k8s.min_pb.rb +5 -24
  32. data/lib/google/cloud/run/v2/rest.rb +1 -0
  33. data/lib/google/cloud/run/v2/revision_pb.rb +2 -29
  34. data/lib/google/cloud/run/v2/revision_template_pb.rb +2 -26
  35. data/lib/google/cloud/run/v2/revisions/client.rb +2 -0
  36. data/lib/google/cloud/run/v2/revisions/operations.rb +2 -0
  37. data/lib/google/cloud/run/v2/revisions/rest/client.rb +2 -0
  38. data/lib/google/cloud/run/v2/revisions/rest/operations.rb +2 -0
  39. data/lib/google/cloud/run/v2/service_pb.rb +4 -30
  40. data/lib/google/cloud/run/v2/services/client.rb +2 -0
  41. data/lib/google/cloud/run/v2/services/operations.rb +2 -0
  42. data/lib/google/cloud/run/v2/services/rest/client.rb +2 -0
  43. data/lib/google/cloud/run/v2/services/rest/operations.rb +2 -0
  44. data/lib/google/cloud/run/v2/status_pb.rb +2 -23
  45. data/lib/google/cloud/run/v2/task_pb.rb +2 -29
  46. data/lib/google/cloud/run/v2/task_template_pb.rb +2 -26
  47. data/lib/google/cloud/run/v2/tasks/client.rb +2 -0
  48. data/lib/google/cloud/run/v2/tasks/rest/client.rb +2 -0
  49. data/lib/google/cloud/run/v2/traffic_target_pb.rb +2 -23
  50. data/lib/google/cloud/run/v2/vendor_settings_pb.rb +3 -24
  51. data/lib/google/cloud/run/v2/version.rb +1 -1
  52. data/lib/google/cloud/run/v2/worker_pool_pb.rb +3 -30
  53. data/lib/google/cloud/run/v2/worker_pool_revision_template_pb.rb +3 -27
  54. data/lib/google/cloud/run/v2/worker_pools/client.rb +2 -0
  55. data/lib/google/cloud/run/v2/worker_pools/operations.rb +2 -0
  56. data/lib/google/cloud/run/v2/worker_pools/rest/client.rb +2 -0
  57. data/lib/google/cloud/run/v2/worker_pools/rest/operations.rb +2 -0
  58. data/lib/google/cloud/run/v2.rb +1 -0
  59. data/proto_docs/google/api/client.rb +149 -29
  60. data/proto_docs/google/api/routing.rb +7 -3
  61. data/proto_docs/google/cloud/run/v2/build.rb +11 -0
  62. data/proto_docs/google/cloud/run/v2/condition.rb +3 -0
  63. data/proto_docs/google/cloud/run/v2/container_status.rb +42 -0
  64. data/proto_docs/google/cloud/run/v2/instance.rb +328 -0
  65. data/proto_docs/google/cloud/run/v2/job.rb +2 -2
  66. data/proto_docs/google/cloud/run/v2/k8s.min.rb +37 -2
  67. data/proto_docs/google/cloud/run/v2/service.rb +32 -7
  68. data/proto_docs/google/cloud/run/v2/vendor_settings.rb +5 -0
  69. data/proto_docs/google/cloud/run/v2/worker_pool.rb +23 -22
  70. data/proto_docs/google/cloud/run/v2/worker_pool_revision_template.rb +3 -0
  71. metadata +18 -4
@@ -0,0 +1,1095 @@
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 "gapic/operation"
20
+
21
+ module Google
22
+ module Cloud
23
+ module Run
24
+ module V2
25
+ module Instances
26
+ module Rest
27
+ # Service that implements Longrunning Operations API.
28
+ class Operations
29
+ # @private
30
+ API_VERSION = ""
31
+
32
+ # @private
33
+ DEFAULT_ENDPOINT_TEMPLATE = "run.$UNIVERSE_DOMAIN$"
34
+
35
+ # @private
36
+ attr_reader :operations_stub
37
+
38
+ ##
39
+ # Configuration for the Instances Operations API.
40
+ #
41
+ # @yield [config] Configure the Operations client.
42
+ # @yieldparam config [Operations::Configuration]
43
+ #
44
+ # @return [Operations::Configuration]
45
+ #
46
+ def self.configure
47
+ @configure ||= Operations::Configuration.new
48
+ yield @configure if block_given?
49
+ @configure
50
+ end
51
+
52
+ ##
53
+ # Configure the Instances Operations instance.
54
+ #
55
+ # The configuration is set to the derived mode, meaning that values can be changed,
56
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
57
+ # should be made on {Operations.configure}.
58
+ #
59
+ # @yield [config] Configure the Operations client.
60
+ # @yieldparam config [Operations::Configuration]
61
+ #
62
+ # @return [Operations::Configuration]
63
+ #
64
+ def configure
65
+ yield @config if block_given?
66
+ @config
67
+ end
68
+
69
+ ##
70
+ # The effective universe domain
71
+ #
72
+ # @return [String]
73
+ #
74
+ def universe_domain
75
+ @operations_stub.universe_domain
76
+ end
77
+
78
+ ##
79
+ # Create a new Operations client object.
80
+ #
81
+ # @yield [config] Configure the Client client.
82
+ # @yieldparam config [Operations::Configuration]
83
+ #
84
+ def initialize
85
+ # Create the configuration object
86
+ @config = Configuration.new Operations.configure
87
+
88
+ # Yield the configuration if needed
89
+ yield @config if block_given?
90
+
91
+ # Create credentials
92
+ credentials = @config.credentials
93
+ credentials ||= Credentials.default scope: @config.scope
94
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
95
+ credentials = Credentials.new credentials, scope: @config.scope
96
+ end
97
+
98
+ @quota_project_id = @config.quota_project
99
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
100
+
101
+ @operations_stub = OperationsServiceStub.new(
102
+ endpoint: @config.endpoint,
103
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
104
+ universe_domain: @config.universe_domain,
105
+ credentials: credentials
106
+ )
107
+
108
+ # Used by an LRO wrapper for some methods of this service
109
+ @operations_client = self
110
+ end
111
+
112
+ # Service calls
113
+
114
+ ##
115
+ # Lists operations that match the specified filter in the request. If the
116
+ # server doesn't support this method, it returns `UNIMPLEMENTED`.
117
+ #
118
+ # @overload list_operations(request, options = nil)
119
+ # Pass arguments to `list_operations` via a request object, either of type
120
+ # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
121
+ #
122
+ # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
123
+ # A request object representing the call parameters. Required. To specify no
124
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
125
+ # @param options [::Gapic::CallOptions, ::Hash]
126
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
127
+ #
128
+ # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil, return_partial_success: nil)
129
+ # Pass arguments to `list_operations` via keyword arguments. Note that at
130
+ # least one keyword argument is required. To specify no parameters, or to keep all
131
+ # the default parameter values, pass an empty Hash as a request object (see above).
132
+ #
133
+ # @param name [::String]
134
+ # The name of the operation's parent resource.
135
+ # @param filter [::String]
136
+ # The standard list filter.
137
+ # @param page_size [::Integer]
138
+ # The standard list page size.
139
+ # @param page_token [::String]
140
+ # The standard list page token.
141
+ # @param return_partial_success [::Boolean]
142
+ # When set to `true`, operations that are reachable are returned as normal,
143
+ # and those that are unreachable are returned in the
144
+ # [ListOperationsResponse.unreachable] field.
145
+ #
146
+ # This can only be `true` when reading across collections e.g. when `parent`
147
+ # is set to `"projects/example/locations/-"`.
148
+ #
149
+ # This field is not by default supported and will result in an
150
+ # `UNIMPLEMENTED` error if set unless explicitly documented otherwise in
151
+ # service or product specific documentation.
152
+ # @yield [result, operation] Access the result along with the TransportOperation object
153
+ # @yieldparam result [::Gapic::Operation]
154
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
155
+ #
156
+ # @return [::Gapic::Operation]
157
+ #
158
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
159
+ #
160
+ # @example Basic example
161
+ # require "google/longrunning"
162
+ #
163
+ # # Create a client object. The client can be reused for multiple calls.
164
+ # client = Google::Longrunning::Operations::Rest::Client.new
165
+ #
166
+ # # Create a request. To set request fields, pass in keyword arguments.
167
+ # request = Google::Longrunning::ListOperationsRequest.new
168
+ #
169
+ # # Call the list_operations method.
170
+ # result = client.list_operations request
171
+ #
172
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
173
+ # # over elements, and API calls will be issued to fetch pages as needed.
174
+ # result.each do |item|
175
+ # # Each element is of type ::Google::Longrunning::Operation.
176
+ # p item
177
+ # end
178
+ #
179
+ def list_operations request, options = nil
180
+ raise ::ArgumentError, "request must be provided" if request.nil?
181
+
182
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
183
+
184
+ # Converts hash and nil to an options object
185
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
186
+
187
+ # Customize the options with defaults
188
+ call_metadata = @config.rpcs.list_operations.metadata.to_h
189
+
190
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
191
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
192
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
193
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
194
+ transports_version_send: [:rest]
195
+
196
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
197
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
198
+
199
+ options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
200
+ metadata: call_metadata,
201
+ retry_policy: @config.rpcs.list_operations.retry_policy
202
+
203
+ options.apply_defaults timeout: @config.timeout,
204
+ metadata: @config.metadata,
205
+ retry_policy: @config.retry_policy
206
+
207
+ @operations_stub.list_operations request, options do |result, operation|
208
+ result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
209
+ yield result, operation if block_given?
210
+ throw :response, result
211
+ end
212
+ rescue ::Gapic::Rest::Error => e
213
+ raise ::Google::Cloud::Error.from_error(e)
214
+ end
215
+
216
+ ##
217
+ # Gets the latest state of a long-running operation. Clients can use this
218
+ # method to poll the operation result at intervals as recommended by the API
219
+ # service.
220
+ #
221
+ # @overload get_operation(request, options = nil)
222
+ # Pass arguments to `get_operation` via a request object, either of type
223
+ # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
224
+ #
225
+ # @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
226
+ # A request object representing the call parameters. Required. To specify no
227
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
228
+ # @param options [::Gapic::CallOptions, ::Hash]
229
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
230
+ #
231
+ # @overload get_operation(name: nil)
232
+ # Pass arguments to `get_operation` via keyword arguments. Note that at
233
+ # least one keyword argument is required. To specify no parameters, or to keep all
234
+ # the default parameter values, pass an empty Hash as a request object (see above).
235
+ #
236
+ # @param name [::String]
237
+ # The name of the operation resource.
238
+ # @yield [result, operation] Access the result along with the TransportOperation object
239
+ # @yieldparam result [::Gapic::Operation]
240
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
241
+ #
242
+ # @return [::Gapic::Operation]
243
+ #
244
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
245
+ #
246
+ # @example Basic example
247
+ # require "google/longrunning"
248
+ #
249
+ # # Create a client object. The client can be reused for multiple calls.
250
+ # client = Google::Longrunning::Operations::Rest::Client.new
251
+ #
252
+ # # Create a request. To set request fields, pass in keyword arguments.
253
+ # request = Google::Longrunning::GetOperationRequest.new
254
+ #
255
+ # # Call the get_operation method.
256
+ # result = client.get_operation request
257
+ #
258
+ # # The returned object is of type Gapic::Operation. You can use it to
259
+ # # check the status of an operation, cancel it, or wait for results.
260
+ # # Here is how to wait for a response.
261
+ # result.wait_until_done! timeout: 60
262
+ # if result.response?
263
+ # p result.response
264
+ # else
265
+ # puts "No response received."
266
+ # end
267
+ #
268
+ def get_operation request, options = nil
269
+ raise ::ArgumentError, "request must be provided" if request.nil?
270
+
271
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
272
+
273
+ # Converts hash and nil to an options object
274
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
275
+
276
+ # Customize the options with defaults
277
+ call_metadata = @config.rpcs.get_operation.metadata.to_h
278
+
279
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
280
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
281
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
282
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
283
+ transports_version_send: [:rest]
284
+
285
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
286
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
287
+
288
+ options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
289
+ metadata: call_metadata,
290
+ retry_policy: @config.rpcs.get_operation.retry_policy
291
+
292
+ options.apply_defaults timeout: @config.timeout,
293
+ metadata: @config.metadata,
294
+ retry_policy: @config.retry_policy
295
+
296
+ @operations_stub.get_operation request, options do |result, operation|
297
+ result = ::Gapic::Operation.new result, @operations_client, options: options
298
+ yield result, operation if block_given?
299
+ throw :response, result
300
+ end
301
+ rescue ::Gapic::Rest::Error => e
302
+ raise ::Google::Cloud::Error.from_error(e)
303
+ end
304
+
305
+ ##
306
+ # Deletes a long-running operation. This method indicates that the client is
307
+ # no longer interested in the operation result. It does not cancel the
308
+ # operation. If the server doesn't support this method, it returns
309
+ # `google.rpc.Code.UNIMPLEMENTED`.
310
+ #
311
+ # @overload delete_operation(request, options = nil)
312
+ # Pass arguments to `delete_operation` via a request object, either of type
313
+ # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
314
+ #
315
+ # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
316
+ # A request object representing the call parameters. Required. To specify no
317
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
318
+ # @param options [::Gapic::CallOptions, ::Hash]
319
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
320
+ #
321
+ # @overload delete_operation(name: nil)
322
+ # Pass arguments to `delete_operation` via keyword arguments. Note that at
323
+ # least one keyword argument is required. To specify no parameters, or to keep all
324
+ # the default parameter values, pass an empty Hash as a request object (see above).
325
+ #
326
+ # @param name [::String]
327
+ # The name of the operation resource to be deleted.
328
+ # @yield [result, operation] Access the result along with the TransportOperation object
329
+ # @yieldparam result [::Google::Protobuf::Empty]
330
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
331
+ #
332
+ # @return [::Google::Protobuf::Empty]
333
+ #
334
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
335
+ #
336
+ # @example Basic example
337
+ # require "google/longrunning"
338
+ #
339
+ # # Create a client object. The client can be reused for multiple calls.
340
+ # client = Google::Longrunning::Operations::Rest::Client.new
341
+ #
342
+ # # Create a request. To set request fields, pass in keyword arguments.
343
+ # request = Google::Longrunning::DeleteOperationRequest.new
344
+ #
345
+ # # Call the delete_operation method.
346
+ # result = client.delete_operation request
347
+ #
348
+ # # The returned object is of type Google::Protobuf::Empty.
349
+ # p result
350
+ #
351
+ def delete_operation request, options = nil
352
+ raise ::ArgumentError, "request must be provided" if request.nil?
353
+
354
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
355
+
356
+ # Converts hash and nil to an options object
357
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
358
+
359
+ # Customize the options with defaults
360
+ call_metadata = @config.rpcs.delete_operation.metadata.to_h
361
+
362
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
363
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
364
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
365
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
366
+ transports_version_send: [:rest]
367
+
368
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
369
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
370
+
371
+ options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
372
+ metadata: call_metadata,
373
+ retry_policy: @config.rpcs.delete_operation.retry_policy
374
+
375
+ options.apply_defaults timeout: @config.timeout,
376
+ metadata: @config.metadata,
377
+ retry_policy: @config.retry_policy
378
+
379
+ @operations_stub.delete_operation request, options do |result, operation|
380
+ yield result, operation if block_given?
381
+ end
382
+ rescue ::Gapic::Rest::Error => e
383
+ raise ::Google::Cloud::Error.from_error(e)
384
+ end
385
+
386
+ ##
387
+ # Starts asynchronous cancellation on a long-running operation. The server
388
+ # makes a best effort to cancel the operation, but success is not
389
+ # guaranteed. If the server doesn't support this method, it returns
390
+ # `google.rpc.Code.UNIMPLEMENTED`. Clients can use
391
+ # Operations.GetOperation or
392
+ # other methods to check whether the cancellation succeeded or whether the
393
+ # operation completed despite cancellation. On successful cancellation,
394
+ # the operation is not deleted; instead, it becomes an operation with
395
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
396
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
397
+ # `Code.CANCELLED`.
398
+ #
399
+ # @overload cancel_operation(request, options = nil)
400
+ # Pass arguments to `cancel_operation` via a request object, either of type
401
+ # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
402
+ #
403
+ # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
404
+ # A request object representing the call parameters. Required. To specify no
405
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
406
+ # @param options [::Gapic::CallOptions, ::Hash]
407
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
408
+ #
409
+ # @overload cancel_operation(name: nil)
410
+ # Pass arguments to `cancel_operation` via keyword arguments. Note that at
411
+ # least one keyword argument is required. To specify no parameters, or to keep all
412
+ # the default parameter values, pass an empty Hash as a request object (see above).
413
+ #
414
+ # @param name [::String]
415
+ # The name of the operation resource to be cancelled.
416
+ # @yield [result, operation] Access the result along with the TransportOperation object
417
+ # @yieldparam result [::Google::Protobuf::Empty]
418
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
419
+ #
420
+ # @return [::Google::Protobuf::Empty]
421
+ #
422
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
423
+ #
424
+ # @example Basic example
425
+ # require "google/longrunning"
426
+ #
427
+ # # Create a client object. The client can be reused for multiple calls.
428
+ # client = Google::Longrunning::Operations::Rest::Client.new
429
+ #
430
+ # # Create a request. To set request fields, pass in keyword arguments.
431
+ # request = Google::Longrunning::CancelOperationRequest.new
432
+ #
433
+ # # Call the cancel_operation method.
434
+ # result = client.cancel_operation request
435
+ #
436
+ # # The returned object is of type Google::Protobuf::Empty.
437
+ # p result
438
+ #
439
+ def cancel_operation request, options = nil
440
+ raise ::ArgumentError, "request must be provided" if request.nil?
441
+
442
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
443
+
444
+ # Converts hash and nil to an options object
445
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
446
+
447
+ # Customize the options with defaults
448
+ call_metadata = @config.rpcs.cancel_operation.metadata.to_h
449
+
450
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
451
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
452
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
453
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
454
+ transports_version_send: [:rest]
455
+
456
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
457
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
458
+
459
+ options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
460
+ metadata: call_metadata,
461
+ retry_policy: @config.rpcs.cancel_operation.retry_policy
462
+
463
+ options.apply_defaults timeout: @config.timeout,
464
+ metadata: @config.metadata,
465
+ retry_policy: @config.retry_policy
466
+
467
+ @operations_stub.cancel_operation request, options do |result, operation|
468
+ yield result, operation if block_given?
469
+ end
470
+ rescue ::Gapic::Rest::Error => e
471
+ raise ::Google::Cloud::Error.from_error(e)
472
+ end
473
+
474
+ ##
475
+ # Waits until the specified long-running operation is done or reaches at most
476
+ # a specified timeout, returning the latest state. If the operation is
477
+ # already done, the latest state is immediately returned. If the timeout
478
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
479
+ # timeout is used. If the server does not support this method, it returns
480
+ # `google.rpc.Code.UNIMPLEMENTED`.
481
+ # Note that this method is on a best-effort basis. It may return the latest
482
+ # state before the specified timeout (including immediately), meaning even an
483
+ # immediate response is no guarantee that the operation is done.
484
+ #
485
+ # @overload wait_operation(request, options = nil)
486
+ # Pass arguments to `wait_operation` via a request object, either of type
487
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
488
+ #
489
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
490
+ # A request object representing the call parameters. Required. To specify no
491
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
492
+ # @param options [::Gapic::CallOptions, ::Hash]
493
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
494
+ #
495
+ # @overload wait_operation(name: nil, timeout: nil)
496
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
497
+ # least one keyword argument is required. To specify no parameters, or to keep all
498
+ # the default parameter values, pass an empty Hash as a request object (see above).
499
+ #
500
+ # @param name [::String]
501
+ # The name of the operation resource to wait on.
502
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
503
+ # The maximum duration to wait before timing out. If left blank, the wait
504
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
505
+ # If RPC context deadline is also specified, the shorter one will be used.
506
+ # @yield [result, operation] Access the result along with the TransportOperation object
507
+ # @yieldparam result [::Gapic::Operation]
508
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
509
+ #
510
+ # @return [::Gapic::Operation]
511
+ #
512
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
513
+ #
514
+ # @example Basic example
515
+ # require "google/longrunning"
516
+ #
517
+ # # Create a client object. The client can be reused for multiple calls.
518
+ # client = Google::Longrunning::Operations::Rest::Client.new
519
+ #
520
+ # # Create a request. To set request fields, pass in keyword arguments.
521
+ # request = Google::Longrunning::WaitOperationRequest.new
522
+ #
523
+ # # Call the wait_operation method.
524
+ # result = client.wait_operation request
525
+ #
526
+ # # The returned object is of type Gapic::Operation. You can use it to
527
+ # # check the status of an operation, cancel it, or wait for results.
528
+ # # Here is how to wait for a response.
529
+ # result.wait_until_done! timeout: 60
530
+ # if result.response?
531
+ # p result.response
532
+ # else
533
+ # puts "No response received."
534
+ # end
535
+ #
536
+ def wait_operation request, options = nil
537
+ raise ::ArgumentError, "request must be provided" if request.nil?
538
+
539
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
540
+
541
+ # Converts hash and nil to an options object
542
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
543
+
544
+ # Customize the options with defaults
545
+ call_metadata = @config.rpcs.wait_operation.metadata.to_h
546
+
547
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
548
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
549
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
550
+ gapic_version: ::Google::Cloud::Run::V2::VERSION,
551
+ transports_version_send: [:rest]
552
+
553
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
554
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
555
+
556
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
557
+ metadata: call_metadata,
558
+ retry_policy: @config.rpcs.wait_operation.retry_policy
559
+
560
+ options.apply_defaults timeout: @config.timeout,
561
+ metadata: @config.metadata,
562
+ retry_policy: @config.retry_policy
563
+
564
+ @operations_stub.wait_operation request, options do |result, operation|
565
+ result = ::Gapic::Operation.new result, @operations_client, options: options
566
+ yield result, operation if block_given?
567
+ throw :response, result
568
+ end
569
+ rescue ::Gapic::Rest::Error => e
570
+ raise ::Google::Cloud::Error.from_error(e)
571
+ end
572
+
573
+ ##
574
+ # Configuration class for the Operations REST API.
575
+ #
576
+ # This class represents the configuration for Operations REST,
577
+ # providing control over timeouts, retry behavior, logging, transport
578
+ # parameters, and other low-level controls. Certain parameters can also be
579
+ # applied individually to specific RPCs. See
580
+ # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs}
581
+ # for a list of RPCs that can be configured independently.
582
+ #
583
+ # Configuration can be applied globally to all clients, or to a single client
584
+ # on construction.
585
+ #
586
+ # @example
587
+ #
588
+ # # Modify the global config, setting the timeout for
589
+ # # list_operations to 20 seconds,
590
+ # # and all remaining timeouts to 10 seconds.
591
+ # ::Google::Longrunning::Operations::Rest::Client.configure do |config|
592
+ # config.timeout = 10.0
593
+ # config.rpcs.list_operations.timeout = 20.0
594
+ # end
595
+ #
596
+ # # Apply the above configuration only to a new client.
597
+ # client = ::Google::Longrunning::Operations::Rest::Client.new do |config|
598
+ # config.timeout = 10.0
599
+ # config.rpcs.list_operations.timeout = 20.0
600
+ # end
601
+ #
602
+ # @!attribute [rw] endpoint
603
+ # A custom service endpoint, as a hostname or hostname:port. The default is
604
+ # nil, indicating to use the default endpoint in the current universe domain.
605
+ # @return [::String,nil]
606
+ # @!attribute [rw] credentials
607
+ # Credentials to send with calls. You may provide any of the following types:
608
+ # * (`String`) The path to a service account key file in JSON format
609
+ # * (`Hash`) A service account key as a Hash
610
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
611
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
612
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
613
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
614
+ # * (`nil`) indicating no credentials
615
+ #
616
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
617
+ # external source for authentication to Google Cloud, you must validate it before
618
+ # providing it to a Google API client library. Providing an unvalidated credential
619
+ # configuration to Google APIs can compromise the security of your systems and data.
620
+ # For more information, refer to [Validate credential configurations from external
621
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
622
+ # @return [::Object]
623
+ # @!attribute [rw] scope
624
+ # The OAuth scopes
625
+ # @return [::Array<::String>]
626
+ # @!attribute [rw] lib_name
627
+ # The library name as recorded in instrumentation and logging
628
+ # @return [::String]
629
+ # @!attribute [rw] lib_version
630
+ # The library version as recorded in instrumentation and logging
631
+ # @return [::String]
632
+ # @!attribute [rw] timeout
633
+ # The call timeout in seconds.
634
+ # @return [::Numeric]
635
+ # @!attribute [rw] metadata
636
+ # Additional headers to be sent with the call.
637
+ # @return [::Hash{::Symbol=>::String}]
638
+ # @!attribute [rw] retry_policy
639
+ # The retry policy. The value is a hash with the following keys:
640
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
641
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
642
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
643
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
644
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
645
+ # trigger a retry.
646
+ # @return [::Hash]
647
+ # @!attribute [rw] quota_project
648
+ # A separate project against which to charge quota.
649
+ # @return [::String]
650
+ # @!attribute [rw] universe_domain
651
+ # The universe domain within which to make requests. This determines the
652
+ # default endpoint URL. The default value of nil uses the environment
653
+ # universe (usually the default "googleapis.com" universe).
654
+ # @return [::String,nil]
655
+ # @!attribute [rw] logger
656
+ # A custom logger to use for request/response debug logging, or the value
657
+ # `:default` (the default) to construct a default logger, or `nil` to
658
+ # explicitly disable logging.
659
+ # @return [::Logger,:default,nil]
660
+ #
661
+ class Configuration
662
+ extend ::Gapic::Config
663
+
664
+ # @private
665
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
666
+ DEFAULT_ENDPOINT = "run.googleapis.com"
667
+
668
+ config_attr :endpoint, nil, ::String, nil
669
+ config_attr :credentials, nil do |value|
670
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
671
+ allowed.any? { |klass| klass === value }
672
+ end
673
+ config_attr :scope, nil, ::String, ::Array, nil
674
+ config_attr :lib_name, nil, ::String, nil
675
+ config_attr :lib_version, nil, ::String, nil
676
+ config_attr :timeout, nil, ::Numeric, nil
677
+ config_attr :metadata, nil, ::Hash, nil
678
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
679
+ config_attr :quota_project, nil, ::String, nil
680
+ config_attr :universe_domain, nil, ::String, nil
681
+ config_attr :logger, :default, ::Logger, nil, :default
682
+
683
+ # @private
684
+ def initialize parent_config = nil
685
+ @parent_config = parent_config unless parent_config.nil?
686
+
687
+ yield self if block_given?
688
+ end
689
+
690
+ ##
691
+ # Configurations for individual RPCs
692
+ # @return [Rpcs]
693
+ #
694
+ def rpcs
695
+ @rpcs ||= begin
696
+ parent_rpcs = nil
697
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
698
+ Rpcs.new parent_rpcs
699
+ end
700
+ end
701
+
702
+ ##
703
+ # Configuration RPC class for the Operations API.
704
+ #
705
+ # Includes fields providing the configuration for each RPC in this service.
706
+ # Each configuration object is of type `Gapic::Config::Method` and includes
707
+ # the following configuration fields:
708
+ #
709
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
710
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
711
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
712
+ # include the following keys:
713
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
714
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
715
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
716
+ # * `:jitter` (*type:* `Numeric`) - The jitter in seconds. Default: 1.0.
717
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
718
+ # trigger a retry.
719
+ #
720
+ class Rpcs
721
+ ##
722
+ # RPC-specific configuration for `list_operations`
723
+ # @return [::Gapic::Config::Method]
724
+ #
725
+ attr_reader :list_operations
726
+ ##
727
+ # RPC-specific configuration for `get_operation`
728
+ # @return [::Gapic::Config::Method]
729
+ #
730
+ attr_reader :get_operation
731
+ ##
732
+ # RPC-specific configuration for `delete_operation`
733
+ # @return [::Gapic::Config::Method]
734
+ #
735
+ attr_reader :delete_operation
736
+ ##
737
+ # RPC-specific configuration for `cancel_operation`
738
+ # @return [::Gapic::Config::Method]
739
+ #
740
+ attr_reader :cancel_operation
741
+ ##
742
+ # RPC-specific configuration for `wait_operation`
743
+ # @return [::Gapic::Config::Method]
744
+ #
745
+ attr_reader :wait_operation
746
+
747
+ # @private
748
+ def initialize parent_rpcs = nil
749
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
750
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
751
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
752
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
753
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
754
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
755
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
756
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
757
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
758
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
759
+
760
+ yield self if block_given?
761
+ end
762
+ end
763
+ end
764
+ end
765
+
766
+ ##
767
+ # @private
768
+ # REST service stub for the Longrunning Operations API.
769
+ # Service stub contains baseline method implementations
770
+ # including transcoding, making the REST call, and deserialing the response.
771
+ class OperationsServiceStub
772
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
773
+ # These require statements are intentionally placed here to initialize
774
+ # the REST modules only when it's required.
775
+ require "gapic/rest"
776
+
777
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
778
+ endpoint_template: endpoint_template,
779
+ universe_domain: universe_domain,
780
+ credentials: credentials
781
+ end
782
+
783
+ ##
784
+ # Baseline implementation for the list_operations REST call
785
+ #
786
+ # @param request_pb [::Google::Longrunning::ListOperationsRequest]
787
+ # A request object representing the call parameters. Required.
788
+ # @param options [::Gapic::CallOptions]
789
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
790
+ #
791
+ # @yield [result, operation] Access the result along with the TransportOperation object
792
+ # @yieldparam result [::Google::Longrunning::ListOperationsResponse]
793
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
794
+ #
795
+ # @return [::Google::Longrunning::ListOperationsResponse]
796
+ # A result object deserialized from the server's reply
797
+ def list_operations request_pb, options = nil
798
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
799
+
800
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb
801
+ query_string_params = if query_string_params.any?
802
+ query_string_params.to_h { |p| p.split "=", 2 }
803
+ else
804
+ {}
805
+ end
806
+
807
+ response = @client_stub.make_http_request(
808
+ verb,
809
+ uri: uri,
810
+ body: body || "",
811
+ params: query_string_params,
812
+ method_name: "list_operations",
813
+ options: options
814
+ )
815
+ operation = ::Gapic::Rest::TransportOperation.new response
816
+ result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
817
+ catch :response do
818
+ yield result, operation if block_given?
819
+ result
820
+ end
821
+ end
822
+
823
+ ##
824
+ # Baseline implementation for the get_operation REST call
825
+ #
826
+ # @param request_pb [::Google::Longrunning::GetOperationRequest]
827
+ # A request object representing the call parameters. Required.
828
+ # @param options [::Gapic::CallOptions]
829
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
830
+ #
831
+ # @yield [result, operation] Access the result along with the TransportOperation object
832
+ # @yieldparam result [::Google::Longrunning::Operation]
833
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
834
+ #
835
+ # @return [::Google::Longrunning::Operation]
836
+ # A result object deserialized from the server's reply
837
+ def get_operation request_pb, options = nil
838
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
839
+
840
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb
841
+ query_string_params = if query_string_params.any?
842
+ query_string_params.to_h { |p| p.split "=", 2 }
843
+ else
844
+ {}
845
+ end
846
+
847
+ response = @client_stub.make_http_request(
848
+ verb,
849
+ uri: uri,
850
+ body: body || "",
851
+ params: query_string_params,
852
+ method_name: "get_operation",
853
+ options: options
854
+ )
855
+ operation = ::Gapic::Rest::TransportOperation.new response
856
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
857
+ catch :response do
858
+ yield result, operation if block_given?
859
+ result
860
+ end
861
+ end
862
+
863
+ ##
864
+ # Baseline implementation for the delete_operation REST call
865
+ #
866
+ # @param request_pb [::Google::Longrunning::DeleteOperationRequest]
867
+ # A request object representing the call parameters. Required.
868
+ # @param options [::Gapic::CallOptions]
869
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
870
+ #
871
+ # @yield [result, operation] Access the result along with the TransportOperation object
872
+ # @yieldparam result [::Google::Protobuf::Empty]
873
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
874
+ #
875
+ # @return [::Google::Protobuf::Empty]
876
+ # A result object deserialized from the server's reply
877
+ def delete_operation request_pb, options = nil
878
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
879
+
880
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb
881
+ query_string_params = if query_string_params.any?
882
+ query_string_params.to_h { |p| p.split "=", 2 }
883
+ else
884
+ {}
885
+ end
886
+
887
+ response = @client_stub.make_http_request(
888
+ verb,
889
+ uri: uri,
890
+ body: body || "",
891
+ params: query_string_params,
892
+ method_name: "delete_operation",
893
+ options: options
894
+ )
895
+ operation = ::Gapic::Rest::TransportOperation.new response
896
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
897
+ catch :response do
898
+ yield result, operation if block_given?
899
+ result
900
+ end
901
+ end
902
+
903
+ ##
904
+ # Baseline implementation for the cancel_operation REST call
905
+ #
906
+ # @param request_pb [::Google::Longrunning::CancelOperationRequest]
907
+ # A request object representing the call parameters. Required.
908
+ # @param options [::Gapic::CallOptions]
909
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
910
+ #
911
+ # @yield [result, operation] Access the result along with the TransportOperation object
912
+ # @yieldparam result [::Google::Protobuf::Empty]
913
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
914
+ #
915
+ # @return [::Google::Protobuf::Empty]
916
+ # A result object deserialized from the server's reply
917
+ def cancel_operation request_pb, options = nil
918
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
919
+
920
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb
921
+ query_string_params = if query_string_params.any?
922
+ query_string_params.to_h { |p| p.split "=", 2 }
923
+ else
924
+ {}
925
+ end
926
+
927
+ response = @client_stub.make_http_request(
928
+ verb,
929
+ uri: uri,
930
+ body: body || "",
931
+ params: query_string_params,
932
+ method_name: "cancel_operation",
933
+ options: options
934
+ )
935
+ operation = ::Gapic::Rest::TransportOperation.new response
936
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
937
+ catch :response do
938
+ yield result, operation if block_given?
939
+ result
940
+ end
941
+ end
942
+
943
+ ##
944
+ # Baseline implementation for the wait_operation REST call
945
+ #
946
+ # @param request_pb [::Google::Longrunning::WaitOperationRequest]
947
+ # A request object representing the call parameters. Required.
948
+ # @param options [::Gapic::CallOptions]
949
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
950
+ #
951
+ # @yield [result, operation] Access the result along with the TransportOperation object
952
+ # @yieldparam result [::Google::Longrunning::Operation]
953
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
954
+ #
955
+ # @return [::Google::Longrunning::Operation]
956
+ # A result object deserialized from the server's reply
957
+ def wait_operation request_pb, options = nil
958
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
959
+
960
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_wait_operation_request request_pb
961
+ query_string_params = if query_string_params.any?
962
+ query_string_params.to_h { |p| p.split "=", 2 }
963
+ else
964
+ {}
965
+ end
966
+
967
+ response = @client_stub.make_http_request(
968
+ verb,
969
+ uri: uri,
970
+ body: body || "",
971
+ params: query_string_params,
972
+ method_name: "wait_operation",
973
+ options: options
974
+ )
975
+ operation = ::Gapic::Rest::TransportOperation.new response
976
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
977
+ catch :response do
978
+ yield result, operation if block_given?
979
+ result
980
+ end
981
+ end
982
+
983
+ ##
984
+ # @private
985
+ #
986
+ # GRPC transcoding helper method for the list_operations REST call
987
+ #
988
+ # @param request_pb [::Google::Longrunning::ListOperationsRequest]
989
+ # A request object representing the call parameters. Required.
990
+ # @return [Array(String, [String, nil], Hash{String => String})]
991
+ # Uri, Body, Query string parameters
992
+ def self.transcode_list_operations_request request_pb
993
+ transcoder = Gapic::Rest::GrpcTranscoder.new
994
+ .with_bindings(
995
+ uri_method: :get,
996
+ uri_template: "/v2/{name}/operations",
997
+ matches: [
998
+ ["name", %r{^projects/[^/]+/locations/[^/]+/?$}, false]
999
+ ]
1000
+ )
1001
+ transcoder.transcode request_pb
1002
+ end
1003
+
1004
+ ##
1005
+ # @private
1006
+ #
1007
+ # GRPC transcoding helper method for the get_operation REST call
1008
+ #
1009
+ # @param request_pb [::Google::Longrunning::GetOperationRequest]
1010
+ # A request object representing the call parameters. Required.
1011
+ # @return [Array(String, [String, nil], Hash{String => String})]
1012
+ # Uri, Body, Query string parameters
1013
+ def self.transcode_get_operation_request request_pb
1014
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1015
+ .with_bindings(
1016
+ uri_method: :get,
1017
+ uri_template: "/v2/{name}",
1018
+ matches: [
1019
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
1020
+ ]
1021
+ )
1022
+ transcoder.transcode request_pb
1023
+ end
1024
+
1025
+ ##
1026
+ # @private
1027
+ #
1028
+ # GRPC transcoding helper method for the delete_operation REST call
1029
+ #
1030
+ # @param request_pb [::Google::Longrunning::DeleteOperationRequest]
1031
+ # A request object representing the call parameters. Required.
1032
+ # @return [Array(String, [String, nil], Hash{String => String})]
1033
+ # Uri, Body, Query string parameters
1034
+ def self.transcode_delete_operation_request request_pb
1035
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1036
+ .with_bindings(
1037
+ uri_method: :delete,
1038
+ uri_template: "/v2/{name}",
1039
+ matches: [
1040
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
1041
+ ]
1042
+ )
1043
+ transcoder.transcode request_pb
1044
+ end
1045
+
1046
+ ##
1047
+ # @private
1048
+ #
1049
+ # GRPC transcoding helper method for the cancel_operation REST call
1050
+ #
1051
+ # @param request_pb [::Google::Longrunning::CancelOperationRequest]
1052
+ # A request object representing the call parameters. Required.
1053
+ # @return [Array(String, [String, nil], Hash{String => String})]
1054
+ # Uri, Body, Query string parameters
1055
+ def self.transcode_cancel_operation_request request_pb
1056
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1057
+ .with_bindings(
1058
+ uri_method: :post,
1059
+ uri_template: "/v1/{name}:cancel",
1060
+ body: "*",
1061
+ matches: [
1062
+ ["name", %r{^operations(?:/.*)?$}, true]
1063
+ ]
1064
+ )
1065
+ transcoder.transcode request_pb
1066
+ end
1067
+
1068
+ ##
1069
+ # @private
1070
+ #
1071
+ # GRPC transcoding helper method for the wait_operation REST call
1072
+ #
1073
+ # @param request_pb [::Google::Longrunning::WaitOperationRequest]
1074
+ # A request object representing the call parameters. Required.
1075
+ # @return [Array(String, [String, nil], Hash{String => String})]
1076
+ # Uri, Body, Query string parameters
1077
+ def self.transcode_wait_operation_request request_pb
1078
+ transcoder = Gapic::Rest::GrpcTranscoder.new
1079
+ .with_bindings(
1080
+ uri_method: :post,
1081
+ uri_template: "/v2/{name}:wait",
1082
+ body: "*",
1083
+ matches: [
1084
+ ["name", %r{^projects/[^/]+/locations/[^/]+/operations/[^/]+/?$}, false]
1085
+ ]
1086
+ )
1087
+ transcoder.transcode request_pb
1088
+ end
1089
+ end
1090
+ end
1091
+ end
1092
+ end
1093
+ end
1094
+ end
1095
+ end