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,758 @@
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 "google/cloud/errors"
20
+ require "google/cloud/aiplatform/v1/genai_tuning_service_pb"
21
+ require "google/cloud/location"
22
+ require "google/iam/v1"
23
+
24
+ module Google
25
+ module Cloud
26
+ module AIPlatform
27
+ module V1
28
+ module GenAiTuningService
29
+ ##
30
+ # Client for the GenAiTuningService service.
31
+ #
32
+ # A service for creating and managing GenAI Tuning Jobs.
33
+ #
34
+ class Client
35
+ # @private
36
+ DEFAULT_ENDPOINT_TEMPLATE = "aiplatform.$UNIVERSE_DOMAIN$"
37
+
38
+ include Paths
39
+
40
+ # @private
41
+ attr_reader :gen_ai_tuning_service_stub
42
+
43
+ ##
44
+ # Configure the GenAiTuningService Client class.
45
+ #
46
+ # See {::Google::Cloud::AIPlatform::V1::GenAiTuningService::Client::Configuration}
47
+ # for a description of the configuration fields.
48
+ #
49
+ # @example
50
+ #
51
+ # # Modify the configuration for all GenAiTuningService clients
52
+ # ::Google::Cloud::AIPlatform::V1::GenAiTuningService::Client.configure do |config|
53
+ # config.timeout = 10.0
54
+ # end
55
+ #
56
+ # @yield [config] Configure the Client client.
57
+ # @yieldparam config [Client::Configuration]
58
+ #
59
+ # @return [Client::Configuration]
60
+ #
61
+ def self.configure
62
+ @configure ||= begin
63
+ namespace = ["Google", "Cloud", "AIPlatform", "V1"]
64
+ parent_config = while namespace.any?
65
+ parent_name = namespace.join "::"
66
+ parent_const = const_get parent_name
67
+ break parent_const.configure if parent_const.respond_to? :configure
68
+ namespace.pop
69
+ end
70
+ default_config = Client::Configuration.new parent_config
71
+
72
+ default_config
73
+ end
74
+ yield @configure if block_given?
75
+ @configure
76
+ end
77
+
78
+ ##
79
+ # Configure the GenAiTuningService Client instance.
80
+ #
81
+ # The configuration is set to the derived mode, meaning that values can be changed,
82
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
83
+ # should be made on {Client.configure}.
84
+ #
85
+ # See {::Google::Cloud::AIPlatform::V1::GenAiTuningService::Client::Configuration}
86
+ # for a description of the configuration fields.
87
+ #
88
+ # @yield [config] Configure the Client client.
89
+ # @yieldparam config [Client::Configuration]
90
+ #
91
+ # @return [Client::Configuration]
92
+ #
93
+ def configure
94
+ yield @config if block_given?
95
+ @config
96
+ end
97
+
98
+ ##
99
+ # The effective universe domain
100
+ #
101
+ # @return [String]
102
+ #
103
+ def universe_domain
104
+ @gen_ai_tuning_service_stub.universe_domain
105
+ end
106
+
107
+ ##
108
+ # Create a new GenAiTuningService client object.
109
+ #
110
+ # @example
111
+ #
112
+ # # Create a client using the default configuration
113
+ # client = ::Google::Cloud::AIPlatform::V1::GenAiTuningService::Client.new
114
+ #
115
+ # # Create a client using a custom configuration
116
+ # client = ::Google::Cloud::AIPlatform::V1::GenAiTuningService::Client.new do |config|
117
+ # config.timeout = 10.0
118
+ # end
119
+ #
120
+ # @yield [config] Configure the GenAiTuningService client.
121
+ # @yieldparam config [Client::Configuration]
122
+ #
123
+ def initialize
124
+ # These require statements are intentionally placed here to initialize
125
+ # the gRPC module only when it's required.
126
+ # See https://github.com/googleapis/toolkit/issues/446
127
+ require "gapic/grpc"
128
+ require "google/cloud/aiplatform/v1/genai_tuning_service_services_pb"
129
+
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ # Use self-signed JWT if the endpoint is unchanged from default,
139
+ # but only if the default endpoint does not have a region prefix.
140
+ enable_self_signed_jwt = @config.endpoint.nil? ||
141
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
142
+ !@config.endpoint.split(".").first.include?("-"))
143
+ credentials ||= Credentials.default scope: @config.scope,
144
+ enable_self_signed_jwt: enable_self_signed_jwt
145
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
146
+ credentials = Credentials.new credentials, scope: @config.scope
147
+ end
148
+ @quota_project_id = @config.quota_project
149
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
150
+
151
+ @gen_ai_tuning_service_stub = ::Gapic::ServiceStub.new(
152
+ ::Google::Cloud::AIPlatform::V1::GenAiTuningService::Stub,
153
+ credentials: credentials,
154
+ endpoint: @config.endpoint,
155
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
156
+ universe_domain: @config.universe_domain,
157
+ channel_args: @config.channel_args,
158
+ interceptors: @config.interceptors,
159
+ channel_pool_config: @config.channel_pool
160
+ )
161
+
162
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
163
+ config.credentials = credentials
164
+ config.quota_project = @quota_project_id
165
+ config.endpoint = @gen_ai_tuning_service_stub.endpoint
166
+ config.universe_domain = @gen_ai_tuning_service_stub.universe_domain
167
+ end
168
+
169
+ @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
170
+ config.credentials = credentials
171
+ config.quota_project = @quota_project_id
172
+ config.endpoint = @gen_ai_tuning_service_stub.endpoint
173
+ config.universe_domain = @gen_ai_tuning_service_stub.universe_domain
174
+ end
175
+ end
176
+
177
+ ##
178
+ # Get the associated client for mix-in of the Locations.
179
+ #
180
+ # @return [Google::Cloud::Location::Locations::Client]
181
+ #
182
+ attr_reader :location_client
183
+
184
+ ##
185
+ # Get the associated client for mix-in of the IAMPolicy.
186
+ #
187
+ # @return [Google::Iam::V1::IAMPolicy::Client]
188
+ #
189
+ attr_reader :iam_policy_client
190
+
191
+ # Service calls
192
+
193
+ ##
194
+ # Creates a TuningJob. A created TuningJob right away will be attempted to
195
+ # be run.
196
+ #
197
+ # @overload create_tuning_job(request, options = nil)
198
+ # Pass arguments to `create_tuning_job` via a request object, either of type
199
+ # {::Google::Cloud::AIPlatform::V1::CreateTuningJobRequest} or an equivalent Hash.
200
+ #
201
+ # @param request [::Google::Cloud::AIPlatform::V1::CreateTuningJobRequest, ::Hash]
202
+ # A request object representing the call parameters. Required. To specify no
203
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
204
+ # @param options [::Gapic::CallOptions, ::Hash]
205
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
206
+ #
207
+ # @overload create_tuning_job(parent: nil, tuning_job: nil)
208
+ # Pass arguments to `create_tuning_job` via keyword arguments. Note that at
209
+ # least one keyword argument is required. To specify no parameters, or to keep all
210
+ # the default parameter values, pass an empty Hash as a request object (see above).
211
+ #
212
+ # @param parent [::String]
213
+ # Required. The resource name of the Location to create the TuningJob in.
214
+ # Format: `projects/{project}/locations/{location}`
215
+ # @param tuning_job [::Google::Cloud::AIPlatform::V1::TuningJob, ::Hash]
216
+ # Required. The TuningJob to create.
217
+ #
218
+ # @yield [response, operation] Access the result along with the RPC operation
219
+ # @yieldparam response [::Google::Cloud::AIPlatform::V1::TuningJob]
220
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
221
+ #
222
+ # @return [::Google::Cloud::AIPlatform::V1::TuningJob]
223
+ #
224
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
225
+ #
226
+ # @example Basic example
227
+ # require "google/cloud/ai_platform/v1"
228
+ #
229
+ # # Create a client object. The client can be reused for multiple calls.
230
+ # client = Google::Cloud::AIPlatform::V1::GenAiTuningService::Client.new
231
+ #
232
+ # # Create a request. To set request fields, pass in keyword arguments.
233
+ # request = Google::Cloud::AIPlatform::V1::CreateTuningJobRequest.new
234
+ #
235
+ # # Call the create_tuning_job method.
236
+ # result = client.create_tuning_job request
237
+ #
238
+ # # The returned object is of type Google::Cloud::AIPlatform::V1::TuningJob.
239
+ # p result
240
+ #
241
+ def create_tuning_job request, options = nil
242
+ raise ::ArgumentError, "request must be provided" if request.nil?
243
+
244
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::CreateTuningJobRequest
245
+
246
+ # Converts hash and nil to an options object
247
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
248
+
249
+ # Customize the options with defaults
250
+ metadata = @config.rpcs.create_tuning_job.metadata.to_h
251
+
252
+ # Set x-goog-api-client and x-goog-user-project headers
253
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
254
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
255
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
256
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
257
+
258
+ header_params = {}
259
+ if request.parent
260
+ header_params["parent"] = request.parent
261
+ end
262
+
263
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
264
+ metadata[:"x-goog-request-params"] ||= request_params_header
265
+
266
+ options.apply_defaults timeout: @config.rpcs.create_tuning_job.timeout,
267
+ metadata: metadata,
268
+ retry_policy: @config.rpcs.create_tuning_job.retry_policy
269
+
270
+ options.apply_defaults timeout: @config.timeout,
271
+ metadata: @config.metadata,
272
+ retry_policy: @config.retry_policy
273
+
274
+ @gen_ai_tuning_service_stub.call_rpc :create_tuning_job, request, options: options do |response, operation|
275
+ yield response, operation if block_given?
276
+ return response
277
+ end
278
+ rescue ::GRPC::BadStatus => e
279
+ raise ::Google::Cloud::Error.from_error(e)
280
+ end
281
+
282
+ ##
283
+ # Gets a TuningJob.
284
+ #
285
+ # @overload get_tuning_job(request, options = nil)
286
+ # Pass arguments to `get_tuning_job` via a request object, either of type
287
+ # {::Google::Cloud::AIPlatform::V1::GetTuningJobRequest} or an equivalent Hash.
288
+ #
289
+ # @param request [::Google::Cloud::AIPlatform::V1::GetTuningJobRequest, ::Hash]
290
+ # A request object representing the call parameters. Required. To specify no
291
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
292
+ # @param options [::Gapic::CallOptions, ::Hash]
293
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
294
+ #
295
+ # @overload get_tuning_job(name: nil)
296
+ # Pass arguments to `get_tuning_job` via keyword arguments. Note that at
297
+ # least one keyword argument is required. To specify no parameters, or to keep all
298
+ # the default parameter values, pass an empty Hash as a request object (see above).
299
+ #
300
+ # @param name [::String]
301
+ # Required. The name of the TuningJob resource. Format:
302
+ # `projects/{project}/locations/{location}/tuningJobs/{tuning_job}`
303
+ #
304
+ # @yield [response, operation] Access the result along with the RPC operation
305
+ # @yieldparam response [::Google::Cloud::AIPlatform::V1::TuningJob]
306
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
307
+ #
308
+ # @return [::Google::Cloud::AIPlatform::V1::TuningJob]
309
+ #
310
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
311
+ #
312
+ # @example Basic example
313
+ # require "google/cloud/ai_platform/v1"
314
+ #
315
+ # # Create a client object. The client can be reused for multiple calls.
316
+ # client = Google::Cloud::AIPlatform::V1::GenAiTuningService::Client.new
317
+ #
318
+ # # Create a request. To set request fields, pass in keyword arguments.
319
+ # request = Google::Cloud::AIPlatform::V1::GetTuningJobRequest.new
320
+ #
321
+ # # Call the get_tuning_job method.
322
+ # result = client.get_tuning_job request
323
+ #
324
+ # # The returned object is of type Google::Cloud::AIPlatform::V1::TuningJob.
325
+ # p result
326
+ #
327
+ def get_tuning_job request, options = nil
328
+ raise ::ArgumentError, "request must be provided" if request.nil?
329
+
330
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::GetTuningJobRequest
331
+
332
+ # Converts hash and nil to an options object
333
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
334
+
335
+ # Customize the options with defaults
336
+ metadata = @config.rpcs.get_tuning_job.metadata.to_h
337
+
338
+ # Set x-goog-api-client and x-goog-user-project headers
339
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
340
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
341
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
342
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
343
+
344
+ header_params = {}
345
+ if request.name
346
+ header_params["name"] = request.name
347
+ end
348
+
349
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
350
+ metadata[:"x-goog-request-params"] ||= request_params_header
351
+
352
+ options.apply_defaults timeout: @config.rpcs.get_tuning_job.timeout,
353
+ metadata: metadata,
354
+ retry_policy: @config.rpcs.get_tuning_job.retry_policy
355
+
356
+ options.apply_defaults timeout: @config.timeout,
357
+ metadata: @config.metadata,
358
+ retry_policy: @config.retry_policy
359
+
360
+ @gen_ai_tuning_service_stub.call_rpc :get_tuning_job, request, options: options do |response, operation|
361
+ yield response, operation if block_given?
362
+ return response
363
+ end
364
+ rescue ::GRPC::BadStatus => e
365
+ raise ::Google::Cloud::Error.from_error(e)
366
+ end
367
+
368
+ ##
369
+ # Lists TuningJobs in a Location.
370
+ #
371
+ # @overload list_tuning_jobs(request, options = nil)
372
+ # Pass arguments to `list_tuning_jobs` via a request object, either of type
373
+ # {::Google::Cloud::AIPlatform::V1::ListTuningJobsRequest} or an equivalent Hash.
374
+ #
375
+ # @param request [::Google::Cloud::AIPlatform::V1::ListTuningJobsRequest, ::Hash]
376
+ # A request object representing the call parameters. Required. To specify no
377
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
378
+ # @param options [::Gapic::CallOptions, ::Hash]
379
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
380
+ #
381
+ # @overload list_tuning_jobs(parent: nil, filter: nil, page_size: nil, page_token: nil)
382
+ # Pass arguments to `list_tuning_jobs` via keyword arguments. Note that at
383
+ # least one keyword argument is required. To specify no parameters, or to keep all
384
+ # the default parameter values, pass an empty Hash as a request object (see above).
385
+ #
386
+ # @param parent [::String]
387
+ # Required. The resource name of the Location to list the TuningJobs from.
388
+ # Format: `projects/{project}/locations/{location}`
389
+ # @param filter [::String]
390
+ # Optional. The standard list filter.
391
+ # @param page_size [::Integer]
392
+ # Optional. The standard list page size.
393
+ # @param page_token [::String]
394
+ # Optional. The standard list page token.
395
+ # Typically obtained via [ListTuningJob.next_page_token][] of the
396
+ # previous GenAiTuningService.ListTuningJob][] call.
397
+ #
398
+ # @yield [response, operation] Access the result along with the RPC operation
399
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::TuningJob>]
400
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
401
+ #
402
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::AIPlatform::V1::TuningJob>]
403
+ #
404
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
405
+ #
406
+ # @example Basic example
407
+ # require "google/cloud/ai_platform/v1"
408
+ #
409
+ # # Create a client object. The client can be reused for multiple calls.
410
+ # client = Google::Cloud::AIPlatform::V1::GenAiTuningService::Client.new
411
+ #
412
+ # # Create a request. To set request fields, pass in keyword arguments.
413
+ # request = Google::Cloud::AIPlatform::V1::ListTuningJobsRequest.new
414
+ #
415
+ # # Call the list_tuning_jobs method.
416
+ # result = client.list_tuning_jobs request
417
+ #
418
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
419
+ # # over elements, and API calls will be issued to fetch pages as needed.
420
+ # result.each do |item|
421
+ # # Each element is of type ::Google::Cloud::AIPlatform::V1::TuningJob.
422
+ # p item
423
+ # end
424
+ #
425
+ def list_tuning_jobs request, options = nil
426
+ raise ::ArgumentError, "request must be provided" if request.nil?
427
+
428
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::ListTuningJobsRequest
429
+
430
+ # Converts hash and nil to an options object
431
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
432
+
433
+ # Customize the options with defaults
434
+ metadata = @config.rpcs.list_tuning_jobs.metadata.to_h
435
+
436
+ # Set x-goog-api-client and x-goog-user-project headers
437
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
438
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
439
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
440
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
441
+
442
+ header_params = {}
443
+ if request.parent
444
+ header_params["parent"] = request.parent
445
+ end
446
+
447
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
448
+ metadata[:"x-goog-request-params"] ||= request_params_header
449
+
450
+ options.apply_defaults timeout: @config.rpcs.list_tuning_jobs.timeout,
451
+ metadata: metadata,
452
+ retry_policy: @config.rpcs.list_tuning_jobs.retry_policy
453
+
454
+ options.apply_defaults timeout: @config.timeout,
455
+ metadata: @config.metadata,
456
+ retry_policy: @config.retry_policy
457
+
458
+ @gen_ai_tuning_service_stub.call_rpc :list_tuning_jobs, request, options: options do |response, operation|
459
+ response = ::Gapic::PagedEnumerable.new @gen_ai_tuning_service_stub, :list_tuning_jobs, request, response, operation, options
460
+ yield response, operation if block_given?
461
+ return response
462
+ end
463
+ rescue ::GRPC::BadStatus => e
464
+ raise ::Google::Cloud::Error.from_error(e)
465
+ end
466
+
467
+ ##
468
+ # Cancels a TuningJob.
469
+ # Starts asynchronous cancellation on the TuningJob. The server makes a best
470
+ # effort to cancel the job, but success is not guaranteed. Clients can use
471
+ # {::Google::Cloud::AIPlatform::V1::GenAiTuningService::Client#get_tuning_job GenAiTuningService.GetTuningJob}
472
+ # or other methods to check whether the cancellation succeeded or whether the
473
+ # job completed despite cancellation. On successful cancellation, the
474
+ # TuningJob is not deleted; instead it becomes a job with a
475
+ # {::Google::Cloud::AIPlatform::V1::TuningJob#error TuningJob.error} value with a
476
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of 1, corresponding to
477
+ # `Code.CANCELLED`, and
478
+ # {::Google::Cloud::AIPlatform::V1::TuningJob#state TuningJob.state} is set to
479
+ # `CANCELLED`.
480
+ #
481
+ # @overload cancel_tuning_job(request, options = nil)
482
+ # Pass arguments to `cancel_tuning_job` via a request object, either of type
483
+ # {::Google::Cloud::AIPlatform::V1::CancelTuningJobRequest} or an equivalent Hash.
484
+ #
485
+ # @param request [::Google::Cloud::AIPlatform::V1::CancelTuningJobRequest, ::Hash]
486
+ # A request object representing the call parameters. Required. To specify no
487
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
488
+ # @param options [::Gapic::CallOptions, ::Hash]
489
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
490
+ #
491
+ # @overload cancel_tuning_job(name: nil)
492
+ # Pass arguments to `cancel_tuning_job` via keyword arguments. Note that at
493
+ # least one keyword argument is required. To specify no parameters, or to keep all
494
+ # the default parameter values, pass an empty Hash as a request object (see above).
495
+ #
496
+ # @param name [::String]
497
+ # Required. The name of the TuningJob to cancel. Format:
498
+ # `projects/{project}/locations/{location}/tuningJobs/{tuning_job}`
499
+ #
500
+ # @yield [response, operation] Access the result along with the RPC operation
501
+ # @yieldparam response [::Google::Protobuf::Empty]
502
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
503
+ #
504
+ # @return [::Google::Protobuf::Empty]
505
+ #
506
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
507
+ #
508
+ # @example Basic example
509
+ # require "google/cloud/ai_platform/v1"
510
+ #
511
+ # # Create a client object. The client can be reused for multiple calls.
512
+ # client = Google::Cloud::AIPlatform::V1::GenAiTuningService::Client.new
513
+ #
514
+ # # Create a request. To set request fields, pass in keyword arguments.
515
+ # request = Google::Cloud::AIPlatform::V1::CancelTuningJobRequest.new
516
+ #
517
+ # # Call the cancel_tuning_job method.
518
+ # result = client.cancel_tuning_job request
519
+ #
520
+ # # The returned object is of type Google::Protobuf::Empty.
521
+ # p result
522
+ #
523
+ def cancel_tuning_job request, options = nil
524
+ raise ::ArgumentError, "request must be provided" if request.nil?
525
+
526
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::AIPlatform::V1::CancelTuningJobRequest
527
+
528
+ # Converts hash and nil to an options object
529
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
530
+
531
+ # Customize the options with defaults
532
+ metadata = @config.rpcs.cancel_tuning_job.metadata.to_h
533
+
534
+ # Set x-goog-api-client and x-goog-user-project headers
535
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
536
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
537
+ gapic_version: ::Google::Cloud::AIPlatform::V1::VERSION
538
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
539
+
540
+ header_params = {}
541
+ if request.name
542
+ header_params["name"] = request.name
543
+ end
544
+
545
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
546
+ metadata[:"x-goog-request-params"] ||= request_params_header
547
+
548
+ options.apply_defaults timeout: @config.rpcs.cancel_tuning_job.timeout,
549
+ metadata: metadata,
550
+ retry_policy: @config.rpcs.cancel_tuning_job.retry_policy
551
+
552
+ options.apply_defaults timeout: @config.timeout,
553
+ metadata: @config.metadata,
554
+ retry_policy: @config.retry_policy
555
+
556
+ @gen_ai_tuning_service_stub.call_rpc :cancel_tuning_job, request, options: options do |response, operation|
557
+ yield response, operation if block_given?
558
+ return response
559
+ end
560
+ rescue ::GRPC::BadStatus => e
561
+ raise ::Google::Cloud::Error.from_error(e)
562
+ end
563
+
564
+ ##
565
+ # Configuration class for the GenAiTuningService API.
566
+ #
567
+ # This class represents the configuration for GenAiTuningService,
568
+ # providing control over timeouts, retry behavior, logging, transport
569
+ # parameters, and other low-level controls. Certain parameters can also be
570
+ # applied individually to specific RPCs. See
571
+ # {::Google::Cloud::AIPlatform::V1::GenAiTuningService::Client::Configuration::Rpcs}
572
+ # for a list of RPCs that can be configured independently.
573
+ #
574
+ # Configuration can be applied globally to all clients, or to a single client
575
+ # on construction.
576
+ #
577
+ # @example
578
+ #
579
+ # # Modify the global config, setting the timeout for
580
+ # # create_tuning_job to 20 seconds,
581
+ # # and all remaining timeouts to 10 seconds.
582
+ # ::Google::Cloud::AIPlatform::V1::GenAiTuningService::Client.configure do |config|
583
+ # config.timeout = 10.0
584
+ # config.rpcs.create_tuning_job.timeout = 20.0
585
+ # end
586
+ #
587
+ # # Apply the above configuration only to a new client.
588
+ # client = ::Google::Cloud::AIPlatform::V1::GenAiTuningService::Client.new do |config|
589
+ # config.timeout = 10.0
590
+ # config.rpcs.create_tuning_job.timeout = 20.0
591
+ # end
592
+ #
593
+ # @!attribute [rw] endpoint
594
+ # A custom service endpoint, as a hostname or hostname:port. The default is
595
+ # nil, indicating to use the default endpoint in the current universe domain.
596
+ # @return [::String,nil]
597
+ # @!attribute [rw] credentials
598
+ # Credentials to send with calls. You may provide any of the following types:
599
+ # * (`String`) The path to a service account key file in JSON format
600
+ # * (`Hash`) A service account key as a Hash
601
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
602
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
603
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
604
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
605
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
606
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
607
+ # * (`nil`) indicating no credentials
608
+ # @return [::Object]
609
+ # @!attribute [rw] scope
610
+ # The OAuth scopes
611
+ # @return [::Array<::String>]
612
+ # @!attribute [rw] lib_name
613
+ # The library name as recorded in instrumentation and logging
614
+ # @return [::String]
615
+ # @!attribute [rw] lib_version
616
+ # The library version as recorded in instrumentation and logging
617
+ # @return [::String]
618
+ # @!attribute [rw] channel_args
619
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
620
+ # `GRPC::Core::Channel` object is provided as the credential.
621
+ # @return [::Hash]
622
+ # @!attribute [rw] interceptors
623
+ # An array of interceptors that are run before calls are executed.
624
+ # @return [::Array<::GRPC::ClientInterceptor>]
625
+ # @!attribute [rw] timeout
626
+ # The call timeout in seconds.
627
+ # @return [::Numeric]
628
+ # @!attribute [rw] metadata
629
+ # Additional gRPC headers to be sent with the call.
630
+ # @return [::Hash{::Symbol=>::String}]
631
+ # @!attribute [rw] retry_policy
632
+ # The retry policy. The value is a hash with the following keys:
633
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
634
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
635
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
636
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
637
+ # trigger a retry.
638
+ # @return [::Hash]
639
+ # @!attribute [rw] quota_project
640
+ # A separate project against which to charge quota.
641
+ # @return [::String]
642
+ # @!attribute [rw] universe_domain
643
+ # The universe domain within which to make requests. This determines the
644
+ # default endpoint URL. The default value of nil uses the environment
645
+ # universe (usually the default "googleapis.com" universe).
646
+ # @return [::String,nil]
647
+ #
648
+ class Configuration
649
+ extend ::Gapic::Config
650
+
651
+ # @private
652
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
653
+ DEFAULT_ENDPOINT = "aiplatform.googleapis.com"
654
+
655
+ config_attr :endpoint, nil, ::String, nil
656
+ config_attr :credentials, nil do |value|
657
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
658
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
659
+ allowed.any? { |klass| klass === value }
660
+ end
661
+ config_attr :scope, nil, ::String, ::Array, nil
662
+ config_attr :lib_name, nil, ::String, nil
663
+ config_attr :lib_version, nil, ::String, nil
664
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
665
+ config_attr :interceptors, nil, ::Array, nil
666
+ config_attr :timeout, nil, ::Numeric, nil
667
+ config_attr :metadata, nil, ::Hash, nil
668
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
669
+ config_attr :quota_project, nil, ::String, nil
670
+ config_attr :universe_domain, nil, ::String, nil
671
+
672
+ # @private
673
+ def initialize parent_config = nil
674
+ @parent_config = parent_config unless parent_config.nil?
675
+
676
+ yield self if block_given?
677
+ end
678
+
679
+ ##
680
+ # Configurations for individual RPCs
681
+ # @return [Rpcs]
682
+ #
683
+ def rpcs
684
+ @rpcs ||= begin
685
+ parent_rpcs = nil
686
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
687
+ Rpcs.new parent_rpcs
688
+ end
689
+ end
690
+
691
+ ##
692
+ # Configuration for the channel pool
693
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
694
+ #
695
+ def channel_pool
696
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
697
+ end
698
+
699
+ ##
700
+ # Configuration RPC class for the GenAiTuningService API.
701
+ #
702
+ # Includes fields providing the configuration for each RPC in this service.
703
+ # Each configuration object is of type `Gapic::Config::Method` and includes
704
+ # the following configuration fields:
705
+ #
706
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
707
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
708
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
709
+ # include the following keys:
710
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
711
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
712
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
713
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
714
+ # trigger a retry.
715
+ #
716
+ class Rpcs
717
+ ##
718
+ # RPC-specific configuration for `create_tuning_job`
719
+ # @return [::Gapic::Config::Method]
720
+ #
721
+ attr_reader :create_tuning_job
722
+ ##
723
+ # RPC-specific configuration for `get_tuning_job`
724
+ # @return [::Gapic::Config::Method]
725
+ #
726
+ attr_reader :get_tuning_job
727
+ ##
728
+ # RPC-specific configuration for `list_tuning_jobs`
729
+ # @return [::Gapic::Config::Method]
730
+ #
731
+ attr_reader :list_tuning_jobs
732
+ ##
733
+ # RPC-specific configuration for `cancel_tuning_job`
734
+ # @return [::Gapic::Config::Method]
735
+ #
736
+ attr_reader :cancel_tuning_job
737
+
738
+ # @private
739
+ def initialize parent_rpcs = nil
740
+ create_tuning_job_config = parent_rpcs.create_tuning_job if parent_rpcs.respond_to? :create_tuning_job
741
+ @create_tuning_job = ::Gapic::Config::Method.new create_tuning_job_config
742
+ get_tuning_job_config = parent_rpcs.get_tuning_job if parent_rpcs.respond_to? :get_tuning_job
743
+ @get_tuning_job = ::Gapic::Config::Method.new get_tuning_job_config
744
+ list_tuning_jobs_config = parent_rpcs.list_tuning_jobs if parent_rpcs.respond_to? :list_tuning_jobs
745
+ @list_tuning_jobs = ::Gapic::Config::Method.new list_tuning_jobs_config
746
+ cancel_tuning_job_config = parent_rpcs.cancel_tuning_job if parent_rpcs.respond_to? :cancel_tuning_job
747
+ @cancel_tuning_job = ::Gapic::Config::Method.new cancel_tuning_job_config
748
+
749
+ yield self if block_given?
750
+ end
751
+ end
752
+ end
753
+ end
754
+ end
755
+ end
756
+ end
757
+ end
758
+ end