google-apps-events-subscriptions-v1 0.a → 0.1.0

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