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