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