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