google-cloud-beyond_corp-app_connections-v1 0.1.0

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