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,1035 @@
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/sample_query_service_pb"
21
+ require "google/cloud/location"
22
+
23
+ module Google
24
+ module Cloud
25
+ module DiscoveryEngine
26
+ module V1beta
27
+ module SampleQueryService
28
+ ##
29
+ # Client for the SampleQueryService service.
30
+ #
31
+ # Service for managing
32
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}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 :sample_query_service_stub
45
+
46
+ ##
47
+ # Configure the SampleQueryService Client class.
48
+ #
49
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all SampleQueryService clients
55
+ # ::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::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
81
+ end
82
+ yield @configure if block_given?
83
+ @configure
84
+ end
85
+
86
+ ##
87
+ # Configure the SampleQueryService Client instance.
88
+ #
89
+ # The configuration is set to the derived mode, meaning that values can be changed,
90
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
91
+ # should be made on {Client.configure}.
92
+ #
93
+ # See {::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client::Configuration}
94
+ # for a description of the configuration fields.
95
+ #
96
+ # @yield [config] Configure the Client client.
97
+ # @yieldparam config [Client::Configuration]
98
+ #
99
+ # @return [Client::Configuration]
100
+ #
101
+ def configure
102
+ yield @config if block_given?
103
+ @config
104
+ end
105
+
106
+ ##
107
+ # The effective universe domain
108
+ #
109
+ # @return [String]
110
+ #
111
+ def universe_domain
112
+ @sample_query_service_stub.universe_domain
113
+ end
114
+
115
+ ##
116
+ # Create a new SampleQueryService client object.
117
+ #
118
+ # @example
119
+ #
120
+ # # Create a client using the default configuration
121
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new
122
+ #
123
+ # # Create a client using a custom configuration
124
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new do |config|
125
+ # config.timeout = 10.0
126
+ # end
127
+ #
128
+ # @yield [config] Configure the SampleQueryService client.
129
+ # @yieldparam config [Client::Configuration]
130
+ #
131
+ def initialize
132
+ # These require statements are intentionally placed here to initialize
133
+ # the gRPC module only when it's required.
134
+ # See https://github.com/googleapis/toolkit/issues/446
135
+ require "gapic/grpc"
136
+ require "google/cloud/discoveryengine/v1beta/sample_query_service_services_pb"
137
+
138
+ # Create the configuration object
139
+ @config = Configuration.new Client.configure
140
+
141
+ # Yield the configuration if needed
142
+ yield @config if block_given?
143
+
144
+ # Create credentials
145
+ credentials = @config.credentials
146
+ # Use self-signed JWT if the endpoint is unchanged from default,
147
+ # but only if the default endpoint does not have a region prefix.
148
+ enable_self_signed_jwt = @config.endpoint.nil? ||
149
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
150
+ !@config.endpoint.split(".").first.include?("-"))
151
+ credentials ||= Credentials.default scope: @config.scope,
152
+ enable_self_signed_jwt: enable_self_signed_jwt
153
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
154
+ credentials = Credentials.new credentials, scope: @config.scope
155
+ end
156
+ @quota_project_id = @config.quota_project
157
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
158
+
159
+ @operations_client = Operations.new do |config|
160
+ config.credentials = credentials
161
+ config.quota_project = @quota_project_id
162
+ config.endpoint = @config.endpoint
163
+ config.universe_domain = @config.universe_domain
164
+ end
165
+
166
+ @sample_query_service_stub = ::Gapic::ServiceStub.new(
167
+ ::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Stub,
168
+ credentials: credentials,
169
+ endpoint: @config.endpoint,
170
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
171
+ universe_domain: @config.universe_domain,
172
+ channel_args: @config.channel_args,
173
+ interceptors: @config.interceptors,
174
+ channel_pool_config: @config.channel_pool
175
+ )
176
+
177
+ @location_client = Google::Cloud::Location::Locations::Client.new do |config|
178
+ config.credentials = credentials
179
+ config.quota_project = @quota_project_id
180
+ config.endpoint = @sample_query_service_stub.endpoint
181
+ config.universe_domain = @sample_query_service_stub.universe_domain
182
+ end
183
+ end
184
+
185
+ ##
186
+ # Get the associated client for long-running operations.
187
+ #
188
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Operations]
189
+ #
190
+ attr_reader :operations_client
191
+
192
+ ##
193
+ # Get the associated client for mix-in of the Locations.
194
+ #
195
+ # @return [Google::Cloud::Location::Locations::Client]
196
+ #
197
+ attr_reader :location_client
198
+
199
+ # Service calls
200
+
201
+ ##
202
+ # Gets a {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}.
203
+ #
204
+ # @overload get_sample_query(request, options = nil)
205
+ # Pass arguments to `get_sample_query` via a request object, either of type
206
+ # {::Google::Cloud::DiscoveryEngine::V1beta::GetSampleQueryRequest} or an equivalent Hash.
207
+ #
208
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::GetSampleQueryRequest, ::Hash]
209
+ # A request object representing the call parameters. Required. To specify no
210
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
211
+ # @param options [::Gapic::CallOptions, ::Hash]
212
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
213
+ #
214
+ # @overload get_sample_query(name: nil)
215
+ # Pass arguments to `get_sample_query` via keyword arguments. Note that at
216
+ # least one keyword argument is required. To specify no parameters, or to keep all
217
+ # the default parameter values, pass an empty Hash as a request object (see above).
218
+ #
219
+ # @param name [::String]
220
+ # Required. Full resource name of
221
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}, such as
222
+ # `projects/{project}/locations/{location}/sampleQuerySets/{sample_query_set}/sampleQueries/{sample_query}`.
223
+ #
224
+ # If the caller does not have permission to access the
225
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}, regardless
226
+ # of whether or not it exists, a PERMISSION_DENIED error is returned.
227
+ #
228
+ # If the requested
229
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery} does not
230
+ # exist, a NOT_FOUND error is returned.
231
+ #
232
+ # @yield [response, operation] Access the result along with the RPC operation
233
+ # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery]
234
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
235
+ #
236
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery]
237
+ #
238
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
239
+ #
240
+ # @example Basic example
241
+ # require "google/cloud/discovery_engine/v1beta"
242
+ #
243
+ # # Create a client object. The client can be reused for multiple calls.
244
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new
245
+ #
246
+ # # Create a request. To set request fields, pass in keyword arguments.
247
+ # request = Google::Cloud::DiscoveryEngine::V1beta::GetSampleQueryRequest.new
248
+ #
249
+ # # Call the get_sample_query method.
250
+ # result = client.get_sample_query request
251
+ #
252
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::SampleQuery.
253
+ # p result
254
+ #
255
+ def get_sample_query request, options = nil
256
+ raise ::ArgumentError, "request must be provided" if request.nil?
257
+
258
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::GetSampleQueryRequest
259
+
260
+ # Converts hash and nil to an options object
261
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
262
+
263
+ # Customize the options with defaults
264
+ metadata = @config.rpcs.get_sample_query.metadata.to_h
265
+
266
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
267
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
268
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
269
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
270
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
271
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
272
+
273
+ header_params = {}
274
+ if request.name
275
+ header_params["name"] = request.name
276
+ end
277
+
278
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
279
+ metadata[:"x-goog-request-params"] ||= request_params_header
280
+
281
+ options.apply_defaults timeout: @config.rpcs.get_sample_query.timeout,
282
+ metadata: metadata,
283
+ retry_policy: @config.rpcs.get_sample_query.retry_policy
284
+
285
+ options.apply_defaults timeout: @config.timeout,
286
+ metadata: @config.metadata,
287
+ retry_policy: @config.retry_policy
288
+
289
+ @sample_query_service_stub.call_rpc :get_sample_query, request, options: options do |response, operation|
290
+ yield response, operation if block_given?
291
+ return response
292
+ end
293
+ rescue ::GRPC::BadStatus => e
294
+ raise ::Google::Cloud::Error.from_error(e)
295
+ end
296
+
297
+ ##
298
+ # Gets a list of
299
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}s.
300
+ #
301
+ # @overload list_sample_queries(request, options = nil)
302
+ # Pass arguments to `list_sample_queries` via a request object, either of type
303
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ListSampleQueriesRequest} or an equivalent Hash.
304
+ #
305
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::ListSampleQueriesRequest, ::Hash]
306
+ # A request object representing the call parameters. Required. To specify no
307
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
308
+ # @param options [::Gapic::CallOptions, ::Hash]
309
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
310
+ #
311
+ # @overload list_sample_queries(parent: nil, page_size: nil, page_token: nil)
312
+ # Pass arguments to `list_sample_queries` via keyword arguments. Note that at
313
+ # least one keyword argument is required. To specify no parameters, or to keep all
314
+ # the default parameter values, pass an empty Hash as a request object (see above).
315
+ #
316
+ # @param parent [::String]
317
+ # Required. The parent sample query set resource name, such as
318
+ # `projects/{project}/locations/{location}/sampleQuerySets/{sampleQuerySet}`.
319
+ #
320
+ # If the caller does not have permission to list
321
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}s under this
322
+ # sample query set, regardless of whether or not this sample query set
323
+ # exists, a `PERMISSION_DENIED` error is returned.
324
+ # @param page_size [::Integer]
325
+ # Maximum number of
326
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}s to return.
327
+ # If unspecified, defaults to 100. The maximum allowed value is 1000. Values
328
+ # above 1000 will be coerced to 1000.
329
+ #
330
+ # If this field is negative, an `INVALID_ARGUMENT` error is returned.
331
+ # @param page_token [::String]
332
+ # A page token
333
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ListSampleQueriesResponse#next_page_token ListSampleQueriesResponse.next_page_token},
334
+ # received from a previous
335
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client#list_sample_queries SampleQueryService.ListSampleQueries}
336
+ # call. Provide this to retrieve the subsequent page.
337
+ #
338
+ # When paginating, all other parameters provided to
339
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client#list_sample_queries SampleQueryService.ListSampleQueries}
340
+ # must match the call that provided the page token. Otherwise, an
341
+ # `INVALID_ARGUMENT` error is returned.
342
+ #
343
+ # @yield [response, operation] Access the result along with the RPC operation
344
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery>]
345
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
346
+ #
347
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery>]
348
+ #
349
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
350
+ #
351
+ # @example Basic example
352
+ # require "google/cloud/discovery_engine/v1beta"
353
+ #
354
+ # # Create a client object. The client can be reused for multiple calls.
355
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new
356
+ #
357
+ # # Create a request. To set request fields, pass in keyword arguments.
358
+ # request = Google::Cloud::DiscoveryEngine::V1beta::ListSampleQueriesRequest.new
359
+ #
360
+ # # Call the list_sample_queries method.
361
+ # result = client.list_sample_queries request
362
+ #
363
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
364
+ # # over elements, and API calls will be issued to fetch pages as needed.
365
+ # result.each do |item|
366
+ # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery.
367
+ # p item
368
+ # end
369
+ #
370
+ def list_sample_queries request, options = nil
371
+ raise ::ArgumentError, "request must be provided" if request.nil?
372
+
373
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ListSampleQueriesRequest
374
+
375
+ # Converts hash and nil to an options object
376
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
377
+
378
+ # Customize the options with defaults
379
+ metadata = @config.rpcs.list_sample_queries.metadata.to_h
380
+
381
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
382
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
383
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
384
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
385
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
386
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
387
+
388
+ header_params = {}
389
+ if request.parent
390
+ header_params["parent"] = request.parent
391
+ end
392
+
393
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
394
+ metadata[:"x-goog-request-params"] ||= request_params_header
395
+
396
+ options.apply_defaults timeout: @config.rpcs.list_sample_queries.timeout,
397
+ metadata: metadata,
398
+ retry_policy: @config.rpcs.list_sample_queries.retry_policy
399
+
400
+ options.apply_defaults timeout: @config.timeout,
401
+ metadata: @config.metadata,
402
+ retry_policy: @config.retry_policy
403
+
404
+ @sample_query_service_stub.call_rpc :list_sample_queries, request, options: options do |response, operation|
405
+ response = ::Gapic::PagedEnumerable.new @sample_query_service_stub, :list_sample_queries, request, response, operation, options
406
+ yield response, operation if block_given?
407
+ return response
408
+ end
409
+ rescue ::GRPC::BadStatus => e
410
+ raise ::Google::Cloud::Error.from_error(e)
411
+ end
412
+
413
+ ##
414
+ # Creates a {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}
415
+ #
416
+ # @overload create_sample_query(request, options = nil)
417
+ # Pass arguments to `create_sample_query` via a request object, either of type
418
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CreateSampleQueryRequest} or an equivalent Hash.
419
+ #
420
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::CreateSampleQueryRequest, ::Hash]
421
+ # A request object representing the call parameters. Required. To specify no
422
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
423
+ # @param options [::Gapic::CallOptions, ::Hash]
424
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
425
+ #
426
+ # @overload create_sample_query(parent: nil, sample_query: nil, sample_query_id: nil)
427
+ # Pass arguments to `create_sample_query` via keyword arguments. Note that at
428
+ # least one keyword argument is required. To specify no parameters, or to keep all
429
+ # the default parameter values, pass an empty Hash as a request object (see above).
430
+ #
431
+ # @param parent [::String]
432
+ # Required. The parent resource name, such as
433
+ # `projects/{project}/locations/{location}/sampleQuerySets/{sampleQuerySet}`.
434
+ # @param sample_query [::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery, ::Hash]
435
+ # Required. The
436
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery} to create.
437
+ # @param sample_query_id [::String]
438
+ # Required. The ID to use for the
439
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}, which will
440
+ # become the final component of the
441
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery#name SampleQuery.name}.
442
+ #
443
+ # If the caller does not have permission to create the
444
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}, regardless
445
+ # of whether or not it exists, a `PERMISSION_DENIED` error is returned.
446
+ #
447
+ # This field must be unique among all
448
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}s with the
449
+ # same
450
+ # {::Google::Cloud::DiscoveryEngine::V1beta::CreateSampleQueryRequest#parent parent}.
451
+ # Otherwise, an `ALREADY_EXISTS` error is returned.
452
+ #
453
+ # This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034)
454
+ # standard with a length limit of 63 characters. Otherwise, an
455
+ # `INVALID_ARGUMENT` error is returned.
456
+ #
457
+ # @yield [response, operation] Access the result along with the RPC operation
458
+ # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery]
459
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
460
+ #
461
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery]
462
+ #
463
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
464
+ #
465
+ # @example Basic example
466
+ # require "google/cloud/discovery_engine/v1beta"
467
+ #
468
+ # # Create a client object. The client can be reused for multiple calls.
469
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new
470
+ #
471
+ # # Create a request. To set request fields, pass in keyword arguments.
472
+ # request = Google::Cloud::DiscoveryEngine::V1beta::CreateSampleQueryRequest.new
473
+ #
474
+ # # Call the create_sample_query method.
475
+ # result = client.create_sample_query request
476
+ #
477
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::SampleQuery.
478
+ # p result
479
+ #
480
+ def create_sample_query request, options = nil
481
+ raise ::ArgumentError, "request must be provided" if request.nil?
482
+
483
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::CreateSampleQueryRequest
484
+
485
+ # Converts hash and nil to an options object
486
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
487
+
488
+ # Customize the options with defaults
489
+ metadata = @config.rpcs.create_sample_query.metadata.to_h
490
+
491
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
492
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
493
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
494
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
495
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
496
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
497
+
498
+ header_params = {}
499
+ if request.parent
500
+ header_params["parent"] = request.parent
501
+ end
502
+
503
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
504
+ metadata[:"x-goog-request-params"] ||= request_params_header
505
+
506
+ options.apply_defaults timeout: @config.rpcs.create_sample_query.timeout,
507
+ metadata: metadata,
508
+ retry_policy: @config.rpcs.create_sample_query.retry_policy
509
+
510
+ options.apply_defaults timeout: @config.timeout,
511
+ metadata: @config.metadata,
512
+ retry_policy: @config.retry_policy
513
+
514
+ @sample_query_service_stub.call_rpc :create_sample_query, request, options: options do |response, operation|
515
+ yield response, operation if block_given?
516
+ return response
517
+ end
518
+ rescue ::GRPC::BadStatus => e
519
+ raise ::Google::Cloud::Error.from_error(e)
520
+ end
521
+
522
+ ##
523
+ # Updates a {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}.
524
+ #
525
+ # @overload update_sample_query(request, options = nil)
526
+ # Pass arguments to `update_sample_query` via a request object, either of type
527
+ # {::Google::Cloud::DiscoveryEngine::V1beta::UpdateSampleQueryRequest} or an equivalent Hash.
528
+ #
529
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::UpdateSampleQueryRequest, ::Hash]
530
+ # A request object representing the call parameters. Required. To specify no
531
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
532
+ # @param options [::Gapic::CallOptions, ::Hash]
533
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
534
+ #
535
+ # @overload update_sample_query(sample_query: nil, update_mask: nil)
536
+ # Pass arguments to `update_sample_query` via keyword arguments. Note that at
537
+ # least one keyword argument is required. To specify no parameters, or to keep all
538
+ # the default parameter values, pass an empty Hash as a request object (see above).
539
+ #
540
+ # @param sample_query [::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery, ::Hash]
541
+ # Required. The simple query to update.
542
+ #
543
+ # If the caller does not have permission to update the
544
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}, regardless
545
+ # of whether or not it exists, a `PERMISSION_DENIED` error is returned.
546
+ #
547
+ # If the {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery} to
548
+ # update does not exist a `NOT_FOUND` error is returned.
549
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
550
+ # Indicates which fields in the provided imported 'simple query' to update.
551
+ # If not set, will by default update all fields.
552
+ #
553
+ # @yield [response, operation] Access the result along with the RPC operation
554
+ # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery]
555
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
556
+ #
557
+ # @return [::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery]
558
+ #
559
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
560
+ #
561
+ # @example Basic example
562
+ # require "google/cloud/discovery_engine/v1beta"
563
+ #
564
+ # # Create a client object. The client can be reused for multiple calls.
565
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new
566
+ #
567
+ # # Create a request. To set request fields, pass in keyword arguments.
568
+ # request = Google::Cloud::DiscoveryEngine::V1beta::UpdateSampleQueryRequest.new
569
+ #
570
+ # # Call the update_sample_query method.
571
+ # result = client.update_sample_query request
572
+ #
573
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1beta::SampleQuery.
574
+ # p result
575
+ #
576
+ def update_sample_query request, options = nil
577
+ raise ::ArgumentError, "request must be provided" if request.nil?
578
+
579
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::UpdateSampleQueryRequest
580
+
581
+ # Converts hash and nil to an options object
582
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
583
+
584
+ # Customize the options with defaults
585
+ metadata = @config.rpcs.update_sample_query.metadata.to_h
586
+
587
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
588
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
589
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
590
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
591
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
592
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
593
+
594
+ header_params = {}
595
+ if request.sample_query&.name
596
+ header_params["sample_query.name"] = request.sample_query.name
597
+ end
598
+
599
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
600
+ metadata[:"x-goog-request-params"] ||= request_params_header
601
+
602
+ options.apply_defaults timeout: @config.rpcs.update_sample_query.timeout,
603
+ metadata: metadata,
604
+ retry_policy: @config.rpcs.update_sample_query.retry_policy
605
+
606
+ options.apply_defaults timeout: @config.timeout,
607
+ metadata: @config.metadata,
608
+ retry_policy: @config.retry_policy
609
+
610
+ @sample_query_service_stub.call_rpc :update_sample_query, request, options: options do |response, operation|
611
+ yield response, operation if block_given?
612
+ return response
613
+ end
614
+ rescue ::GRPC::BadStatus => e
615
+ raise ::Google::Cloud::Error.from_error(e)
616
+ end
617
+
618
+ ##
619
+ # Deletes a {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}.
620
+ #
621
+ # @overload delete_sample_query(request, options = nil)
622
+ # Pass arguments to `delete_sample_query` via a request object, either of type
623
+ # {::Google::Cloud::DiscoveryEngine::V1beta::DeleteSampleQueryRequest} or an equivalent Hash.
624
+ #
625
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::DeleteSampleQueryRequest, ::Hash]
626
+ # A request object representing the call parameters. Required. To specify no
627
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
628
+ # @param options [::Gapic::CallOptions, ::Hash]
629
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
630
+ #
631
+ # @overload delete_sample_query(name: nil)
632
+ # Pass arguments to `delete_sample_query` via keyword arguments. Note that at
633
+ # least one keyword argument is required. To specify no parameters, or to keep all
634
+ # the default parameter values, pass an empty Hash as a request object (see above).
635
+ #
636
+ # @param name [::String]
637
+ # Required. Full resource name of
638
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}, such as
639
+ # `projects/{project}/locations/{location}/sampleQuerySets/{sample_query_set}/sampleQueries/{sample_query}`.
640
+ #
641
+ # If the caller does not have permission to delete the
642
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}, regardless
643
+ # of whether or not it exists, a `PERMISSION_DENIED` error is returned.
644
+ #
645
+ # If the {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery} to
646
+ # delete does not exist, a `NOT_FOUND` error is returned.
647
+ #
648
+ # @yield [response, operation] Access the result along with the RPC operation
649
+ # @yieldparam response [::Google::Protobuf::Empty]
650
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
651
+ #
652
+ # @return [::Google::Protobuf::Empty]
653
+ #
654
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
655
+ #
656
+ # @example Basic example
657
+ # require "google/cloud/discovery_engine/v1beta"
658
+ #
659
+ # # Create a client object. The client can be reused for multiple calls.
660
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new
661
+ #
662
+ # # Create a request. To set request fields, pass in keyword arguments.
663
+ # request = Google::Cloud::DiscoveryEngine::V1beta::DeleteSampleQueryRequest.new
664
+ #
665
+ # # Call the delete_sample_query method.
666
+ # result = client.delete_sample_query request
667
+ #
668
+ # # The returned object is of type Google::Protobuf::Empty.
669
+ # p result
670
+ #
671
+ def delete_sample_query request, options = nil
672
+ raise ::ArgumentError, "request must be provided" if request.nil?
673
+
674
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::DeleteSampleQueryRequest
675
+
676
+ # Converts hash and nil to an options object
677
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
678
+
679
+ # Customize the options with defaults
680
+ metadata = @config.rpcs.delete_sample_query.metadata.to_h
681
+
682
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
683
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
684
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
685
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
686
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
687
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
688
+
689
+ header_params = {}
690
+ if request.name
691
+ header_params["name"] = request.name
692
+ end
693
+
694
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
695
+ metadata[:"x-goog-request-params"] ||= request_params_header
696
+
697
+ options.apply_defaults timeout: @config.rpcs.delete_sample_query.timeout,
698
+ metadata: metadata,
699
+ retry_policy: @config.rpcs.delete_sample_query.retry_policy
700
+
701
+ options.apply_defaults timeout: @config.timeout,
702
+ metadata: @config.metadata,
703
+ retry_policy: @config.retry_policy
704
+
705
+ @sample_query_service_stub.call_rpc :delete_sample_query, request, options: options do |response, operation|
706
+ yield response, operation if block_given?
707
+ return response
708
+ end
709
+ rescue ::GRPC::BadStatus => e
710
+ raise ::Google::Cloud::Error.from_error(e)
711
+ end
712
+
713
+ ##
714
+ # Bulk import of multiple
715
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}s. Sample
716
+ # queries that already exist may be deleted.
717
+ #
718
+ # Note: It is possible for a subset of the
719
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}s to be
720
+ # successfully imported.
721
+ #
722
+ # @overload import_sample_queries(request, options = nil)
723
+ # Pass arguments to `import_sample_queries` via a request object, either of type
724
+ # {::Google::Cloud::DiscoveryEngine::V1beta::ImportSampleQueriesRequest} or an equivalent Hash.
725
+ #
726
+ # @param request [::Google::Cloud::DiscoveryEngine::V1beta::ImportSampleQueriesRequest, ::Hash]
727
+ # A request object representing the call parameters. Required. To specify no
728
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
729
+ # @param options [::Gapic::CallOptions, ::Hash]
730
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
731
+ #
732
+ # @overload import_sample_queries(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil)
733
+ # Pass arguments to `import_sample_queries` via keyword arguments. Note that at
734
+ # least one keyword argument is required. To specify no parameters, or to keep all
735
+ # the default parameter values, pass an empty Hash as a request object (see above).
736
+ #
737
+ # @param inline_source [::Google::Cloud::DiscoveryEngine::V1beta::ImportSampleQueriesRequest::InlineSource, ::Hash]
738
+ # The Inline source for sample query entries.
739
+ # @param gcs_source [::Google::Cloud::DiscoveryEngine::V1beta::GcsSource, ::Hash]
740
+ # Cloud Storage location for the input content.
741
+ # @param bigquery_source [::Google::Cloud::DiscoveryEngine::V1beta::BigQuerySource, ::Hash]
742
+ # BigQuery input source.
743
+ # @param parent [::String]
744
+ # Required. The parent sample query set resource name, such as
745
+ # `projects/{project}/locations/{location}/sampleQuerySets/{sampleQuerySet}`.
746
+ #
747
+ # If the caller does not have permission to list
748
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQuery SampleQuery}s under this
749
+ # sample query set, regardless of whether or not this sample query set
750
+ # exists, a `PERMISSION_DENIED` error is returned.
751
+ # @param error_config [::Google::Cloud::DiscoveryEngine::V1beta::ImportErrorConfig, ::Hash]
752
+ # The desired location of errors incurred during the Import.
753
+ #
754
+ # @yield [response, operation] Access the result along with the RPC operation
755
+ # @yieldparam response [::Gapic::Operation]
756
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
757
+ #
758
+ # @return [::Gapic::Operation]
759
+ #
760
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
761
+ #
762
+ # @example Basic example
763
+ # require "google/cloud/discovery_engine/v1beta"
764
+ #
765
+ # # Create a client object. The client can be reused for multiple calls.
766
+ # client = Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new
767
+ #
768
+ # # Create a request. To set request fields, pass in keyword arguments.
769
+ # request = Google::Cloud::DiscoveryEngine::V1beta::ImportSampleQueriesRequest.new
770
+ #
771
+ # # Call the import_sample_queries method.
772
+ # result = client.import_sample_queries request
773
+ #
774
+ # # The returned object is of type Gapic::Operation. You can use it to
775
+ # # check the status of an operation, cancel it, or wait for results.
776
+ # # Here is how to wait for a response.
777
+ # result.wait_until_done! timeout: 60
778
+ # if result.response?
779
+ # p result.response
780
+ # else
781
+ # puts "No response received."
782
+ # end
783
+ #
784
+ def import_sample_queries request, options = nil
785
+ raise ::ArgumentError, "request must be provided" if request.nil?
786
+
787
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ImportSampleQueriesRequest
788
+
789
+ # Converts hash and nil to an options object
790
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
791
+
792
+ # Customize the options with defaults
793
+ metadata = @config.rpcs.import_sample_queries.metadata.to_h
794
+
795
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
796
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
797
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
798
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION
799
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
800
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
801
+
802
+ header_params = {}
803
+ if request.parent
804
+ header_params["parent"] = request.parent
805
+ end
806
+
807
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
808
+ metadata[:"x-goog-request-params"] ||= request_params_header
809
+
810
+ options.apply_defaults timeout: @config.rpcs.import_sample_queries.timeout,
811
+ metadata: metadata,
812
+ retry_policy: @config.rpcs.import_sample_queries.retry_policy
813
+
814
+ options.apply_defaults timeout: @config.timeout,
815
+ metadata: @config.metadata,
816
+ retry_policy: @config.retry_policy
817
+
818
+ @sample_query_service_stub.call_rpc :import_sample_queries, request, options: options do |response, operation|
819
+ response = ::Gapic::Operation.new response, @operations_client, options: options
820
+ yield response, operation if block_given?
821
+ return response
822
+ end
823
+ rescue ::GRPC::BadStatus => e
824
+ raise ::Google::Cloud::Error.from_error(e)
825
+ end
826
+
827
+ ##
828
+ # Configuration class for the SampleQueryService API.
829
+ #
830
+ # This class represents the configuration for SampleQueryService,
831
+ # providing control over timeouts, retry behavior, logging, transport
832
+ # parameters, and other low-level controls. Certain parameters can also be
833
+ # applied individually to specific RPCs. See
834
+ # {::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client::Configuration::Rpcs}
835
+ # for a list of RPCs that can be configured independently.
836
+ #
837
+ # Configuration can be applied globally to all clients, or to a single client
838
+ # on construction.
839
+ #
840
+ # @example
841
+ #
842
+ # # Modify the global config, setting the timeout for
843
+ # # get_sample_query to 20 seconds,
844
+ # # and all remaining timeouts to 10 seconds.
845
+ # ::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.configure do |config|
846
+ # config.timeout = 10.0
847
+ # config.rpcs.get_sample_query.timeout = 20.0
848
+ # end
849
+ #
850
+ # # Apply the above configuration only to a new client.
851
+ # client = ::Google::Cloud::DiscoveryEngine::V1beta::SampleQueryService::Client.new do |config|
852
+ # config.timeout = 10.0
853
+ # config.rpcs.get_sample_query.timeout = 20.0
854
+ # end
855
+ #
856
+ # @!attribute [rw] endpoint
857
+ # A custom service endpoint, as a hostname or hostname:port. The default is
858
+ # nil, indicating to use the default endpoint in the current universe domain.
859
+ # @return [::String,nil]
860
+ # @!attribute [rw] credentials
861
+ # Credentials to send with calls. You may provide any of the following types:
862
+ # * (`String`) The path to a service account key file in JSON format
863
+ # * (`Hash`) A service account key as a Hash
864
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
865
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
866
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
867
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
868
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
869
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
870
+ # * (`nil`) indicating no credentials
871
+ # @return [::Object]
872
+ # @!attribute [rw] scope
873
+ # The OAuth scopes
874
+ # @return [::Array<::String>]
875
+ # @!attribute [rw] lib_name
876
+ # The library name as recorded in instrumentation and logging
877
+ # @return [::String]
878
+ # @!attribute [rw] lib_version
879
+ # The library version as recorded in instrumentation and logging
880
+ # @return [::String]
881
+ # @!attribute [rw] channel_args
882
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
883
+ # `GRPC::Core::Channel` object is provided as the credential.
884
+ # @return [::Hash]
885
+ # @!attribute [rw] interceptors
886
+ # An array of interceptors that are run before calls are executed.
887
+ # @return [::Array<::GRPC::ClientInterceptor>]
888
+ # @!attribute [rw] timeout
889
+ # The call timeout in seconds.
890
+ # @return [::Numeric]
891
+ # @!attribute [rw] metadata
892
+ # Additional gRPC headers to be sent with the call.
893
+ # @return [::Hash{::Symbol=>::String}]
894
+ # @!attribute [rw] retry_policy
895
+ # The retry policy. The value is a hash with the following keys:
896
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
897
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
898
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
899
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
900
+ # trigger a retry.
901
+ # @return [::Hash]
902
+ # @!attribute [rw] quota_project
903
+ # A separate project against which to charge quota.
904
+ # @return [::String]
905
+ # @!attribute [rw] universe_domain
906
+ # The universe domain within which to make requests. This determines the
907
+ # default endpoint URL. The default value of nil uses the environment
908
+ # universe (usually the default "googleapis.com" universe).
909
+ # @return [::String,nil]
910
+ #
911
+ class Configuration
912
+ extend ::Gapic::Config
913
+
914
+ # @private
915
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
916
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
917
+
918
+ config_attr :endpoint, nil, ::String, nil
919
+ config_attr :credentials, nil do |value|
920
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
921
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
922
+ allowed.any? { |klass| klass === value }
923
+ end
924
+ config_attr :scope, nil, ::String, ::Array, nil
925
+ config_attr :lib_name, nil, ::String, nil
926
+ config_attr :lib_version, nil, ::String, nil
927
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
928
+ config_attr :interceptors, nil, ::Array, nil
929
+ config_attr :timeout, nil, ::Numeric, nil
930
+ config_attr :metadata, nil, ::Hash, nil
931
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
932
+ config_attr :quota_project, nil, ::String, nil
933
+ config_attr :universe_domain, nil, ::String, nil
934
+
935
+ # @private
936
+ def initialize parent_config = nil
937
+ @parent_config = parent_config unless parent_config.nil?
938
+
939
+ yield self if block_given?
940
+ end
941
+
942
+ ##
943
+ # Configurations for individual RPCs
944
+ # @return [Rpcs]
945
+ #
946
+ def rpcs
947
+ @rpcs ||= begin
948
+ parent_rpcs = nil
949
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
950
+ Rpcs.new parent_rpcs
951
+ end
952
+ end
953
+
954
+ ##
955
+ # Configuration for the channel pool
956
+ # @return [::Gapic::ServiceStub::ChannelPool::Configuration]
957
+ #
958
+ def channel_pool
959
+ @channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
960
+ end
961
+
962
+ ##
963
+ # Configuration RPC class for the SampleQueryService API.
964
+ #
965
+ # Includes fields providing the configuration for each RPC in this service.
966
+ # Each configuration object is of type `Gapic::Config::Method` and includes
967
+ # the following configuration fields:
968
+ #
969
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
970
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
971
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
972
+ # include the following keys:
973
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
974
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
975
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
976
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
977
+ # trigger a retry.
978
+ #
979
+ class Rpcs
980
+ ##
981
+ # RPC-specific configuration for `get_sample_query`
982
+ # @return [::Gapic::Config::Method]
983
+ #
984
+ attr_reader :get_sample_query
985
+ ##
986
+ # RPC-specific configuration for `list_sample_queries`
987
+ # @return [::Gapic::Config::Method]
988
+ #
989
+ attr_reader :list_sample_queries
990
+ ##
991
+ # RPC-specific configuration for `create_sample_query`
992
+ # @return [::Gapic::Config::Method]
993
+ #
994
+ attr_reader :create_sample_query
995
+ ##
996
+ # RPC-specific configuration for `update_sample_query`
997
+ # @return [::Gapic::Config::Method]
998
+ #
999
+ attr_reader :update_sample_query
1000
+ ##
1001
+ # RPC-specific configuration for `delete_sample_query`
1002
+ # @return [::Gapic::Config::Method]
1003
+ #
1004
+ attr_reader :delete_sample_query
1005
+ ##
1006
+ # RPC-specific configuration for `import_sample_queries`
1007
+ # @return [::Gapic::Config::Method]
1008
+ #
1009
+ attr_reader :import_sample_queries
1010
+
1011
+ # @private
1012
+ def initialize parent_rpcs = nil
1013
+ get_sample_query_config = parent_rpcs.get_sample_query if parent_rpcs.respond_to? :get_sample_query
1014
+ @get_sample_query = ::Gapic::Config::Method.new get_sample_query_config
1015
+ list_sample_queries_config = parent_rpcs.list_sample_queries if parent_rpcs.respond_to? :list_sample_queries
1016
+ @list_sample_queries = ::Gapic::Config::Method.new list_sample_queries_config
1017
+ create_sample_query_config = parent_rpcs.create_sample_query if parent_rpcs.respond_to? :create_sample_query
1018
+ @create_sample_query = ::Gapic::Config::Method.new create_sample_query_config
1019
+ update_sample_query_config = parent_rpcs.update_sample_query if parent_rpcs.respond_to? :update_sample_query
1020
+ @update_sample_query = ::Gapic::Config::Method.new update_sample_query_config
1021
+ delete_sample_query_config = parent_rpcs.delete_sample_query if parent_rpcs.respond_to? :delete_sample_query
1022
+ @delete_sample_query = ::Gapic::Config::Method.new delete_sample_query_config
1023
+ import_sample_queries_config = parent_rpcs.import_sample_queries if parent_rpcs.respond_to? :import_sample_queries
1024
+ @import_sample_queries = ::Gapic::Config::Method.new import_sample_queries_config
1025
+
1026
+ yield self if block_given?
1027
+ end
1028
+ end
1029
+ end
1030
+ end
1031
+ end
1032
+ end
1033
+ end
1034
+ end
1035
+ end