google-cloud-discovery_engine-v1beta 0.12.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/operations.rb +14 -0
  3. data/lib/google/cloud/discovery_engine/v1beta/data_store_service/rest/operations.rb +14 -0
  4. data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +14 -0
  5. data/lib/google/cloud/discovery_engine/v1beta/engine_service/rest/operations.rb +14 -0
  6. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/client.rb +824 -0
  7. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/credentials.rb +47 -0
  8. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/operations.rb +809 -0
  9. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/paths.rb +250 -0
  10. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/client.rb +770 -0
  11. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/operations.rb +1106 -0
  12. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest/service_stub.rb +306 -0
  13. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service/rest.rb +54 -0
  14. data/lib/google/cloud/discovery_engine/v1beta/evaluation_service.rb +57 -0
  15. data/lib/google/cloud/discovery_engine/v1beta/project_service/rest/operations.rb +14 -0
  16. data/lib/google/cloud/discovery_engine/v1beta/rest.rb +3 -0
  17. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/client.rb +1035 -0
  18. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/credentials.rb +47 -0
  19. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/operations.rb +809 -0
  20. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/paths.rb +73 -0
  21. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/client.rb +967 -0
  22. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/operations.rb +1106 -0
  23. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest/service_stub.rb +426 -0
  24. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service/rest.rb +54 -0
  25. data/lib/google/cloud/discovery_engine/v1beta/sample_query_service.rb +57 -0
  26. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/client.rb +911 -0
  27. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/credentials.rb +47 -0
  28. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/paths.rb +69 -0
  29. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/client.rb +850 -0
  30. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest/service_stub.rb +366 -0
  31. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service/rest.rb +53 -0
  32. data/lib/google/cloud/discovery_engine/v1beta/sample_query_set_service.rb +56 -0
  33. data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +14 -0
  34. data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +10 -4
  35. data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +10 -4
  36. data/lib/google/cloud/discovery_engine/v1beta/search_tuning_service/rest/operations.rb +14 -0
  37. data/lib/google/cloud/discovery_engine/v1beta/site_search_engine_service/rest/operations.rb +14 -0
  38. data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +14 -0
  39. data/lib/google/cloud/discovery_engine/v1beta/version.rb +1 -1
  40. data/lib/google/cloud/discovery_engine/v1beta.rb +3 -0
  41. data/lib/google/cloud/discoveryengine/v1beta/chunk_pb.rb +50 -0
  42. data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +1 -1
  43. data/lib/google/cloud/discoveryengine/v1beta/conversational_search_service_pb.rb +1 -1
  44. data/lib/google/cloud/discoveryengine/v1beta/document_processing_config_pb.rb +4 -1
  45. data/lib/google/cloud/discoveryengine/v1beta/evaluation_pb.rb +56 -0
  46. data/lib/google/cloud/discoveryengine/v1beta/evaluation_service_pb.rb +59 -0
  47. data/lib/google/cloud/discoveryengine/v1beta/evaluation_service_services_pb.rb +57 -0
  48. data/lib/google/cloud/discoveryengine/v1beta/import_config_pb.rb +7 -1
  49. data/lib/google/cloud/discoveryengine/v1beta/sample_query_pb.rb +49 -0
  50. data/lib/google/cloud/discoveryengine/v1beta/sample_query_service_pb.rb +59 -0
  51. data/lib/google/cloud/discoveryengine/v1beta/sample_query_service_services_pb.rb +63 -0
  52. data/lib/google/cloud/discoveryengine/v1beta/sample_query_set_pb.rb +47 -0
  53. data/lib/google/cloud/discoveryengine/v1beta/sample_query_set_service_pb.rb +57 -0
  54. data/lib/google/cloud/discoveryengine/v1beta/sample_query_set_service_services_pb.rb +59 -0
  55. data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +5 -1
  56. data/proto_docs/google/api/client.rb +14 -10
  57. data/proto_docs/google/api/resource.rb +7 -2
  58. data/proto_docs/google/cloud/discoveryengine/v1beta/chunk.rb +119 -0
  59. data/proto_docs/google/cloud/discoveryengine/v1beta/conversational_search_service.rb +10 -2
  60. data/proto_docs/google/cloud/discoveryengine/v1beta/document.rb +1 -1
  61. data/proto_docs/google/cloud/discoveryengine/v1beta/document_processing_config.rb +43 -2
  62. data/proto_docs/google/cloud/discoveryengine/v1beta/evaluation.rb +223 -0
  63. data/proto_docs/google/cloud/discoveryengine/v1beta/evaluation_service.rb +194 -0
  64. data/proto_docs/google/cloud/discoveryengine/v1beta/import_config.rb +85 -0
  65. data/proto_docs/google/cloud/discoveryengine/v1beta/sample_query.rb +82 -0
  66. data/proto_docs/google/cloud/discoveryengine/v1beta/sample_query_service.rb +179 -0
  67. data/proto_docs/google/cloud/discoveryengine/v1beta/sample_query_set.rb +57 -0
  68. data/proto_docs/google/cloud/discoveryengine/v1beta/sample_query_set_service.rb +186 -0
  69. data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +69 -8
  70. data/proto_docs/google/cloud/discoveryengine/v1beta/serving_config.rb +11 -5
  71. metadata +44 -2
@@ -0,0 +1,770 @@
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/discoveryengine/v1beta/evaluation_service_pb"
21
+ require "google/cloud/discovery_engine/v1beta/evaluation_service/rest/service_stub"
22
+ require "google/cloud/location/rest"
23
+
24
+ module Google
25
+ module Cloud
26
+ module DiscoveryEngine
27
+ module V1beta
28
+ module EvaluationService
29
+ module Rest
30
+ ##
31
+ # REST client for the EvaluationService service.
32
+ #
33
+ # Service for managing
34
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Evaluation Evaluation}s,
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "discoveryengine.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :evaluation_service_stub
47
+
48
+ ##
49
+ # Configure the EvaluationService Client class.
50
+ #
51
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all EvaluationService clients
57
+ # ::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1beta"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config.timeout = 30.0
78
+ default_config.retry_policy = {
79
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
80
+ }
81
+
82
+ default_config.rpcs.create_evaluation.timeout = 300.0
83
+
84
+ default_config
85
+ end
86
+ yield @configure if block_given?
87
+ @configure
88
+ end
89
+
90
+ ##
91
+ # Configure the EvaluationService Client instance.
92
+ #
93
+ # The configuration is set to the derived mode, meaning that values can be changed,
94
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
95
+ # should be made on {Client.configure}.
96
+ #
97
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client::Configuration}
98
+ # for a description of the configuration fields.
99
+ #
100
+ # @yield [config] Configure the Client client.
101
+ # @yieldparam config [Client::Configuration]
102
+ #
103
+ # @return [Client::Configuration]
104
+ #
105
+ def configure
106
+ yield @config if block_given?
107
+ @config
108
+ end
109
+
110
+ ##
111
+ # The effective universe domain
112
+ #
113
+ # @return [String]
114
+ #
115
+ def universe_domain
116
+ @evaluation_service_stub.universe_domain
117
+ end
118
+
119
+ ##
120
+ # Create a new EvaluationService REST client object.
121
+ #
122
+ # @example
123
+ #
124
+ # # Create a client using the default configuration
125
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client.new
126
+ #
127
+ # # Create a client using a custom configuration
128
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client.new do |config|
129
+ # config.timeout = 10.0
130
+ # end
131
+ #
132
+ # @yield [config] Configure the EvaluationService client.
133
+ # @yieldparam config [Client::Configuration]
134
+ #
135
+ def initialize
136
+ # Create the configuration object
137
+ @config = Configuration.new Client.configure
138
+
139
+ # Yield the configuration if needed
140
+ yield @config if block_given?
141
+
142
+ # Create credentials
143
+ credentials = @config.credentials
144
+ # Use self-signed JWT if the endpoint is unchanged from default,
145
+ # but only if the default endpoint does not have a region prefix.
146
+ enable_self_signed_jwt = @config.endpoint.nil? ||
147
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
148
+ !@config.endpoint.split(".").first.include?("-"))
149
+ credentials ||= Credentials.default scope: @config.scope,
150
+ enable_self_signed_jwt: enable_self_signed_jwt
151
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
152
+ credentials = Credentials.new credentials, scope: @config.scope
153
+ end
154
+
155
+ @quota_project_id = @config.quota_project
156
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
157
+
158
+ @operations_client = ::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Operations.new do |config|
159
+ config.credentials = credentials
160
+ config.quota_project = @quota_project_id
161
+ config.endpoint = @config.endpoint
162
+ config.universe_domain = @config.universe_domain
163
+ end
164
+
165
+ @evaluation_service_stub = ::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::ServiceStub.new(
166
+ endpoint: @config.endpoint,
167
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
168
+ universe_domain: @config.universe_domain,
169
+ credentials: credentials
170
+ )
171
+
172
+ @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
173
+ config.credentials = credentials
174
+ config.quota_project = @quota_project_id
175
+ config.endpoint = @evaluation_service_stub.endpoint
176
+ config.universe_domain = @evaluation_service_stub.universe_domain
177
+ end
178
+ end
179
+
180
+ ##
181
+ # Get the associated client for long-running operations.
182
+ #
183
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Operations]
184
+ #
185
+ attr_reader :operations_client
186
+
187
+ ##
188
+ # Get the associated client for mix-in of the Locations.
189
+ #
190
+ # @return [Google::Cloud::Location::Locations::Rest::Client]
191
+ #
192
+ attr_reader :location_client
193
+
194
+ # Service calls
195
+
196
+ ##
197
+ # Gets a {::Google::Cloud::DiscoveryEngine::V1beta::Evaluation Evaluation}.
198
+ #
199
+ # @overload get_evaluation(request, options = nil)
200
+ # Pass arguments to `get_evaluation` via a request object, either of type
201
+ # {::Google::Cloud::DiscoveryEngine::V1beta::GetEvaluationRequest} or an equivalent Hash.
202
+ #
203
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::GetEvaluationRequest, ::Hash]
204
+ # A request object representing the call parameters. Required. To specify no
205
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
206
+ # @param options [::Gapic::CallOptions, ::Hash]
207
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
208
+ #
209
+ # @overload get_evaluation(name: nil)
210
+ # Pass arguments to `get_evaluation` via keyword arguments. Note that at
211
+ # least one keyword argument is required. To specify no parameters, or to keep all
212
+ # the default parameter values, pass an empty Hash as a request object (see above).
213
+ #
214
+ # @param name [::String]
215
+ # Required. Full resource name of
216
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Evaluation Evaluation}, such as
217
+ # `projects/{project}/locations/{location}/evaluations/{evaluation}`.
218
+ #
219
+ # If the caller does not have permission to access the
220
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Evaluation Evaluation}, regardless of
221
+ # whether or not it exists, a PERMISSION_DENIED error is returned.
222
+ #
223
+ # If the requested
224
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Evaluation Evaluation} does not
225
+ # exist, a NOT_FOUND error is returned.
226
+ # @yield [result, operation] Access the result along with the TransportOperation object
227
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Evaluation]
228
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
229
+ #
230
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::Evaluation]
231
+ #
232
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
233
+ #
234
+ # @example Basic example
235
+ # require "google/cloud/discovery_engine/v1beta"
236
+ #
237
+ # # Create a client object. The client can be reused for multiple calls.
238
+ # client = Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client.new
239
+ #
240
+ # # Create a request. To set request fields, pass in keyword arguments.
241
+ # request = Google::Cloud::DiscoveryEngine::V1beta::GetEvaluationRequest.new
242
+ #
243
+ # # Call the get_evaluation method.
244
+ # result = client.get_evaluation request
245
+ #
246
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::Evaluation.
247
+ # p result
248
+ #
249
+ def get_evaluation request, options = nil
250
+ raise ::ArgumentError, "request must be provided" if request.nil?
251
+
252
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::GetEvaluationRequest
253
+
254
+ # Converts hash and nil to an options object
255
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
256
+
257
+ # Customize the options with defaults
258
+ call_metadata = @config.rpcs.get_evaluation.metadata.to_h
259
+
260
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
261
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
262
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
263
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
264
+ transports_version_send: [:rest]
265
+
266
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
267
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
268
+
269
+ options.apply_defaults timeout: @config.rpcs.get_evaluation.timeout,
270
+ metadata: call_metadata,
271
+ retry_policy: @config.rpcs.get_evaluation.retry_policy
272
+
273
+ options.apply_defaults timeout: @config.timeout,
274
+ metadata: @config.metadata,
275
+ retry_policy: @config.retry_policy
276
+
277
+ @evaluation_service_stub.get_evaluation request, options do |result, operation|
278
+ yield result, operation if block_given?
279
+ return result
280
+ end
281
+ rescue ::Gapic::Rest::Error => e
282
+ raise ::Google::Cloud::Error.from_error(e)
283
+ end
284
+
285
+ ##
286
+ # Gets a list of
287
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Evaluation Evaluation}s.
288
+ #
289
+ # @overload list_evaluations(request, options = nil)
290
+ # Pass arguments to `list_evaluations` via a request object, either of type
291
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationsRequest} or an equivalent Hash.
292
+ #
293
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationsRequest, ::Hash]
294
+ # A request object representing the call parameters. Required. To specify no
295
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
296
+ # @param options [::Gapic::CallOptions, ::Hash]
297
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
298
+ #
299
+ # @overload list_evaluations(parent: nil, page_size: nil, page_token: nil)
300
+ # Pass arguments to `list_evaluations` via keyword arguments. Note that at
301
+ # least one keyword argument is required. To specify no parameters, or to keep all
302
+ # the default parameter values, pass an empty Hash as a request object (see above).
303
+ #
304
+ # @param parent [::String]
305
+ # Required. The parent location resource name, such as
306
+ # `projects/{project}/locations/{location}`.
307
+ #
308
+ # If the caller does not have permission to list
309
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Evaluation Evaluation}s under this
310
+ # location, regardless of whether or not this location exists, a
311
+ # `PERMISSION_DENIED` error is returned.
312
+ # @param page_size [::Integer]
313
+ # Maximum number of
314
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Evaluation Evaluation}s to return. If
315
+ # unspecified, defaults to 100. The maximum allowed value is 1000. Values
316
+ # above 1000 will be coerced to 1000.
317
+ #
318
+ # If this field is negative, an `INVALID_ARGUMENT` error is returned.
319
+ # @param page_token [::String]
320
+ # A page token
321
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationsResponse#next_page_token ListEvaluationsResponse.next_page_token},
322
+ # received from a previous
323
+ # {::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client#list_evaluations EvaluationService.ListEvaluations}
324
+ # call. Provide this to retrieve the subsequent page.
325
+ #
326
+ # When paginating, all other parameters provided to
327
+ # {::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client#list_evaluations EvaluationService.ListEvaluations}
328
+ # must match the call that provided the page token. Otherwise, an
329
+ # `INVALID_ARGUMENT` error is returned.
330
+ # @yield [result, operation] Access the result along with the TransportOperation object
331
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Evaluation>]
332
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
333
+ #
334
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Evaluation>]
335
+ #
336
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
337
+ #
338
+ # @example Basic example
339
+ # require "google/cloud/discovery_engine/v1beta"
340
+ #
341
+ # # Create a client object. The client can be reused for multiple calls.
342
+ # client = Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client.new
343
+ #
344
+ # # Create a request. To set request fields, pass in keyword arguments.
345
+ # request = Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationsRequest.new
346
+ #
347
+ # # Call the list_evaluations method.
348
+ # result = client.list_evaluations request
349
+ #
350
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
351
+ # # over elements, and API calls will be issued to fetch pages as needed.
352
+ # result.each do |item|
353
+ # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1beta::Evaluation.
354
+ # p item
355
+ # end
356
+ #
357
+ def list_evaluations request, options = nil
358
+ raise ::ArgumentError, "request must be provided" if request.nil?
359
+
360
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationsRequest
361
+
362
+ # Converts hash and nil to an options object
363
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
364
+
365
+ # Customize the options with defaults
366
+ call_metadata = @config.rpcs.list_evaluations.metadata.to_h
367
+
368
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
369
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
370
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
371
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
372
+ transports_version_send: [:rest]
373
+
374
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
375
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
376
+
377
+ options.apply_defaults timeout: @config.rpcs.list_evaluations.timeout,
378
+ metadata: call_metadata,
379
+ retry_policy: @config.rpcs.list_evaluations.retry_policy
380
+
381
+ options.apply_defaults timeout: @config.timeout,
382
+ metadata: @config.metadata,
383
+ retry_policy: @config.retry_policy
384
+
385
+ @evaluation_service_stub.list_evaluations request, options do |result, operation|
386
+ result = ::Gapic::Rest::PagedEnumerable.new @evaluation_service_stub, :list_evaluations, "evaluations", request, result, options
387
+ yield result, operation if block_given?
388
+ return result
389
+ end
390
+ rescue ::Gapic::Rest::Error => e
391
+ raise ::Google::Cloud::Error.from_error(e)
392
+ end
393
+
394
+ ##
395
+ # Creates a {::Google::Cloud::DiscoveryEngine::V1beta::Evaluation Evaluation}.
396
+ #
397
+ # Upon creation, the evaluation will be automatically triggered and begin
398
+ # execution.
399
+ #
400
+ # @overload create_evaluation(request, options = nil)
401
+ # Pass arguments to `create_evaluation` via a request object, either of type
402
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CreateEvaluationRequest} or an equivalent Hash.
403
+ #
404
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::CreateEvaluationRequest, ::Hash]
405
+ # A request object representing the call parameters. Required. To specify no
406
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
407
+ # @param options [::Gapic::CallOptions, ::Hash]
408
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
409
+ #
410
+ # @overload create_evaluation(parent: nil, evaluation: nil)
411
+ # Pass arguments to `create_evaluation` via keyword arguments. Note that at
412
+ # least one keyword argument is required. To specify no parameters, or to keep all
413
+ # the default parameter values, pass an empty Hash as a request object (see above).
414
+ #
415
+ # @param parent [::String]
416
+ # Required. The parent resource name, such as
417
+ # `projects/{project}/locations/{location}`.
418
+ # @param evaluation [::Google::Cloud::DiscoveryEngine::V1beta::Evaluation, ::Hash]
419
+ # Required. The {::Google::Cloud::DiscoveryEngine::V1beta::Evaluation Evaluation}
420
+ # to create.
421
+ # @yield [result, operation] Access the result along with the TransportOperation object
422
+ # @yieldparam result [::Gapic::Operation]
423
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
424
+ #
425
+ # @return [::Gapic::Operation]
426
+ #
427
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
428
+ #
429
+ # @example Basic example
430
+ # require "google/cloud/discovery_engine/v1beta"
431
+ #
432
+ # # Create a client object. The client can be reused for multiple calls.
433
+ # client = Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client.new
434
+ #
435
+ # # Create a request. To set request fields, pass in keyword arguments.
436
+ # request = Google::Cloud::DiscoveryEngine::V1beta::CreateEvaluationRequest.new
437
+ #
438
+ # # Call the create_evaluation method.
439
+ # result = client.create_evaluation request
440
+ #
441
+ # # The returned object is of type Gapic::Operation. You can use it to
442
+ # # check the status of an operation, cancel it, or wait for results.
443
+ # # Here is how to wait for a response.
444
+ # result.wait_until_done! timeout: 60
445
+ # if result.response?
446
+ # p result.response
447
+ # else
448
+ # puts "No response received."
449
+ # end
450
+ #
451
+ def create_evaluation request, options = nil
452
+ raise ::ArgumentError, "request must be provided" if request.nil?
453
+
454
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::CreateEvaluationRequest
455
+
456
+ # Converts hash and nil to an options object
457
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
458
+
459
+ # Customize the options with defaults
460
+ call_metadata = @config.rpcs.create_evaluation.metadata.to_h
461
+
462
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
463
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
464
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
465
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
466
+ transports_version_send: [:rest]
467
+
468
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
469
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
470
+
471
+ options.apply_defaults timeout: @config.rpcs.create_evaluation.timeout,
472
+ metadata: call_metadata,
473
+ retry_policy: @config.rpcs.create_evaluation.retry_policy
474
+
475
+ options.apply_defaults timeout: @config.timeout,
476
+ metadata: @config.metadata,
477
+ retry_policy: @config.retry_policy
478
+
479
+ @evaluation_service_stub.create_evaluation request, options do |result, operation|
480
+ result = ::Gapic::Operation.new result, @operations_client, options: options
481
+ yield result, operation if block_given?
482
+ return result
483
+ end
484
+ rescue ::Gapic::Rest::Error => e
485
+ raise ::Google::Cloud::Error.from_error(e)
486
+ end
487
+
488
+ ##
489
+ # Gets a list of results for a given a
490
+ # {::Google::Cloud::DiscoveryEngine::V1beta::Evaluation Evaluation}.
491
+ #
492
+ # @overload list_evaluation_results(request, options = nil)
493
+ # Pass arguments to `list_evaluation_results` via a request object, either of type
494
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationResultsRequest} or an equivalent Hash.
495
+ #
496
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationResultsRequest, ::Hash]
497
+ # A request object representing the call parameters. Required. To specify no
498
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
499
+ # @param options [::Gapic::CallOptions, ::Hash]
500
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
501
+ #
502
+ # @overload list_evaluation_results(evaluation: nil, page_size: nil, page_token: nil)
503
+ # Pass arguments to `list_evaluation_results` via keyword arguments. Note that at
504
+ # least one keyword argument is required. To specify no parameters, or to keep all
505
+ # the default parameter values, pass an empty Hash as a request object (see above).
506
+ #
507
+ # @param evaluation [::String]
508
+ # Required. The evaluation resource name, such as
509
+ # `projects/{project}/locations/{location}/evaluations/{evaluation}`.
510
+ #
511
+ # If the caller does not have permission to list [EvaluationResult][]
512
+ # under this evaluation, regardless of whether or not this evaluation
513
+ # set exists, a `PERMISSION_DENIED` error is returned.
514
+ # @param page_size [::Integer]
515
+ # Maximum number of [EvaluationResult][] to return. If unspecified,
516
+ # defaults to 100. The maximum allowed value is 1000. Values above 1000 will
517
+ # be coerced to 1000.
518
+ #
519
+ # If this field is negative, an `INVALID_ARGUMENT` error is returned.
520
+ # @param page_token [::String]
521
+ # A page token
522
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationResultsResponse#next_page_token ListEvaluationResultsResponse.next_page_token},
523
+ # received from a previous
524
+ # {::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client#list_evaluation_results EvaluationService.ListEvaluationResults}
525
+ # call. Provide this to retrieve the subsequent page.
526
+ #
527
+ # When paginating, all other parameters provided to
528
+ # {::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client#list_evaluation_results EvaluationService.ListEvaluationResults}
529
+ # must match the call that provided the page token. Otherwise, an
530
+ # `INVALID_ARGUMENT` error is returned.
531
+ # @yield [result, operation] Access the result along with the TransportOperation object
532
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationResultsResponse::EvaluationResult>]
533
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
534
+ #
535
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationResultsResponse::EvaluationResult>]
536
+ #
537
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
538
+ #
539
+ # @example Basic example
540
+ # require "google/cloud/discovery_engine/v1beta"
541
+ #
542
+ # # Create a client object. The client can be reused for multiple calls.
543
+ # client = Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client.new
544
+ #
545
+ # # Create a request. To set request fields, pass in keyword arguments.
546
+ # request = Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationResultsRequest.new
547
+ #
548
+ # # Call the list_evaluation_results method.
549
+ # result = client.list_evaluation_results request
550
+ #
551
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
552
+ # # over elements, and API calls will be issued to fetch pages as needed.
553
+ # result.each do |item|
554
+ # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationResultsResponse::EvaluationResult.
555
+ # p item
556
+ # end
557
+ #
558
+ def list_evaluation_results request, options = nil
559
+ raise ::ArgumentError, "request must be provided" if request.nil?
560
+
561
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ListEvaluationResultsRequest
562
+
563
+ # Converts hash and nil to an options object
564
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
565
+
566
+ # Customize the options with defaults
567
+ call_metadata = @config.rpcs.list_evaluation_results.metadata.to_h
568
+
569
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
570
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
571
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
572
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
573
+ transports_version_send: [:rest]
574
+
575
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
576
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
577
+
578
+ options.apply_defaults timeout: @config.rpcs.list_evaluation_results.timeout,
579
+ metadata: call_metadata,
580
+ retry_policy: @config.rpcs.list_evaluation_results.retry_policy
581
+
582
+ options.apply_defaults timeout: @config.timeout,
583
+ metadata: @config.metadata,
584
+ retry_policy: @config.retry_policy
585
+
586
+ @evaluation_service_stub.list_evaluation_results request, options do |result, operation|
587
+ result = ::Gapic::Rest::PagedEnumerable.new @evaluation_service_stub, :list_evaluation_results, "evaluation_results", request, result, options
588
+ yield result, operation if block_given?
589
+ return result
590
+ end
591
+ rescue ::Gapic::Rest::Error => e
592
+ raise ::Google::Cloud::Error.from_error(e)
593
+ end
594
+
595
+ ##
596
+ # Configuration class for the EvaluationService REST API.
597
+ #
598
+ # This class represents the configuration for EvaluationService REST,
599
+ # providing control over timeouts, retry behavior, logging, transport
600
+ # parameters, and other low-level controls. Certain parameters can also be
601
+ # applied individually to specific RPCs. See
602
+ # {::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client::Configuration::Rpcs}
603
+ # for a list of RPCs that can be configured independently.
604
+ #
605
+ # Configuration can be applied globally to all clients, or to a single client
606
+ # on construction.
607
+ #
608
+ # @example
609
+ #
610
+ # # Modify the global config, setting the timeout for
611
+ # # get_evaluation to 20 seconds,
612
+ # # and all remaining timeouts to 10 seconds.
613
+ # ::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client.configure do |config|
614
+ # config.timeout = 10.0
615
+ # config.rpcs.get_evaluation.timeout = 20.0
616
+ # end
617
+ #
618
+ # # Apply the above configuration only to a new client.
619
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::EvaluationService::Rest::Client.new do |config|
620
+ # config.timeout = 10.0
621
+ # config.rpcs.get_evaluation.timeout = 20.0
622
+ # end
623
+ #
624
+ # @!attribute [rw] endpoint
625
+ # A custom service endpoint, as a hostname or hostname:port. The default is
626
+ # nil, indicating to use the default endpoint in the current universe domain.
627
+ # @return [::String,nil]
628
+ # @!attribute [rw] credentials
629
+ # Credentials to send with calls. You may provide any of the following types:
630
+ # * (`String`) The path to a service account key file in JSON format
631
+ # * (`Hash`) A service account key as a Hash
632
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
633
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
634
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
635
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
636
+ # * (`nil`) indicating no credentials
637
+ # @return [::Object]
638
+ # @!attribute [rw] scope
639
+ # The OAuth scopes
640
+ # @return [::Array<::String>]
641
+ # @!attribute [rw] lib_name
642
+ # The library name as recorded in instrumentation and logging
643
+ # @return [::String]
644
+ # @!attribute [rw] lib_version
645
+ # The library version as recorded in instrumentation and logging
646
+ # @return [::String]
647
+ # @!attribute [rw] timeout
648
+ # The call timeout in seconds.
649
+ # @return [::Numeric]
650
+ # @!attribute [rw] metadata
651
+ # Additional headers to be sent with the call.
652
+ # @return [::Hash{::Symbol=>::String}]
653
+ # @!attribute [rw] retry_policy
654
+ # The retry policy. The value is a hash with the following keys:
655
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
656
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
657
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
658
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
659
+ # trigger a retry.
660
+ # @return [::Hash]
661
+ # @!attribute [rw] quota_project
662
+ # A separate project against which to charge quota.
663
+ # @return [::String]
664
+ # @!attribute [rw] universe_domain
665
+ # The universe domain within which to make requests. This determines the
666
+ # default endpoint URL. The default value of nil uses the environment
667
+ # universe (usually the default "googleapis.com" universe).
668
+ # @return [::String,nil]
669
+ #
670
+ class Configuration
671
+ extend ::Gapic::Config
672
+
673
+ # @private
674
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
675
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
676
+
677
+ config_attr :endpoint, nil, ::String, nil
678
+ config_attr :credentials, nil do |value|
679
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
680
+ allowed.any? { |klass| klass === value }
681
+ end
682
+ config_attr :scope, nil, ::String, ::Array, nil
683
+ config_attr :lib_name, nil, ::String, nil
684
+ config_attr :lib_version, nil, ::String, nil
685
+ config_attr :timeout, nil, ::Numeric, nil
686
+ config_attr :metadata, nil, ::Hash, nil
687
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
688
+ config_attr :quota_project, nil, ::String, nil
689
+ config_attr :universe_domain, nil, ::String, nil
690
+
691
+ # @private
692
+ def initialize parent_config = nil
693
+ @parent_config = parent_config unless parent_config.nil?
694
+
695
+ yield self if block_given?
696
+ end
697
+
698
+ ##
699
+ # Configurations for individual RPCs
700
+ # @return [Rpcs]
701
+ #
702
+ def rpcs
703
+ @rpcs ||= begin
704
+ parent_rpcs = nil
705
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
706
+ Rpcs.new parent_rpcs
707
+ end
708
+ end
709
+
710
+ ##
711
+ # Configuration RPC class for the EvaluationService API.
712
+ #
713
+ # Includes fields providing the configuration for each RPC in this service.
714
+ # Each configuration object is of type `Gapic::Config::Method` and includes
715
+ # the following configuration fields:
716
+ #
717
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
718
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
719
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
720
+ # include the following keys:
721
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
722
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
723
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
724
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
725
+ # trigger a retry.
726
+ #
727
+ class Rpcs
728
+ ##
729
+ # RPC-specific configuration for `get_evaluation`
730
+ # @return [::Gapic::Config::Method]
731
+ #
732
+ attr_reader :get_evaluation
733
+ ##
734
+ # RPC-specific configuration for `list_evaluations`
735
+ # @return [::Gapic::Config::Method]
736
+ #
737
+ attr_reader :list_evaluations
738
+ ##
739
+ # RPC-specific configuration for `create_evaluation`
740
+ # @return [::Gapic::Config::Method]
741
+ #
742
+ attr_reader :create_evaluation
743
+ ##
744
+ # RPC-specific configuration for `list_evaluation_results`
745
+ # @return [::Gapic::Config::Method]
746
+ #
747
+ attr_reader :list_evaluation_results
748
+
749
+ # @private
750
+ def initialize parent_rpcs = nil
751
+ get_evaluation_config = parent_rpcs.get_evaluation if parent_rpcs.respond_to? :get_evaluation
752
+ @get_evaluation = ::Gapic::Config::Method.new get_evaluation_config
753
+ list_evaluations_config = parent_rpcs.list_evaluations if parent_rpcs.respond_to? :list_evaluations
754
+ @list_evaluations = ::Gapic::Config::Method.new list_evaluations_config
755
+ create_evaluation_config = parent_rpcs.create_evaluation if parent_rpcs.respond_to? :create_evaluation
756
+ @create_evaluation = ::Gapic::Config::Method.new create_evaluation_config
757
+ list_evaluation_results_config = parent_rpcs.list_evaluation_results if parent_rpcs.respond_to? :list_evaluation_results
758
+ @list_evaluation_results = ::Gapic::Config::Method.new list_evaluation_results_config
759
+
760
+ yield self if block_given?
761
+ end
762
+ end
763
+ end
764
+ end
765
+ end
766
+ end
767
+ end
768
+ end
769
+ end
770
+ end