google-cloud-ai_platform-v1 0.58.0 → 0.59.0

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