google-cloud-orchestration-airflow-service-v1 0.1.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 (36) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +167 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +139 -0
  6. data/lib/google/cloud/orchestration/airflow/service/v1/environments/client.rb +818 -0
  7. data/lib/google/cloud/orchestration/airflow/service/v1/environments/credentials.rb +51 -0
  8. data/lib/google/cloud/orchestration/airflow/service/v1/environments/operations.rb +668 -0
  9. data/lib/google/cloud/orchestration/airflow/service/v1/environments/paths.rb +56 -0
  10. data/lib/google/cloud/orchestration/airflow/service/v1/environments.rb +54 -0
  11. data/lib/google/cloud/orchestration/airflow/service/v1/environments_pb.rb +173 -0
  12. data/lib/google/cloud/orchestration/airflow/service/v1/environments_services_pb.rb +57 -0
  13. data/lib/google/cloud/orchestration/airflow/service/v1/image_versions/client.rb +380 -0
  14. data/lib/google/cloud/orchestration/airflow/service/v1/image_versions/credentials.rb +51 -0
  15. data/lib/google/cloud/orchestration/airflow/service/v1/image_versions.rb +52 -0
  16. data/lib/google/cloud/orchestration/airflow/service/v1/image_versions_pb.rb +46 -0
  17. data/lib/google/cloud/orchestration/airflow/service/v1/image_versions_services_pb.rb +49 -0
  18. data/lib/google/cloud/orchestration/airflow/service/v1/operations_pb.rb +50 -0
  19. data/lib/google/cloud/orchestration/airflow/service/v1/version.rb +32 -0
  20. data/lib/google/cloud/orchestration/airflow/service/v1.rb +43 -0
  21. data/lib/google-cloud-orchestration-airflow-service-v1.rb +21 -0
  22. data/proto_docs/README.md +4 -0
  23. data/proto_docs/google/api/field_behavior.rb +71 -0
  24. data/proto_docs/google/api/resource.rb +283 -0
  25. data/proto_docs/google/cloud/orchestration/airflow/service/v1/environments.rb +762 -0
  26. data/proto_docs/google/cloud/orchestration/airflow/service/v1/image_versions.rb +88 -0
  27. data/proto_docs/google/cloud/orchestration/airflow/service/v1/operations.rb +94 -0
  28. data/proto_docs/google/longrunning/operations.rb +164 -0
  29. data/proto_docs/google/protobuf/any.rb +141 -0
  30. data/proto_docs/google/protobuf/duration.rb +98 -0
  31. data/proto_docs/google/protobuf/empty.rb +36 -0
  32. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  33. data/proto_docs/google/protobuf/timestamp.rb +129 -0
  34. data/proto_docs/google/rpc/status.rb +46 -0
  35. data/proto_docs/google/type/date.rb +53 -0
  36. metadata +228 -0
@@ -0,0 +1,668 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2021 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
+ require "google/longrunning/operations_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module Orchestration
25
+ module Airflow
26
+ module Service
27
+ module V1
28
+ module Environments
29
+ # Service that implements Longrunning Operations API.
30
+ class Operations
31
+ # @private
32
+ attr_reader :operations_stub
33
+
34
+ ##
35
+ # Configuration for the Environments Operations API.
36
+ #
37
+ # @yield [config] Configure the Operations client.
38
+ # @yieldparam config [Operations::Configuration]
39
+ #
40
+ # @return [Operations::Configuration]
41
+ #
42
+ def self.configure
43
+ @configure ||= Operations::Configuration.new
44
+ yield @configure if block_given?
45
+ @configure
46
+ end
47
+
48
+ ##
49
+ # Configure the Environments Operations instance.
50
+ #
51
+ # The configuration is set to the derived mode, meaning that values can be changed,
52
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
53
+ # should be made on {Operations.configure}.
54
+ #
55
+ # @yield [config] Configure the Operations client.
56
+ # @yieldparam config [Operations::Configuration]
57
+ #
58
+ # @return [Operations::Configuration]
59
+ #
60
+ def configure
61
+ yield @config if block_given?
62
+ @config
63
+ end
64
+
65
+ ##
66
+ # Create a new Operations client object.
67
+ #
68
+ # @yield [config] Configure the Client client.
69
+ # @yieldparam config [Operations::Configuration]
70
+ #
71
+ def initialize
72
+ # These require statements are intentionally placed here to initialize
73
+ # the gRPC module only when it's required.
74
+ # See https://github.com/googleapis/toolkit/issues/446
75
+ require "gapic/grpc"
76
+ require "google/longrunning/operations_services_pb"
77
+
78
+ # Create the configuration object
79
+ @config = Configuration.new Operations.configure
80
+
81
+ # Yield the configuration if needed
82
+ yield @config if block_given?
83
+
84
+ # Create credentials
85
+ credentials = @config.credentials
86
+ credentials ||= Credentials.default scope: @config.scope
87
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
88
+ credentials = Credentials.new credentials, scope: @config.scope
89
+ end
90
+ @quota_project_id = @config.quota_project
91
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
92
+
93
+ @operations_stub = ::Gapic::ServiceStub.new(
94
+ ::Google::Longrunning::Operations::Stub,
95
+ credentials: credentials,
96
+ endpoint: @config.endpoint,
97
+ channel_args: @config.channel_args,
98
+ interceptors: @config.interceptors
99
+ )
100
+ end
101
+
102
+ # Service calls
103
+
104
+ ##
105
+ # Lists operations that match the specified filter in the request. If the
106
+ # server doesn't support this method, it returns `UNIMPLEMENTED`.
107
+ #
108
+ # NOTE: the `name` binding allows API services to override the binding
109
+ # to use different resource name schemes, such as `users/*/operations`. To
110
+ # override the binding, API services can add a binding such as
111
+ # `"/v1/{name=users/*}/operations"` to their service configuration.
112
+ # For backwards compatibility, the default name includes the operations
113
+ # collection id, however overriding users must ensure the name binding
114
+ # is the parent resource, without the operations collection id.
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)
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
+ #
140
+ # @yield [response, operation] Access the result along with the RPC operation
141
+ # @yieldparam response [::Gapic::PagedEnumerable<::Gapic::Operation>]
142
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
143
+ #
144
+ # @return [::Gapic::PagedEnumerable<::Gapic::Operation>]
145
+ #
146
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
147
+ #
148
+ def list_operations request, options = nil
149
+ raise ::ArgumentError, "request must be provided" if request.nil?
150
+
151
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
152
+
153
+ # Converts hash and nil to an options object
154
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
155
+
156
+ # Customize the options with defaults
157
+ metadata = @config.rpcs.list_operations.metadata.to_h
158
+
159
+ # Set x-goog-api-client and x-goog-user-project headers
160
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
161
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
162
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION
163
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
164
+
165
+ header_params = {
166
+ "name" => request.name
167
+ }
168
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
169
+ metadata[:"x-goog-request-params"] ||= request_params_header
170
+
171
+ options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
172
+ metadata: metadata,
173
+ retry_policy: @config.rpcs.list_operations.retry_policy
174
+
175
+ options.apply_defaults timeout: @config.timeout,
176
+ metadata: @config.metadata,
177
+ retry_policy: @config.retry_policy
178
+
179
+ @operations_stub.call_rpc :list_operations, request, options: options do |response, operation|
180
+ wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
181
+ response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
182
+ yield response, operation if block_given?
183
+ return response
184
+ end
185
+ rescue ::GRPC::BadStatus => e
186
+ raise ::Google::Cloud::Error.from_error(e)
187
+ end
188
+
189
+ ##
190
+ # Gets the latest state of a long-running operation. Clients can use this
191
+ # method to poll the operation result at intervals as recommended by the API
192
+ # service.
193
+ #
194
+ # @overload get_operation(request, options = nil)
195
+ # Pass arguments to `get_operation` via a request object, either of type
196
+ # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
197
+ #
198
+ # @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
199
+ # A request object representing the call parameters. Required. To specify no
200
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
201
+ # @param options [::Gapic::CallOptions, ::Hash]
202
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
203
+ #
204
+ # @overload get_operation(name: nil)
205
+ # Pass arguments to `get_operation` via keyword arguments. Note that at
206
+ # least one keyword argument is required. To specify no parameters, or to keep all
207
+ # the default parameter values, pass an empty Hash as a request object (see above).
208
+ #
209
+ # @param name [::String]
210
+ # The name of the operation resource.
211
+ #
212
+ # @yield [response, operation] Access the result along with the RPC operation
213
+ # @yieldparam response [::Gapic::Operation]
214
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
215
+ #
216
+ # @return [::Gapic::Operation]
217
+ #
218
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
219
+ #
220
+ def get_operation request, options = nil
221
+ raise ::ArgumentError, "request must be provided" if request.nil?
222
+
223
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
224
+
225
+ # Converts hash and nil to an options object
226
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
227
+
228
+ # Customize the options with defaults
229
+ metadata = @config.rpcs.get_operation.metadata.to_h
230
+
231
+ # Set x-goog-api-client and x-goog-user-project headers
232
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
233
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
234
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION
235
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
236
+
237
+ header_params = {
238
+ "name" => request.name
239
+ }
240
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
241
+ metadata[:"x-goog-request-params"] ||= request_params_header
242
+
243
+ options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
244
+ metadata: metadata,
245
+ retry_policy: @config.rpcs.get_operation.retry_policy
246
+
247
+ options.apply_defaults timeout: @config.timeout,
248
+ metadata: @config.metadata,
249
+ retry_policy: @config.retry_policy
250
+
251
+ @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
252
+ response = ::Gapic::Operation.new response, @operations_client, options: options
253
+ yield response, operation if block_given?
254
+ return response
255
+ end
256
+ rescue ::GRPC::BadStatus => e
257
+ raise ::Google::Cloud::Error.from_error(e)
258
+ end
259
+
260
+ ##
261
+ # Deletes a long-running operation. This method indicates that the client is
262
+ # no longer interested in the operation result. It does not cancel the
263
+ # operation. If the server doesn't support this method, it returns
264
+ # `google.rpc.Code.UNIMPLEMENTED`.
265
+ #
266
+ # @overload delete_operation(request, options = nil)
267
+ # Pass arguments to `delete_operation` via a request object, either of type
268
+ # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
269
+ #
270
+ # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
271
+ # A request object representing the call parameters. Required. To specify no
272
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
273
+ # @param options [::Gapic::CallOptions, ::Hash]
274
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
275
+ #
276
+ # @overload delete_operation(name: nil)
277
+ # Pass arguments to `delete_operation` via keyword arguments. Note that at
278
+ # least one keyword argument is required. To specify no parameters, or to keep all
279
+ # the default parameter values, pass an empty Hash as a request object (see above).
280
+ #
281
+ # @param name [::String]
282
+ # The name of the operation resource to be deleted.
283
+ #
284
+ # @yield [response, operation] Access the result along with the RPC operation
285
+ # @yieldparam response [::Google::Protobuf::Empty]
286
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
287
+ #
288
+ # @return [::Google::Protobuf::Empty]
289
+ #
290
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
291
+ #
292
+ def delete_operation request, options = nil
293
+ raise ::ArgumentError, "request must be provided" if request.nil?
294
+
295
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
296
+
297
+ # Converts hash and nil to an options object
298
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
299
+
300
+ # Customize the options with defaults
301
+ metadata = @config.rpcs.delete_operation.metadata.to_h
302
+
303
+ # Set x-goog-api-client and x-goog-user-project headers
304
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
305
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
306
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION
307
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
308
+
309
+ header_params = {
310
+ "name" => request.name
311
+ }
312
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
313
+ metadata[:"x-goog-request-params"] ||= request_params_header
314
+
315
+ options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
316
+ metadata: metadata,
317
+ retry_policy: @config.rpcs.delete_operation.retry_policy
318
+
319
+ options.apply_defaults timeout: @config.timeout,
320
+ metadata: @config.metadata,
321
+ retry_policy: @config.retry_policy
322
+
323
+ @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
324
+ yield response, operation if block_given?
325
+ return response
326
+ end
327
+ rescue ::GRPC::BadStatus => e
328
+ raise ::Google::Cloud::Error.from_error(e)
329
+ end
330
+
331
+ ##
332
+ # Starts asynchronous cancellation on a long-running operation. The server
333
+ # makes a best effort to cancel the operation, but success is not
334
+ # guaranteed. If the server doesn't support this method, it returns
335
+ # `google.rpc.Code.UNIMPLEMENTED`. Clients can use
336
+ # Operations.GetOperation or
337
+ # other methods to check whether the cancellation succeeded or whether the
338
+ # operation completed despite cancellation. On successful cancellation,
339
+ # the operation is not deleted; instead, it becomes an operation with
340
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
341
+ # corresponding to `Code.CANCELLED`.
342
+ #
343
+ # @overload cancel_operation(request, options = nil)
344
+ # Pass arguments to `cancel_operation` via a request object, either of type
345
+ # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
346
+ #
347
+ # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
348
+ # A request object representing the call parameters. Required. To specify no
349
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
350
+ # @param options [::Gapic::CallOptions, ::Hash]
351
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
352
+ #
353
+ # @overload cancel_operation(name: nil)
354
+ # Pass arguments to `cancel_operation` via keyword arguments. Note that at
355
+ # least one keyword argument is required. To specify no parameters, or to keep all
356
+ # the default parameter values, pass an empty Hash as a request object (see above).
357
+ #
358
+ # @param name [::String]
359
+ # The name of the operation resource to be cancelled.
360
+ #
361
+ # @yield [response, operation] Access the result along with the RPC operation
362
+ # @yieldparam response [::Google::Protobuf::Empty]
363
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
364
+ #
365
+ # @return [::Google::Protobuf::Empty]
366
+ #
367
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
368
+ #
369
+ def cancel_operation request, options = nil
370
+ raise ::ArgumentError, "request must be provided" if request.nil?
371
+
372
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
373
+
374
+ # Converts hash and nil to an options object
375
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
376
+
377
+ # Customize the options with defaults
378
+ metadata = @config.rpcs.cancel_operation.metadata.to_h
379
+
380
+ # Set x-goog-api-client and x-goog-user-project headers
381
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
382
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
383
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION
384
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
385
+
386
+ header_params = {
387
+ "name" => request.name
388
+ }
389
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
390
+ metadata[:"x-goog-request-params"] ||= request_params_header
391
+
392
+ options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
393
+ metadata: metadata,
394
+ retry_policy: @config.rpcs.cancel_operation.retry_policy
395
+
396
+ options.apply_defaults timeout: @config.timeout,
397
+ metadata: @config.metadata,
398
+ retry_policy: @config.retry_policy
399
+
400
+ @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
401
+ yield response, operation if block_given?
402
+ return response
403
+ end
404
+ rescue ::GRPC::BadStatus => e
405
+ raise ::Google::Cloud::Error.from_error(e)
406
+ end
407
+
408
+ ##
409
+ # Waits until the specified long-running operation is done or reaches at most
410
+ # a specified timeout, returning the latest state. If the operation is
411
+ # already done, the latest state is immediately returned. If the timeout
412
+ # specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
413
+ # timeout is used. If the server does not support this method, it returns
414
+ # `google.rpc.Code.UNIMPLEMENTED`.
415
+ # Note that this method is on a best-effort basis. It may return the latest
416
+ # state before the specified timeout (including immediately), meaning even an
417
+ # immediate response is no guarantee that the operation is done.
418
+ #
419
+ # @overload wait_operation(request, options = nil)
420
+ # Pass arguments to `wait_operation` via a request object, either of type
421
+ # {::Google::Longrunning::WaitOperationRequest} or an equivalent Hash.
422
+ #
423
+ # @param request [::Google::Longrunning::WaitOperationRequest, ::Hash]
424
+ # A request object representing the call parameters. Required. To specify no
425
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
426
+ # @param options [::Gapic::CallOptions, ::Hash]
427
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
428
+ #
429
+ # @overload wait_operation(name: nil, timeout: nil)
430
+ # Pass arguments to `wait_operation` via keyword arguments. Note that at
431
+ # least one keyword argument is required. To specify no parameters, or to keep all
432
+ # the default parameter values, pass an empty Hash as a request object (see above).
433
+ #
434
+ # @param name [::String]
435
+ # The name of the operation resource to wait on.
436
+ # @param timeout [::Google::Protobuf::Duration, ::Hash]
437
+ # The maximum duration to wait before timing out. If left blank, the wait
438
+ # will be at most the time permitted by the underlying HTTP/RPC protocol.
439
+ # If RPC context deadline is also specified, the shorter one will be used.
440
+ #
441
+ # @yield [response, operation] Access the result along with the RPC operation
442
+ # @yieldparam response [::Gapic::Operation]
443
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
444
+ #
445
+ # @return [::Gapic::Operation]
446
+ #
447
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
448
+ #
449
+ def wait_operation request, options = nil
450
+ raise ::ArgumentError, "request must be provided" if request.nil?
451
+
452
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::WaitOperationRequest
453
+
454
+ # Converts hash and nil to an options object
455
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
456
+
457
+ # Customize the options with defaults
458
+ metadata = @config.rpcs.wait_operation.metadata.to_h
459
+
460
+ # Set x-goog-api-client and x-goog-user-project headers
461
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
462
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
463
+ gapic_version: ::Google::Cloud::Orchestration::Airflow::Service::V1::VERSION
464
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
465
+
466
+ options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
467
+ metadata: metadata,
468
+ retry_policy: @config.rpcs.wait_operation.retry_policy
469
+
470
+ options.apply_defaults timeout: @config.timeout,
471
+ metadata: @config.metadata,
472
+ retry_policy: @config.retry_policy
473
+
474
+ @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
475
+ response = ::Gapic::Operation.new response, @operations_client, options: options
476
+ yield response, operation if block_given?
477
+ return response
478
+ end
479
+ rescue ::GRPC::BadStatus => e
480
+ raise ::Google::Cloud::Error.from_error(e)
481
+ end
482
+
483
+ ##
484
+ # Configuration class for the Operations API.
485
+ #
486
+ # This class represents the configuration for Operations,
487
+ # providing control over timeouts, retry behavior, logging, transport
488
+ # parameters, and other low-level controls. Certain parameters can also be
489
+ # applied individually to specific RPCs. See
490
+ # {::Google::Longrunning::Operations::Client::Configuration::Rpcs}
491
+ # for a list of RPCs that can be configured independently.
492
+ #
493
+ # Configuration can be applied globally to all clients, or to a single client
494
+ # on construction.
495
+ #
496
+ # @example
497
+ #
498
+ # # Modify the global config, setting the timeout for
499
+ # # list_operations to 20 seconds,
500
+ # # and all remaining timeouts to 10 seconds.
501
+ # ::Google::Longrunning::Operations::Client.configure do |config|
502
+ # config.timeout = 10.0
503
+ # config.rpcs.list_operations.timeout = 20.0
504
+ # end
505
+ #
506
+ # # Apply the above configuration only to a new client.
507
+ # client = ::Google::Longrunning::Operations::Client.new do |config|
508
+ # config.timeout = 10.0
509
+ # config.rpcs.list_operations.timeout = 20.0
510
+ # end
511
+ #
512
+ # @!attribute [rw] endpoint
513
+ # The hostname or hostname:port of the service endpoint.
514
+ # Defaults to `"composer.googleapis.com"`.
515
+ # @return [::String]
516
+ # @!attribute [rw] credentials
517
+ # Credentials to send with calls. You may provide any of the following types:
518
+ # * (`String`) The path to a service account key file in JSON format
519
+ # * (`Hash`) A service account key as a Hash
520
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
521
+ # (see the [googleauth docs](https://googleapis.dev/ruby/googleauth/latest/index.html))
522
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
523
+ # (see the [signet docs](https://googleapis.dev/ruby/signet/latest/Signet/OAuth2/Client.html))
524
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
525
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
526
+ # * (`nil`) indicating no credentials
527
+ # @return [::Object]
528
+ # @!attribute [rw] scope
529
+ # The OAuth scopes
530
+ # @return [::Array<::String>]
531
+ # @!attribute [rw] lib_name
532
+ # The library name as recorded in instrumentation and logging
533
+ # @return [::String]
534
+ # @!attribute [rw] lib_version
535
+ # The library version as recorded in instrumentation and logging
536
+ # @return [::String]
537
+ # @!attribute [rw] channel_args
538
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
539
+ # `GRPC::Core::Channel` object is provided as the credential.
540
+ # @return [::Hash]
541
+ # @!attribute [rw] interceptors
542
+ # An array of interceptors that are run before calls are executed.
543
+ # @return [::Array<::GRPC::ClientInterceptor>]
544
+ # @!attribute [rw] timeout
545
+ # The call timeout in seconds.
546
+ # @return [::Numeric]
547
+ # @!attribute [rw] metadata
548
+ # Additional gRPC headers to be sent with the call.
549
+ # @return [::Hash{::Symbol=>::String}]
550
+ # @!attribute [rw] retry_policy
551
+ # The retry policy. The value is a hash with the following keys:
552
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
553
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
554
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
555
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
556
+ # trigger a retry.
557
+ # @return [::Hash]
558
+ # @!attribute [rw] quota_project
559
+ # A separate project against which to charge quota.
560
+ # @return [::String]
561
+ #
562
+ class Configuration
563
+ extend ::Gapic::Config
564
+
565
+ config_attr :endpoint, "composer.googleapis.com", ::String
566
+ config_attr :credentials, nil do |value|
567
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
568
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
569
+ allowed.any? { |klass| klass === value }
570
+ end
571
+ config_attr :scope, nil, ::String, ::Array, nil
572
+ config_attr :lib_name, nil, ::String, nil
573
+ config_attr :lib_version, nil, ::String, nil
574
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
575
+ config_attr :interceptors, nil, ::Array, nil
576
+ config_attr :timeout, nil, ::Numeric, nil
577
+ config_attr :metadata, nil, ::Hash, nil
578
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
579
+ config_attr :quota_project, nil, ::String, nil
580
+
581
+ # @private
582
+ def initialize parent_config = nil
583
+ @parent_config = parent_config unless parent_config.nil?
584
+
585
+ yield self if block_given?
586
+ end
587
+
588
+ ##
589
+ # Configurations for individual RPCs
590
+ # @return [Rpcs]
591
+ #
592
+ def rpcs
593
+ @rpcs ||= begin
594
+ parent_rpcs = nil
595
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
596
+ Rpcs.new parent_rpcs
597
+ end
598
+ end
599
+
600
+ ##
601
+ # Configuration RPC class for the Operations API.
602
+ #
603
+ # Includes fields providing the configuration for each RPC in this service.
604
+ # Each configuration object is of type `Gapic::Config::Method` and includes
605
+ # the following configuration fields:
606
+ #
607
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
608
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
609
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
610
+ # include the following keys:
611
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
612
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
613
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
614
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
615
+ # trigger a retry.
616
+ #
617
+ class Rpcs
618
+ ##
619
+ # RPC-specific configuration for `list_operations`
620
+ # @return [::Gapic::Config::Method]
621
+ #
622
+ attr_reader :list_operations
623
+ ##
624
+ # RPC-specific configuration for `get_operation`
625
+ # @return [::Gapic::Config::Method]
626
+ #
627
+ attr_reader :get_operation
628
+ ##
629
+ # RPC-specific configuration for `delete_operation`
630
+ # @return [::Gapic::Config::Method]
631
+ #
632
+ attr_reader :delete_operation
633
+ ##
634
+ # RPC-specific configuration for `cancel_operation`
635
+ # @return [::Gapic::Config::Method]
636
+ #
637
+ attr_reader :cancel_operation
638
+ ##
639
+ # RPC-specific configuration for `wait_operation`
640
+ # @return [::Gapic::Config::Method]
641
+ #
642
+ attr_reader :wait_operation
643
+
644
+ # @private
645
+ def initialize parent_rpcs = nil
646
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
647
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
648
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
649
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
650
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
651
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
652
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
653
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
654
+ wait_operation_config = parent_rpcs.wait_operation if parent_rpcs.respond_to? :wait_operation
655
+ @wait_operation = ::Gapic::Config::Method.new wait_operation_config
656
+
657
+ yield self if block_given?
658
+ end
659
+ end
660
+ end
661
+ end
662
+ end
663
+ end
664
+ end
665
+ end
666
+ end
667
+ end
668
+ end