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