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