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,916 @@
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
+
21
+ module Google
22
+ module Apps
23
+ module Events
24
+ module Subscriptions
25
+ module V1beta
26
+ module SubscriptionsService
27
+ module Rest
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
+ # Create the configuration object
87
+ @config = Configuration.new Operations.configure
88
+
89
+ # Yield the configuration if needed
90
+ yield @config if block_given?
91
+
92
+ # Create credentials
93
+ credentials = @config.credentials
94
+ credentials ||= Credentials.default scope: @config.scope
95
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
96
+ credentials = Credentials.new credentials, scope: @config.scope
97
+ end
98
+
99
+ @quota_project_id = @config.quota_project
100
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
101
+
102
+ @operations_stub = OperationsServiceStub.new(
103
+ endpoint: @config.endpoint,
104
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
105
+ universe_domain: @config.universe_domain,
106
+ credentials: credentials
107
+ )
108
+
109
+ # Used by an LRO wrapper for some methods of this service
110
+ @operations_client = self
111
+ end
112
+
113
+ # Service calls
114
+
115
+ ##
116
+ # Lists operations that match the specified filter in the request. If the
117
+ # server doesn't support this method, it returns `UNIMPLEMENTED`.
118
+ #
119
+ # @overload list_operations(request, options = nil)
120
+ # Pass arguments to `list_operations` via a request object, either of type
121
+ # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
122
+ #
123
+ # @param request [::Google::Longrunning::ListOperationsRequest, ::Hash]
124
+ # A request object representing the call parameters. Required. To specify no
125
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
126
+ # @param options [::Gapic::CallOptions, ::Hash]
127
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
128
+ #
129
+ # @overload list_operations(name: nil, filter: nil, page_size: nil, page_token: nil)
130
+ # Pass arguments to `list_operations` via keyword arguments. Note that at
131
+ # least one keyword argument is required. To specify no parameters, or to keep all
132
+ # the default parameter values, pass an empty Hash as a request object (see above).
133
+ #
134
+ # @param name [::String]
135
+ # The name of the operation's parent resource.
136
+ # @param filter [::String]
137
+ # The standard list filter.
138
+ # @param page_size [::Integer]
139
+ # The standard list page size.
140
+ # @param page_token [::String]
141
+ # The standard list page token.
142
+ # @yield [result, operation] Access the result along with the TransportOperation object
143
+ # @yieldparam result [::Gapic::Operation]
144
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
145
+ #
146
+ # @return [::Gapic::Operation]
147
+ #
148
+ # @raise [::Google::Cloud::Error] if the REST call 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::Rest::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 iterate
163
+ # # over elements, and API calls will be issued to fetch pages as needed.
164
+ # result.each do |item|
165
+ # # Each element is of type ::Google::Longrunning::Operation.
166
+ # p item
167
+ # end
168
+ #
169
+ def list_operations request, options = nil
170
+ raise ::ArgumentError, "request must be provided" if request.nil?
171
+
172
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::ListOperationsRequest
173
+
174
+ # Converts hash and nil to an options object
175
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
176
+
177
+ # Customize the options with defaults
178
+ call_metadata = @config.rpcs.list_operations.metadata.to_h
179
+
180
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
181
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
182
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
183
+ gapic_version: ::Google::Apps::Events::Subscriptions::V1beta::VERSION,
184
+ transports_version_send: [:rest]
185
+
186
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
187
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
188
+
189
+ options.apply_defaults timeout: @config.rpcs.list_operations.timeout,
190
+ metadata: call_metadata,
191
+ retry_policy: @config.rpcs.list_operations.retry_policy
192
+
193
+ options.apply_defaults timeout: @config.timeout,
194
+ metadata: @config.metadata,
195
+ retry_policy: @config.retry_policy
196
+
197
+ @operations_stub.list_operations request, options do |result, operation|
198
+ result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
199
+ yield result, operation if block_given?
200
+ throw :response, result
201
+ end
202
+ rescue ::Gapic::Rest::Error => e
203
+ raise ::Google::Cloud::Error.from_error(e)
204
+ end
205
+
206
+ ##
207
+ # Gets the latest state of a long-running operation. Clients can use this
208
+ # method to poll the operation result at intervals as recommended by the API
209
+ # service.
210
+ #
211
+ # @overload get_operation(request, options = nil)
212
+ # Pass arguments to `get_operation` via a request object, either of type
213
+ # {::Google::Longrunning::GetOperationRequest} or an equivalent Hash.
214
+ #
215
+ # @param request [::Google::Longrunning::GetOperationRequest, ::Hash]
216
+ # A request object representing the call parameters. Required. To specify no
217
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
218
+ # @param options [::Gapic::CallOptions, ::Hash]
219
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
220
+ #
221
+ # @overload get_operation(name: nil)
222
+ # Pass arguments to `get_operation` via keyword arguments. Note that at
223
+ # least one keyword argument is required. To specify no parameters, or to keep all
224
+ # the default parameter values, pass an empty Hash as a request object (see above).
225
+ #
226
+ # @param name [::String]
227
+ # The name of the operation resource.
228
+ # @yield [result, operation] Access the result along with the TransportOperation object
229
+ # @yieldparam result [::Gapic::Operation]
230
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
231
+ #
232
+ # @return [::Gapic::Operation]
233
+ #
234
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
235
+ #
236
+ # @example Basic example
237
+ # require "google/longrunning"
238
+ #
239
+ # # Create a client object. The client can be reused for multiple calls.
240
+ # client = Google::Longrunning::Operations::Rest::Client.new
241
+ #
242
+ # # Create a request. To set request fields, pass in keyword arguments.
243
+ # request = Google::Longrunning::GetOperationRequest.new
244
+ #
245
+ # # Call the get_operation method.
246
+ # result = client.get_operation request
247
+ #
248
+ # # The returned object is of type Gapic::Operation. You can use it to
249
+ # # check the status of an operation, cancel it, or wait for results.
250
+ # # Here is how to wait for a response.
251
+ # result.wait_until_done! timeout: 60
252
+ # if result.response?
253
+ # p result.response
254
+ # else
255
+ # puts "No response received."
256
+ # end
257
+ #
258
+ def get_operation request, options = nil
259
+ raise ::ArgumentError, "request must be provided" if request.nil?
260
+
261
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::GetOperationRequest
262
+
263
+ # Converts hash and nil to an options object
264
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
265
+
266
+ # Customize the options with defaults
267
+ call_metadata = @config.rpcs.get_operation.metadata.to_h
268
+
269
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
270
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
271
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
272
+ gapic_version: ::Google::Apps::Events::Subscriptions::V1beta::VERSION,
273
+ transports_version_send: [:rest]
274
+
275
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
276
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
277
+
278
+ options.apply_defaults timeout: @config.rpcs.get_operation.timeout,
279
+ metadata: call_metadata,
280
+ retry_policy: @config.rpcs.get_operation.retry_policy
281
+
282
+ options.apply_defaults timeout: @config.timeout,
283
+ metadata: @config.metadata,
284
+ retry_policy: @config.retry_policy
285
+
286
+ @operations_stub.get_operation request, options do |result, operation|
287
+ result = ::Gapic::Operation.new result, @operations_client, options: options
288
+ yield result, operation if block_given?
289
+ throw :response, result
290
+ end
291
+ rescue ::Gapic::Rest::Error => e
292
+ raise ::Google::Cloud::Error.from_error(e)
293
+ end
294
+
295
+ ##
296
+ # Deletes a long-running operation. This method indicates that the client is
297
+ # no longer interested in the operation result. It does not cancel the
298
+ # operation. If the server doesn't support this method, it returns
299
+ # `google.rpc.Code.UNIMPLEMENTED`.
300
+ #
301
+ # @overload delete_operation(request, options = nil)
302
+ # Pass arguments to `delete_operation` via a request object, either of type
303
+ # {::Google::Longrunning::DeleteOperationRequest} or an equivalent Hash.
304
+ #
305
+ # @param request [::Google::Longrunning::DeleteOperationRequest, ::Hash]
306
+ # A request object representing the call parameters. Required. To specify no
307
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
308
+ # @param options [::Gapic::CallOptions, ::Hash]
309
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
310
+ #
311
+ # @overload delete_operation(name: nil)
312
+ # Pass arguments to `delete_operation` via keyword arguments. Note that at
313
+ # least one keyword argument is required. To specify no parameters, or to keep all
314
+ # the default parameter values, pass an empty Hash as a request object (see above).
315
+ #
316
+ # @param name [::String]
317
+ # The name of the operation resource to be deleted.
318
+ # @yield [result, operation] Access the result along with the TransportOperation object
319
+ # @yieldparam result [::Google::Protobuf::Empty]
320
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
321
+ #
322
+ # @return [::Google::Protobuf::Empty]
323
+ #
324
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
325
+ #
326
+ # @example Basic example
327
+ # require "google/longrunning"
328
+ #
329
+ # # Create a client object. The client can be reused for multiple calls.
330
+ # client = Google::Longrunning::Operations::Rest::Client.new
331
+ #
332
+ # # Create a request. To set request fields, pass in keyword arguments.
333
+ # request = Google::Longrunning::DeleteOperationRequest.new
334
+ #
335
+ # # Call the delete_operation method.
336
+ # result = client.delete_operation request
337
+ #
338
+ # # The returned object is of type Google::Protobuf::Empty.
339
+ # p result
340
+ #
341
+ def delete_operation request, options = nil
342
+ raise ::ArgumentError, "request must be provided" if request.nil?
343
+
344
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::DeleteOperationRequest
345
+
346
+ # Converts hash and nil to an options object
347
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
348
+
349
+ # Customize the options with defaults
350
+ call_metadata = @config.rpcs.delete_operation.metadata.to_h
351
+
352
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
353
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
354
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
355
+ gapic_version: ::Google::Apps::Events::Subscriptions::V1beta::VERSION,
356
+ transports_version_send: [:rest]
357
+
358
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
359
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
360
+
361
+ options.apply_defaults timeout: @config.rpcs.delete_operation.timeout,
362
+ metadata: call_metadata,
363
+ retry_policy: @config.rpcs.delete_operation.retry_policy
364
+
365
+ options.apply_defaults timeout: @config.timeout,
366
+ metadata: @config.metadata,
367
+ retry_policy: @config.retry_policy
368
+
369
+ @operations_stub.delete_operation request, options do |result, operation|
370
+ yield result, operation if block_given?
371
+ end
372
+ rescue ::Gapic::Rest::Error => e
373
+ raise ::Google::Cloud::Error.from_error(e)
374
+ end
375
+
376
+ ##
377
+ # Starts asynchronous cancellation on a long-running operation. The server
378
+ # makes a best effort to cancel the operation, but success is not
379
+ # guaranteed. If the server doesn't support this method, it returns
380
+ # `google.rpc.Code.UNIMPLEMENTED`. Clients can use
381
+ # Operations.GetOperation or
382
+ # other methods to check whether the cancellation succeeded or whether the
383
+ # operation completed despite cancellation. On successful cancellation,
384
+ # the operation is not deleted; instead, it becomes an operation with
385
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
386
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
387
+ # `Code.CANCELLED`.
388
+ #
389
+ # @overload cancel_operation(request, options = nil)
390
+ # Pass arguments to `cancel_operation` via a request object, either of type
391
+ # {::Google::Longrunning::CancelOperationRequest} or an equivalent Hash.
392
+ #
393
+ # @param request [::Google::Longrunning::CancelOperationRequest, ::Hash]
394
+ # A request object representing the call parameters. Required. To specify no
395
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
396
+ # @param options [::Gapic::CallOptions, ::Hash]
397
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
398
+ #
399
+ # @overload cancel_operation(name: nil)
400
+ # Pass arguments to `cancel_operation` via keyword arguments. Note that at
401
+ # least one keyword argument is required. To specify no parameters, or to keep all
402
+ # the default parameter values, pass an empty Hash as a request object (see above).
403
+ #
404
+ # @param name [::String]
405
+ # The name of the operation resource to be cancelled.
406
+ # @yield [result, operation] Access the result along with the TransportOperation object
407
+ # @yieldparam result [::Google::Protobuf::Empty]
408
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
409
+ #
410
+ # @return [::Google::Protobuf::Empty]
411
+ #
412
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
413
+ #
414
+ # @example Basic example
415
+ # require "google/longrunning"
416
+ #
417
+ # # Create a client object. The client can be reused for multiple calls.
418
+ # client = Google::Longrunning::Operations::Rest::Client.new
419
+ #
420
+ # # Create a request. To set request fields, pass in keyword arguments.
421
+ # request = Google::Longrunning::CancelOperationRequest.new
422
+ #
423
+ # # Call the cancel_operation method.
424
+ # result = client.cancel_operation request
425
+ #
426
+ # # The returned object is of type Google::Protobuf::Empty.
427
+ # p result
428
+ #
429
+ def cancel_operation request, options = nil
430
+ raise ::ArgumentError, "request must be provided" if request.nil?
431
+
432
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Longrunning::CancelOperationRequest
433
+
434
+ # Converts hash and nil to an options object
435
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
436
+
437
+ # Customize the options with defaults
438
+ call_metadata = @config.rpcs.cancel_operation.metadata.to_h
439
+
440
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
441
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
442
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
443
+ gapic_version: ::Google::Apps::Events::Subscriptions::V1beta::VERSION,
444
+ transports_version_send: [:rest]
445
+
446
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
447
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
448
+
449
+ options.apply_defaults timeout: @config.rpcs.cancel_operation.timeout,
450
+ metadata: call_metadata,
451
+ retry_policy: @config.rpcs.cancel_operation.retry_policy
452
+
453
+ options.apply_defaults timeout: @config.timeout,
454
+ metadata: @config.metadata,
455
+ retry_policy: @config.retry_policy
456
+
457
+ @operations_stub.cancel_operation request, options do |result, operation|
458
+ yield result, operation if block_given?
459
+ end
460
+ rescue ::Gapic::Rest::Error => e
461
+ raise ::Google::Cloud::Error.from_error(e)
462
+ end
463
+
464
+ ##
465
+ # Configuration class for the Operations REST API.
466
+ #
467
+ # This class represents the configuration for Operations REST,
468
+ # providing control over timeouts, retry behavior, logging, transport
469
+ # parameters, and other low-level controls. Certain parameters can also be
470
+ # applied individually to specific RPCs. See
471
+ # {::Google::Longrunning::Operations::Rest::Client::Configuration::Rpcs}
472
+ # for a list of RPCs that can be configured independently.
473
+ #
474
+ # Configuration can be applied globally to all clients, or to a single client
475
+ # on construction.
476
+ #
477
+ # @example
478
+ #
479
+ # # Modify the global config, setting the timeout for
480
+ # # list_operations to 20 seconds,
481
+ # # and all remaining timeouts to 10 seconds.
482
+ # ::Google::Longrunning::Operations::Rest::Client.configure do |config|
483
+ # config.timeout = 10.0
484
+ # config.rpcs.list_operations.timeout = 20.0
485
+ # end
486
+ #
487
+ # # Apply the above configuration only to a new client.
488
+ # client = ::Google::Longrunning::Operations::Rest::Client.new do |config|
489
+ # config.timeout = 10.0
490
+ # config.rpcs.list_operations.timeout = 20.0
491
+ # end
492
+ #
493
+ # @!attribute [rw] endpoint
494
+ # A custom service endpoint, as a hostname or hostname:port. The default is
495
+ # nil, indicating to use the default endpoint in the current universe domain.
496
+ # @return [::String,nil]
497
+ # @!attribute [rw] credentials
498
+ # Credentials to send with calls. You may provide any of the following types:
499
+ # * (`String`) The path to a service account key file in JSON format
500
+ # * (`Hash`) A service account key as a Hash
501
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
502
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
503
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
504
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
505
+ # * (`nil`) indicating no credentials
506
+ #
507
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
508
+ # external source for authentication to Google Cloud, you must validate it before
509
+ # providing it to a Google API client library. Providing an unvalidated credential
510
+ # configuration to Google APIs can compromise the security of your systems and data.
511
+ # For more information, refer to [Validate credential configurations from external
512
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
513
+ # @return [::Object]
514
+ # @!attribute [rw] scope
515
+ # The OAuth scopes
516
+ # @return [::Array<::String>]
517
+ # @!attribute [rw] lib_name
518
+ # The library name as recorded in instrumentation and logging
519
+ # @return [::String]
520
+ # @!attribute [rw] lib_version
521
+ # The library version as recorded in instrumentation and logging
522
+ # @return [::String]
523
+ # @!attribute [rw] timeout
524
+ # The call timeout in seconds.
525
+ # @return [::Numeric]
526
+ # @!attribute [rw] metadata
527
+ # Additional headers to be sent with the call.
528
+ # @return [::Hash{::Symbol=>::String}]
529
+ # @!attribute [rw] retry_policy
530
+ # The retry policy. The value is a hash with the following keys:
531
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
532
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
533
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
534
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
535
+ # trigger a retry.
536
+ # @return [::Hash]
537
+ # @!attribute [rw] quota_project
538
+ # A separate project against which to charge quota.
539
+ # @return [::String]
540
+ # @!attribute [rw] universe_domain
541
+ # The universe domain within which to make requests. This determines the
542
+ # default endpoint URL. The default value of nil uses the environment
543
+ # universe (usually the default "googleapis.com" universe).
544
+ # @return [::String,nil]
545
+ # @!attribute [rw] logger
546
+ # A custom logger to use for request/response debug logging, or the value
547
+ # `:default` (the default) to construct a default logger, or `nil` to
548
+ # explicitly disable logging.
549
+ # @return [::Logger,:default,nil]
550
+ #
551
+ class Configuration
552
+ extend ::Gapic::Config
553
+
554
+ # @private
555
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
556
+ DEFAULT_ENDPOINT = "workspaceevents.googleapis.com"
557
+
558
+ config_attr :endpoint, nil, ::String, nil
559
+ config_attr :credentials, nil do |value|
560
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
561
+ allowed.any? { |klass| klass === value }
562
+ end
563
+ config_attr :scope, nil, ::String, ::Array, nil
564
+ config_attr :lib_name, nil, ::String, nil
565
+ config_attr :lib_version, nil, ::String, nil
566
+ config_attr :timeout, nil, ::Numeric, nil
567
+ config_attr :metadata, nil, ::Hash, nil
568
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
569
+ config_attr :quota_project, nil, ::String, nil
570
+ config_attr :universe_domain, nil, ::String, nil
571
+ config_attr :logger, :default, ::Logger, nil, :default
572
+
573
+ # @private
574
+ def initialize parent_config = nil
575
+ @parent_config = parent_config unless parent_config.nil?
576
+
577
+ yield self if block_given?
578
+ end
579
+
580
+ ##
581
+ # Configurations for individual RPCs
582
+ # @return [Rpcs]
583
+ #
584
+ def rpcs
585
+ @rpcs ||= begin
586
+ parent_rpcs = nil
587
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
588
+ Rpcs.new parent_rpcs
589
+ end
590
+ end
591
+
592
+ ##
593
+ # Configuration RPC class for the Operations API.
594
+ #
595
+ # Includes fields providing the configuration for each RPC in this service.
596
+ # Each configuration object is of type `Gapic::Config::Method` and includes
597
+ # the following configuration fields:
598
+ #
599
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
600
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
601
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
602
+ # include the following keys:
603
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
604
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
605
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
606
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
607
+ # trigger a retry.
608
+ #
609
+ class Rpcs
610
+ ##
611
+ # RPC-specific configuration for `list_operations`
612
+ # @return [::Gapic::Config::Method]
613
+ #
614
+ attr_reader :list_operations
615
+ ##
616
+ # RPC-specific configuration for `get_operation`
617
+ # @return [::Gapic::Config::Method]
618
+ #
619
+ attr_reader :get_operation
620
+ ##
621
+ # RPC-specific configuration for `delete_operation`
622
+ # @return [::Gapic::Config::Method]
623
+ #
624
+ attr_reader :delete_operation
625
+ ##
626
+ # RPC-specific configuration for `cancel_operation`
627
+ # @return [::Gapic::Config::Method]
628
+ #
629
+ attr_reader :cancel_operation
630
+
631
+ # @private
632
+ def initialize parent_rpcs = nil
633
+ list_operations_config = parent_rpcs.list_operations if parent_rpcs.respond_to? :list_operations
634
+ @list_operations = ::Gapic::Config::Method.new list_operations_config
635
+ get_operation_config = parent_rpcs.get_operation if parent_rpcs.respond_to? :get_operation
636
+ @get_operation = ::Gapic::Config::Method.new get_operation_config
637
+ delete_operation_config = parent_rpcs.delete_operation if parent_rpcs.respond_to? :delete_operation
638
+ @delete_operation = ::Gapic::Config::Method.new delete_operation_config
639
+ cancel_operation_config = parent_rpcs.cancel_operation if parent_rpcs.respond_to? :cancel_operation
640
+ @cancel_operation = ::Gapic::Config::Method.new cancel_operation_config
641
+
642
+ yield self if block_given?
643
+ end
644
+ end
645
+ end
646
+ end
647
+
648
+ ##
649
+ # @private
650
+ # REST service stub for the Longrunning Operations API.
651
+ # Service stub contains baseline method implementations
652
+ # including transcoding, making the REST call, and deserialing the response.
653
+ class OperationsServiceStub
654
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
655
+ # These require statements are intentionally placed here to initialize
656
+ # the REST modules only when it's required.
657
+ require "gapic/rest"
658
+
659
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
660
+ endpoint_template: endpoint_template,
661
+ universe_domain: universe_domain,
662
+ credentials: credentials
663
+ end
664
+
665
+ ##
666
+ # Baseline implementation for the list_operations REST call
667
+ #
668
+ # @param request_pb [::Google::Longrunning::ListOperationsRequest]
669
+ # A request object representing the call parameters. Required.
670
+ # @param options [::Gapic::CallOptions]
671
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
672
+ #
673
+ # @yield [result, operation] Access the result along with the TransportOperation object
674
+ # @yieldparam result [::Google::Longrunning::ListOperationsResponse]
675
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
676
+ #
677
+ # @return [::Google::Longrunning::ListOperationsResponse]
678
+ # A result object deserialized from the server's reply
679
+ def list_operations request_pb, options = nil
680
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
681
+
682
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_list_operations_request request_pb
683
+ query_string_params = if query_string_params.any?
684
+ query_string_params.to_h { |p| p.split "=", 2 }
685
+ else
686
+ {}
687
+ end
688
+
689
+ response = @client_stub.make_http_request(
690
+ verb,
691
+ uri: uri,
692
+ body: body || "",
693
+ params: query_string_params,
694
+ method_name: "list_operations",
695
+ options: options
696
+ )
697
+ operation = ::Gapic::Rest::TransportOperation.new response
698
+ result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
699
+ catch :response do
700
+ yield result, operation if block_given?
701
+ result
702
+ end
703
+ end
704
+
705
+ ##
706
+ # Baseline implementation for the get_operation REST call
707
+ #
708
+ # @param request_pb [::Google::Longrunning::GetOperationRequest]
709
+ # A request object representing the call parameters. Required.
710
+ # @param options [::Gapic::CallOptions]
711
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
712
+ #
713
+ # @yield [result, operation] Access the result along with the TransportOperation object
714
+ # @yieldparam result [::Google::Longrunning::Operation]
715
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
716
+ #
717
+ # @return [::Google::Longrunning::Operation]
718
+ # A result object deserialized from the server's reply
719
+ def get_operation request_pb, options = nil
720
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
721
+
722
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_get_operation_request request_pb
723
+ query_string_params = if query_string_params.any?
724
+ query_string_params.to_h { |p| p.split "=", 2 }
725
+ else
726
+ {}
727
+ end
728
+
729
+ response = @client_stub.make_http_request(
730
+ verb,
731
+ uri: uri,
732
+ body: body || "",
733
+ params: query_string_params,
734
+ method_name: "get_operation",
735
+ options: options
736
+ )
737
+ operation = ::Gapic::Rest::TransportOperation.new response
738
+ result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
739
+ catch :response do
740
+ yield result, operation if block_given?
741
+ result
742
+ end
743
+ end
744
+
745
+ ##
746
+ # Baseline implementation for the delete_operation REST call
747
+ #
748
+ # @param request_pb [::Google::Longrunning::DeleteOperationRequest]
749
+ # A request object representing the call parameters. Required.
750
+ # @param options [::Gapic::CallOptions]
751
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
752
+ #
753
+ # @yield [result, operation] Access the result along with the TransportOperation object
754
+ # @yieldparam result [::Google::Protobuf::Empty]
755
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
756
+ #
757
+ # @return [::Google::Protobuf::Empty]
758
+ # A result object deserialized from the server's reply
759
+ def delete_operation request_pb, options = nil
760
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
761
+
762
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_delete_operation_request request_pb
763
+ query_string_params = if query_string_params.any?
764
+ query_string_params.to_h { |p| p.split "=", 2 }
765
+ else
766
+ {}
767
+ end
768
+
769
+ response = @client_stub.make_http_request(
770
+ verb,
771
+ uri: uri,
772
+ body: body || "",
773
+ params: query_string_params,
774
+ method_name: "delete_operation",
775
+ options: options
776
+ )
777
+ operation = ::Gapic::Rest::TransportOperation.new response
778
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
779
+ catch :response do
780
+ yield result, operation if block_given?
781
+ result
782
+ end
783
+ end
784
+
785
+ ##
786
+ # Baseline implementation for the cancel_operation REST call
787
+ #
788
+ # @param request_pb [::Google::Longrunning::CancelOperationRequest]
789
+ # A request object representing the call parameters. Required.
790
+ # @param options [::Gapic::CallOptions]
791
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
792
+ #
793
+ # @yield [result, operation] Access the result along with the TransportOperation object
794
+ # @yieldparam result [::Google::Protobuf::Empty]
795
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
796
+ #
797
+ # @return [::Google::Protobuf::Empty]
798
+ # A result object deserialized from the server's reply
799
+ def cancel_operation request_pb, options = nil
800
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
801
+
802
+ verb, uri, query_string_params, body = OperationsServiceStub.transcode_cancel_operation_request request_pb
803
+ query_string_params = if query_string_params.any?
804
+ query_string_params.to_h { |p| p.split "=", 2 }
805
+ else
806
+ {}
807
+ end
808
+
809
+ response = @client_stub.make_http_request(
810
+ verb,
811
+ uri: uri,
812
+ body: body || "",
813
+ params: query_string_params,
814
+ method_name: "cancel_operation",
815
+ options: options
816
+ )
817
+ operation = ::Gapic::Rest::TransportOperation.new response
818
+ result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
819
+ catch :response do
820
+ yield result, operation if block_given?
821
+ result
822
+ end
823
+ end
824
+
825
+ ##
826
+ # @private
827
+ #
828
+ # GRPC transcoding helper method for the list_operations REST call
829
+ #
830
+ # @param request_pb [::Google::Longrunning::ListOperationsRequest]
831
+ # A request object representing the call parameters. Required.
832
+ # @return [Array(String, [String, nil], Hash{String => String})]
833
+ # Uri, Body, Query string parameters
834
+ def self.transcode_list_operations_request request_pb
835
+ transcoder = Gapic::Rest::GrpcTranscoder.new
836
+ .with_bindings(
837
+ uri_method: :get,
838
+ uri_template: "/v1/{name}",
839
+ matches: [
840
+ ["name", %r{^operations/?$}, false]
841
+ ]
842
+ )
843
+ transcoder.transcode request_pb
844
+ end
845
+
846
+ ##
847
+ # @private
848
+ #
849
+ # GRPC transcoding helper method for the get_operation REST call
850
+ #
851
+ # @param request_pb [::Google::Longrunning::GetOperationRequest]
852
+ # A request object representing the call parameters. Required.
853
+ # @return [Array(String, [String, nil], Hash{String => String})]
854
+ # Uri, Body, Query string parameters
855
+ def self.transcode_get_operation_request request_pb
856
+ transcoder = Gapic::Rest::GrpcTranscoder.new
857
+ .with_bindings(
858
+ uri_method: :get,
859
+ uri_template: "/v1beta/{name}",
860
+ matches: [
861
+ ["name", %r{^operations(?:/.*)?$}, true]
862
+ ]
863
+ )
864
+ transcoder.transcode request_pb
865
+ end
866
+
867
+ ##
868
+ # @private
869
+ #
870
+ # GRPC transcoding helper method for the delete_operation REST call
871
+ #
872
+ # @param request_pb [::Google::Longrunning::DeleteOperationRequest]
873
+ # A request object representing the call parameters. Required.
874
+ # @return [Array(String, [String, nil], Hash{String => String})]
875
+ # Uri, Body, Query string parameters
876
+ def self.transcode_delete_operation_request request_pb
877
+ transcoder = Gapic::Rest::GrpcTranscoder.new
878
+ .with_bindings(
879
+ uri_method: :delete,
880
+ uri_template: "/v1/{name}",
881
+ matches: [
882
+ ["name", %r{^operations(?:/.*)?$}, true]
883
+ ]
884
+ )
885
+ transcoder.transcode request_pb
886
+ end
887
+
888
+ ##
889
+ # @private
890
+ #
891
+ # GRPC transcoding helper method for the cancel_operation REST call
892
+ #
893
+ # @param request_pb [::Google::Longrunning::CancelOperationRequest]
894
+ # A request object representing the call parameters. Required.
895
+ # @return [Array(String, [String, nil], Hash{String => String})]
896
+ # Uri, Body, Query string parameters
897
+ def self.transcode_cancel_operation_request request_pb
898
+ transcoder = Gapic::Rest::GrpcTranscoder.new
899
+ .with_bindings(
900
+ uri_method: :post,
901
+ uri_template: "/v1/{name}:cancel",
902
+ body: "*",
903
+ matches: [
904
+ ["name", %r{^operations(?:/.*)?$}, true]
905
+ ]
906
+ )
907
+ transcoder.transcode request_pb
908
+ end
909
+ end
910
+ end
911
+ end
912
+ end
913
+ end
914
+ end
915
+ end
916
+ end