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