google-cloud-gaming-v1 0.7.0 → 1.0.0

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