google-cloud-discovery_engine-v1 0.4.2 → 0.5.0

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