google-cloud-discovery_engine-v1beta 0.12.0 → 0.14.0

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