google-cloud-ai_platform-v1 0.38.0 → 0.39.0

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