google-cloud-ai_platform-v1 0.32.0 → 0.34.0

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