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