google-cloud-edge_network-v1 0.a → 0.2.0

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