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