google-cloud-discovery_engine-v1 0.a → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +149 -0
  4. data/README.md +144 -8
  5. data/lib/google/cloud/discovery_engine/v1/completion_service/client.rb +431 -0
  6. data/lib/google/cloud/discovery_engine/v1/completion_service/credentials.rb +47 -0
  7. data/lib/google/cloud/discovery_engine/v1/completion_service/paths.rb +78 -0
  8. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/client.rb +388 -0
  9. data/lib/google/cloud/discovery_engine/v1/completion_service/rest/service_stub.rb +114 -0
  10. data/lib/google/cloud/discovery_engine/v1/completion_service/rest.rb +52 -0
  11. data/lib/google/cloud/discovery_engine/v1/completion_service.rb +55 -0
  12. data/lib/google/cloud/discovery_engine/v1/document_service/client.rb +1155 -0
  13. data/lib/google/cloud/discovery_engine/v1/document_service/credentials.rb +47 -0
  14. data/lib/google/cloud/discovery_engine/v1/document_service/operations.rb +770 -0
  15. data/lib/google/cloud/discovery_engine/v1/document_service/paths.rb +135 -0
  16. data/lib/google/cloud/discovery_engine/v1/document_service/rest/client.rb +956 -0
  17. data/lib/google/cloud/discovery_engine/v1/document_service/rest/operations.rb +935 -0
  18. data/lib/google/cloud/discovery_engine/v1/document_service/rest/service_stub.rb +518 -0
  19. data/lib/google/cloud/discovery_engine/v1/document_service/rest.rb +54 -0
  20. data/lib/google/cloud/discovery_engine/v1/document_service.rb +57 -0
  21. data/lib/google/cloud/discovery_engine/v1/rest.rb +41 -0
  22. data/lib/google/cloud/discovery_engine/v1/schema_service/client.rb +839 -0
  23. data/lib/google/cloud/discovery_engine/v1/schema_service/credentials.rb +47 -0
  24. data/lib/google/cloud/discovery_engine/v1/schema_service/operations.rb +770 -0
  25. data/lib/google/cloud/discovery_engine/v1/schema_service/paths.rb +127 -0
  26. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/client.rb +679 -0
  27. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/operations.rb +935 -0
  28. data/lib/google/cloud/discovery_engine/v1/schema_service/rest/service_stub.rb +382 -0
  29. data/lib/google/cloud/discovery_engine/v1/schema_service/rest.rb +53 -0
  30. data/lib/google/cloud/discovery_engine/v1/schema_service.rb +56 -0
  31. data/lib/google/cloud/discovery_engine/v1/search_service/client.rb +493 -0
  32. data/lib/google/cloud/discovery_engine/v1/search_service/credentials.rb +47 -0
  33. data/lib/google/cloud/discovery_engine/v1/search_service/paths.rb +131 -0
  34. data/lib/google/cloud/discovery_engine/v1/search_service/rest/client.rb +446 -0
  35. data/lib/google/cloud/discovery_engine/v1/search_service/rest/service_stub.rb +116 -0
  36. data/lib/google/cloud/discovery_engine/v1/search_service/rest.rb +52 -0
  37. data/lib/google/cloud/discovery_engine/v1/search_service.rb +55 -0
  38. data/lib/google/cloud/discovery_engine/v1/user_event_service/client.rb +640 -0
  39. data/lib/google/cloud/discovery_engine/v1/user_event_service/credentials.rb +47 -0
  40. data/lib/google/cloud/discovery_engine/v1/user_event_service/operations.rb +770 -0
  41. data/lib/google/cloud/discovery_engine/v1/user_event_service/paths.rb +131 -0
  42. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/client.rb +544 -0
  43. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/operations.rb +935 -0
  44. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest/service_stub.rb +250 -0
  45. data/lib/google/cloud/discovery_engine/v1/user_event_service/rest.rb +53 -0
  46. data/lib/google/cloud/discovery_engine/v1/user_event_service.rb +56 -0
  47. data/lib/google/cloud/discovery_engine/v1/version.rb +7 -2
  48. data/lib/google/cloud/discovery_engine/v1.rb +49 -0
  49. data/lib/google/cloud/discoveryengine/v1/common_pb.rb +45 -0
  50. data/lib/google/cloud/discoveryengine/v1/completion_service_pb.rb +49 -0
  51. data/lib/google/cloud/discoveryengine/v1/completion_service_services_pb.rb +45 -0
  52. data/lib/google/cloud/discoveryengine/v1/document_pb.rb +48 -0
  53. data/lib/google/cloud/discoveryengine/v1/document_service_pb.rb +58 -0
  54. data/lib/google/cloud/discoveryengine/v1/document_service_services_pb.rb +79 -0
  55. data/lib/google/cloud/discoveryengine/v1/import_config_pb.rb +66 -0
  56. data/lib/google/cloud/discoveryengine/v1/purge_config_pb.rb +49 -0
  57. data/lib/google/cloud/discoveryengine/v1/schema_pb.rb +47 -0
  58. data/lib/google/cloud/discoveryengine/v1/schema_service_pb.rb +61 -0
  59. data/lib/google/cloud/discoveryengine/v1/schema_service_services_pb.rb +53 -0
  60. data/lib/google/cloud/discoveryengine/v1/search_service_pb.rb +61 -0
  61. data/lib/google/cloud/discoveryengine/v1/search_service_services_pb.rb +45 -0
  62. data/lib/google/cloud/discoveryengine/v1/user_event_pb.rb +58 -0
  63. data/lib/google/cloud/discoveryengine/v1/user_event_service_pb.rb +53 -0
  64. data/lib/google/cloud/discoveryengine/v1/user_event_service_services_pb.rb +59 -0
  65. data/lib/google-cloud-discovery_engine-v1.rb +21 -0
  66. data/proto_docs/README.md +4 -0
  67. data/proto_docs/google/api/client.rb +381 -0
  68. data/proto_docs/google/api/field_behavior.rb +71 -0
  69. data/proto_docs/google/api/httpbody.rb +80 -0
  70. data/proto_docs/google/api/launch_stage.rb +71 -0
  71. data/proto_docs/google/api/resource.rb +222 -0
  72. data/proto_docs/google/cloud/discoveryengine/v1/common.rb +89 -0
  73. data/proto_docs/google/cloud/discoveryengine/v1/completion_service.rb +98 -0
  74. data/proto_docs/google/cloud/discoveryengine/v1/document.rb +105 -0
  75. data/proto_docs/google/cloud/discoveryengine/v1/document_service.rb +180 -0
  76. data/proto_docs/google/cloud/discoveryengine/v1/import_config.rb +336 -0
  77. data/proto_docs/google/cloud/discoveryengine/v1/purge_config.rb +84 -0
  78. data/proto_docs/google/cloud/discoveryengine/v1/schema.rb +45 -0
  79. data/proto_docs/google/cloud/discoveryengine/v1/schema_service.rb +177 -0
  80. data/proto_docs/google/cloud/discoveryengine/v1/search_service.rb +294 -0
  81. data/proto_docs/google/cloud/discoveryengine/v1/user_event.rb +466 -0
  82. data/proto_docs/google/cloud/discoveryengine/v1/user_event_service.rb +64 -0
  83. data/proto_docs/google/longrunning/operations.rb +164 -0
  84. data/proto_docs/google/protobuf/any.rb +144 -0
  85. data/proto_docs/google/protobuf/duration.rb +98 -0
  86. data/proto_docs/google/protobuf/empty.rb +34 -0
  87. data/proto_docs/google/protobuf/struct.rb +96 -0
  88. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  89. data/proto_docs/google/rpc/status.rb +48 -0
  90. data/proto_docs/google/type/date.rb +53 -0
  91. metadata +243 -12
@@ -0,0 +1,640 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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/user_event_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module DiscoveryEngine
25
+ module V1
26
+ module UserEventService
27
+ ##
28
+ # Client for the UserEventService service.
29
+ #
30
+ # Service for ingesting end user actions on a website to Discovery Engine API.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :user_event_service_stub
37
+
38
+ ##
39
+ # Configure the UserEventService Client class.
40
+ #
41
+ # See {::Google::Cloud::DiscoveryEngine::V1::UserEventService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all UserEventService clients
47
+ # ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Client.configure do |config|
48
+ # config.timeout = 10.0
49
+ # end
50
+ #
51
+ # @yield [config] Configure the Client client.
52
+ # @yieldparam config [Client::Configuration]
53
+ #
54
+ # @return [Client::Configuration]
55
+ #
56
+ def self.configure
57
+ @configure ||= begin
58
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
59
+ parent_config = while namespace.any?
60
+ parent_name = namespace.join "::"
61
+ parent_const = const_get parent_name
62
+ break parent_const.configure if parent_const.respond_to? :configure
63
+ namespace.pop
64
+ end
65
+ default_config = Client::Configuration.new parent_config
66
+
67
+ default_config.timeout = 30.0
68
+ default_config.retry_policy = {
69
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
70
+ }
71
+
72
+ default_config.rpcs.import_user_events.timeout = 300.0
73
+ default_config.rpcs.import_user_events.retry_policy = {
74
+ initial_delay: 1.0, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
75
+ }
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the UserEventService Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Cloud::DiscoveryEngine::V1::UserEventService::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # Create a new UserEventService client object.
105
+ #
106
+ # @example
107
+ #
108
+ # # Create a client using the default configuration
109
+ # client = ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Client.new
110
+ #
111
+ # # Create a client using a custom configuration
112
+ # client = ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Client.new do |config|
113
+ # config.timeout = 10.0
114
+ # end
115
+ #
116
+ # @yield [config] Configure the UserEventService client.
117
+ # @yieldparam config [Client::Configuration]
118
+ #
119
+ def initialize
120
+ # These require statements are intentionally placed here to initialize
121
+ # the gRPC module only when it's required.
122
+ # See https://github.com/googleapis/toolkit/issues/446
123
+ require "gapic/grpc"
124
+ require "google/cloud/discoveryengine/v1/user_event_service_services_pb"
125
+
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 == Configuration::DEFAULT_ENDPOINT &&
137
+ !@config.endpoint.split(".").first.include?("-")
138
+ credentials ||= Credentials.default scope: @config.scope,
139
+ enable_self_signed_jwt: enable_self_signed_jwt
140
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
141
+ credentials = Credentials.new credentials, scope: @config.scope
142
+ end
143
+ @quota_project_id = @config.quota_project
144
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
145
+
146
+ @operations_client = Operations.new do |config|
147
+ config.credentials = credentials
148
+ config.quota_project = @quota_project_id
149
+ config.endpoint = @config.endpoint
150
+ end
151
+
152
+ @user_event_service_stub = ::Gapic::ServiceStub.new(
153
+ ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Stub,
154
+ credentials: credentials,
155
+ endpoint: @config.endpoint,
156
+ channel_args: @config.channel_args,
157
+ interceptors: @config.interceptors
158
+ )
159
+ end
160
+
161
+ ##
162
+ # Get the associated client for long-running operations.
163
+ #
164
+ # @return [::Google::Cloud::DiscoveryEngine::V1::UserEventService::Operations]
165
+ #
166
+ attr_reader :operations_client
167
+
168
+ # Service calls
169
+
170
+ ##
171
+ # Writes a single user event.
172
+ #
173
+ # @overload write_user_event(request, options = nil)
174
+ # Pass arguments to `write_user_event` via a request object, either of type
175
+ # {::Google::Cloud::DiscoveryEngine::V1::WriteUserEventRequest} or an equivalent Hash.
176
+ #
177
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::WriteUserEventRequest, ::Hash]
178
+ # A request object representing the call parameters. Required. To specify no
179
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
180
+ # @param options [::Gapic::CallOptions, ::Hash]
181
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
182
+ #
183
+ # @overload write_user_event(parent: nil, user_event: nil)
184
+ # Pass arguments to `write_user_event` via keyword arguments. Note that at
185
+ # least one keyword argument is required. To specify no parameters, or to keep all
186
+ # the default parameter values, pass an empty Hash as a request object (see above).
187
+ #
188
+ # @param parent [::String]
189
+ # Required. The parent DataStore resource name, such as
190
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
191
+ # @param user_event [::Google::Cloud::DiscoveryEngine::V1::UserEvent, ::Hash]
192
+ # Required. User event to write.
193
+ #
194
+ # @yield [response, operation] Access the result along with the RPC operation
195
+ # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::UserEvent]
196
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
197
+ #
198
+ # @return [::Google::Cloud::DiscoveryEngine::V1::UserEvent]
199
+ #
200
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
201
+ #
202
+ # @example Basic example
203
+ # require "google/cloud/discovery_engine/v1"
204
+ #
205
+ # # Create a client object. The client can be reused for multiple calls.
206
+ # client = Google::Cloud::DiscoveryEngine::V1::UserEventService::Client.new
207
+ #
208
+ # # Create a request. To set request fields, pass in keyword arguments.
209
+ # request = Google::Cloud::DiscoveryEngine::V1::WriteUserEventRequest.new
210
+ #
211
+ # # Call the write_user_event method.
212
+ # result = client.write_user_event request
213
+ #
214
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1::UserEvent.
215
+ # p result
216
+ #
217
+ def write_user_event request, options = nil
218
+ raise ::ArgumentError, "request must be provided" if request.nil?
219
+
220
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::WriteUserEventRequest
221
+
222
+ # Converts hash and nil to an options object
223
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
224
+
225
+ # Customize the options with defaults
226
+ metadata = @config.rpcs.write_user_event.metadata.to_h
227
+
228
+ # Set x-goog-api-client and x-goog-user-project headers
229
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
230
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
231
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
232
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
233
+
234
+ header_params = {}
235
+ if request.parent
236
+ header_params["parent"] = request.parent
237
+ end
238
+
239
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
240
+ metadata[:"x-goog-request-params"] ||= request_params_header
241
+
242
+ options.apply_defaults timeout: @config.rpcs.write_user_event.timeout,
243
+ metadata: metadata,
244
+ retry_policy: @config.rpcs.write_user_event.retry_policy
245
+
246
+ options.apply_defaults timeout: @config.timeout,
247
+ metadata: @config.metadata,
248
+ retry_policy: @config.retry_policy
249
+
250
+ @user_event_service_stub.call_rpc :write_user_event, request, options: options do |response, operation|
251
+ yield response, operation if block_given?
252
+ return response
253
+ end
254
+ rescue ::GRPC::BadStatus => e
255
+ raise ::Google::Cloud::Error.from_error(e)
256
+ end
257
+
258
+ ##
259
+ # Writes a single user event from the browser. This uses a GET request to
260
+ # due to browser restriction of POST-ing to a 3rd party domain.
261
+ #
262
+ # This method is used only by the Discovery Engine API JavaScript pixel and
263
+ # Google Tag Manager. Users should not call this method directly.
264
+ #
265
+ # @overload collect_user_event(request, options = nil)
266
+ # Pass arguments to `collect_user_event` via a request object, either of type
267
+ # {::Google::Cloud::DiscoveryEngine::V1::CollectUserEventRequest} or an equivalent Hash.
268
+ #
269
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::CollectUserEventRequest, ::Hash]
270
+ # A request object representing the call parameters. Required. To specify no
271
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
272
+ # @param options [::Gapic::CallOptions, ::Hash]
273
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
274
+ #
275
+ # @overload collect_user_event(parent: nil, user_event: nil, uri: nil, ets: nil)
276
+ # Pass arguments to `collect_user_event` via keyword arguments. Note that at
277
+ # least one keyword argument is required. To specify no parameters, or to keep all
278
+ # the default parameter values, pass an empty Hash as a request object (see above).
279
+ #
280
+ # @param parent [::String]
281
+ # Required. The parent DataStore resource name, such as
282
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
283
+ # @param user_event [::String]
284
+ # Required. URL encoded UserEvent proto with a length limit of 2,000,000
285
+ # characters.
286
+ # @param uri [::String]
287
+ # The URL including cgi-parameters but excluding the hash fragment with a
288
+ # length limit of 5,000 characters. This is often more useful than the
289
+ # referer URL, because many browsers only send the domain for 3rd party
290
+ # requests.
291
+ # @param ets [::Integer]
292
+ # The event timestamp in milliseconds. This prevents browser caching of
293
+ # otherwise identical get requests. The name is abbreviated to reduce the
294
+ # payload bytes.
295
+ #
296
+ # @yield [response, operation] Access the result along with the RPC operation
297
+ # @yieldparam response [::Google::Api::HttpBody]
298
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
299
+ #
300
+ # @return [::Google::Api::HttpBody]
301
+ #
302
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
303
+ #
304
+ # @example Basic example
305
+ # require "google/cloud/discovery_engine/v1"
306
+ #
307
+ # # Create a client object. The client can be reused for multiple calls.
308
+ # client = Google::Cloud::DiscoveryEngine::V1::UserEventService::Client.new
309
+ #
310
+ # # Create a request. To set request fields, pass in keyword arguments.
311
+ # request = Google::Cloud::DiscoveryEngine::V1::CollectUserEventRequest.new
312
+ #
313
+ # # Call the collect_user_event method.
314
+ # result = client.collect_user_event request
315
+ #
316
+ # # The returned object is of type Google::Api::HttpBody.
317
+ # p result
318
+ #
319
+ def collect_user_event request, options = nil
320
+ raise ::ArgumentError, "request must be provided" if request.nil?
321
+
322
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::CollectUserEventRequest
323
+
324
+ # Converts hash and nil to an options object
325
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
326
+
327
+ # Customize the options with defaults
328
+ metadata = @config.rpcs.collect_user_event.metadata.to_h
329
+
330
+ # Set x-goog-api-client and x-goog-user-project headers
331
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
332
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
333
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
334
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
335
+
336
+ header_params = {}
337
+ if request.parent
338
+ header_params["parent"] = request.parent
339
+ end
340
+
341
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
342
+ metadata[:"x-goog-request-params"] ||= request_params_header
343
+
344
+ options.apply_defaults timeout: @config.rpcs.collect_user_event.timeout,
345
+ metadata: metadata,
346
+ retry_policy: @config.rpcs.collect_user_event.retry_policy
347
+
348
+ options.apply_defaults timeout: @config.timeout,
349
+ metadata: @config.metadata,
350
+ retry_policy: @config.retry_policy
351
+
352
+ @user_event_service_stub.call_rpc :collect_user_event, request, options: options do |response, operation|
353
+ yield response, operation if block_given?
354
+ return response
355
+ end
356
+ rescue ::GRPC::BadStatus => e
357
+ raise ::Google::Cloud::Error.from_error(e)
358
+ end
359
+
360
+ ##
361
+ # Bulk import of User events. Request processing might be
362
+ # synchronous. Events that already exist are skipped.
363
+ # Use this method for backfilling historical user events.
364
+ #
365
+ # Operation.response is of type ImportResponse. Note that it is
366
+ # possible for a subset of the items to be successfully inserted.
367
+ # Operation.metadata is of type ImportMetadata.
368
+ #
369
+ # @overload import_user_events(request, options = nil)
370
+ # Pass arguments to `import_user_events` via a request object, either of type
371
+ # {::Google::Cloud::DiscoveryEngine::V1::ImportUserEventsRequest} or an equivalent Hash.
372
+ #
373
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::ImportUserEventsRequest, ::Hash]
374
+ # A request object representing the call parameters. Required. To specify no
375
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
376
+ # @param options [::Gapic::CallOptions, ::Hash]
377
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
378
+ #
379
+ # @overload import_user_events(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil)
380
+ # Pass arguments to `import_user_events` via keyword arguments. Note that at
381
+ # least one keyword argument is required. To specify no parameters, or to keep all
382
+ # the default parameter values, pass an empty Hash as a request object (see above).
383
+ #
384
+ # @param inline_source [::Google::Cloud::DiscoveryEngine::V1::ImportUserEventsRequest::InlineSource, ::Hash]
385
+ # Required. The Inline source for the input content for UserEvents.
386
+ # @param gcs_source [::Google::Cloud::DiscoveryEngine::V1::GcsSource, ::Hash]
387
+ # Required. Cloud Storage location for the input content.
388
+ # @param bigquery_source [::Google::Cloud::DiscoveryEngine::V1::BigQuerySource, ::Hash]
389
+ # Required. BigQuery input source.
390
+ # @param parent [::String]
391
+ # Required. Parent DataStore resource name, of the form
392
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`
393
+ # @param error_config [::Google::Cloud::DiscoveryEngine::V1::ImportErrorConfig, ::Hash]
394
+ # The desired location of errors incurred during the Import. Cannot be set
395
+ # for inline user event imports.
396
+ #
397
+ # @yield [response, operation] Access the result along with the RPC operation
398
+ # @yieldparam response [::Gapic::Operation]
399
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
400
+ #
401
+ # @return [::Gapic::Operation]
402
+ #
403
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
404
+ #
405
+ # @example Basic example
406
+ # require "google/cloud/discovery_engine/v1"
407
+ #
408
+ # # Create a client object. The client can be reused for multiple calls.
409
+ # client = Google::Cloud::DiscoveryEngine::V1::UserEventService::Client.new
410
+ #
411
+ # # Create a request. To set request fields, pass in keyword arguments.
412
+ # request = Google::Cloud::DiscoveryEngine::V1::ImportUserEventsRequest.new
413
+ #
414
+ # # Call the import_user_events method.
415
+ # result = client.import_user_events request
416
+ #
417
+ # # The returned object is of type Gapic::Operation. You can use it to
418
+ # # check the status of an operation, cancel it, or wait for results.
419
+ # # Here is how to wait for a response.
420
+ # result.wait_until_done! timeout: 60
421
+ # if result.response?
422
+ # p result.response
423
+ # else
424
+ # puts "No response received."
425
+ # end
426
+ #
427
+ def import_user_events request, options = nil
428
+ raise ::ArgumentError, "request must be provided" if request.nil?
429
+
430
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ImportUserEventsRequest
431
+
432
+ # Converts hash and nil to an options object
433
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
434
+
435
+ # Customize the options with defaults
436
+ metadata = @config.rpcs.import_user_events.metadata.to_h
437
+
438
+ # Set x-goog-api-client and x-goog-user-project headers
439
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
440
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
441
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
442
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
443
+
444
+ header_params = {}
445
+ if request.parent
446
+ header_params["parent"] = request.parent
447
+ end
448
+
449
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
450
+ metadata[:"x-goog-request-params"] ||= request_params_header
451
+
452
+ options.apply_defaults timeout: @config.rpcs.import_user_events.timeout,
453
+ metadata: metadata,
454
+ retry_policy: @config.rpcs.import_user_events.retry_policy
455
+
456
+ options.apply_defaults timeout: @config.timeout,
457
+ metadata: @config.metadata,
458
+ retry_policy: @config.retry_policy
459
+
460
+ @user_event_service_stub.call_rpc :import_user_events, request, options: options do |response, operation|
461
+ response = ::Gapic::Operation.new response, @operations_client, options: options
462
+ yield response, operation if block_given?
463
+ return response
464
+ end
465
+ rescue ::GRPC::BadStatus => e
466
+ raise ::Google::Cloud::Error.from_error(e)
467
+ end
468
+
469
+ ##
470
+ # Configuration class for the UserEventService API.
471
+ #
472
+ # This class represents the configuration for UserEventService,
473
+ # providing control over timeouts, retry behavior, logging, transport
474
+ # parameters, and other low-level controls. Certain parameters can also be
475
+ # applied individually to specific RPCs. See
476
+ # {::Google::Cloud::DiscoveryEngine::V1::UserEventService::Client::Configuration::Rpcs}
477
+ # for a list of RPCs that can be configured independently.
478
+ #
479
+ # Configuration can be applied globally to all clients, or to a single client
480
+ # on construction.
481
+ #
482
+ # @example
483
+ #
484
+ # # Modify the global config, setting the timeout for
485
+ # # write_user_event to 20 seconds,
486
+ # # and all remaining timeouts to 10 seconds.
487
+ # ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Client.configure do |config|
488
+ # config.timeout = 10.0
489
+ # config.rpcs.write_user_event.timeout = 20.0
490
+ # end
491
+ #
492
+ # # Apply the above configuration only to a new client.
493
+ # client = ::Google::Cloud::DiscoveryEngine::V1::UserEventService::Client.new do |config|
494
+ # config.timeout = 10.0
495
+ # config.rpcs.write_user_event.timeout = 20.0
496
+ # end
497
+ #
498
+ # @!attribute [rw] endpoint
499
+ # The hostname or hostname:port of the service endpoint.
500
+ # Defaults to `"discoveryengine.googleapis.com"`.
501
+ # @return [::String]
502
+ # @!attribute [rw] credentials
503
+ # Credentials to send with calls. You may provide any of the following types:
504
+ # * (`String`) The path to a service account key file in JSON format
505
+ # * (`Hash`) A service account key as a Hash
506
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
507
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
508
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
509
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
510
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
511
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
512
+ # * (`nil`) indicating no credentials
513
+ # @return [::Object]
514
+ # @!attribute [rw] scope
515
+ # The OAuth scopes
516
+ # @return [::Array<::String>]
517
+ # @!attribute [rw] lib_name
518
+ # The library name as recorded in instrumentation and logging
519
+ # @return [::String]
520
+ # @!attribute [rw] lib_version
521
+ # The library version as recorded in instrumentation and logging
522
+ # @return [::String]
523
+ # @!attribute [rw] channel_args
524
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
525
+ # `GRPC::Core::Channel` object is provided as the credential.
526
+ # @return [::Hash]
527
+ # @!attribute [rw] interceptors
528
+ # An array of interceptors that are run before calls are executed.
529
+ # @return [::Array<::GRPC::ClientInterceptor>]
530
+ # @!attribute [rw] timeout
531
+ # The call timeout in seconds.
532
+ # @return [::Numeric]
533
+ # @!attribute [rw] metadata
534
+ # Additional gRPC headers to be sent with the call.
535
+ # @return [::Hash{::Symbol=>::String}]
536
+ # @!attribute [rw] retry_policy
537
+ # The retry policy. The value is a hash with the following keys:
538
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
539
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
540
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
541
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
542
+ # trigger a retry.
543
+ # @return [::Hash]
544
+ # @!attribute [rw] quota_project
545
+ # A separate project against which to charge quota.
546
+ # @return [::String]
547
+ #
548
+ class Configuration
549
+ extend ::Gapic::Config
550
+
551
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
552
+
553
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
554
+ config_attr :credentials, nil do |value|
555
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
556
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
557
+ allowed.any? { |klass| klass === value }
558
+ end
559
+ config_attr :scope, nil, ::String, ::Array, nil
560
+ config_attr :lib_name, nil, ::String, nil
561
+ config_attr :lib_version, nil, ::String, nil
562
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
563
+ config_attr :interceptors, nil, ::Array, nil
564
+ config_attr :timeout, nil, ::Numeric, nil
565
+ config_attr :metadata, nil, ::Hash, nil
566
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
567
+ config_attr :quota_project, nil, ::String, nil
568
+
569
+ # @private
570
+ def initialize parent_config = nil
571
+ @parent_config = parent_config unless parent_config.nil?
572
+
573
+ yield self if block_given?
574
+ end
575
+
576
+ ##
577
+ # Configurations for individual RPCs
578
+ # @return [Rpcs]
579
+ #
580
+ def rpcs
581
+ @rpcs ||= begin
582
+ parent_rpcs = nil
583
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
584
+ Rpcs.new parent_rpcs
585
+ end
586
+ end
587
+
588
+ ##
589
+ # Configuration RPC class for the UserEventService API.
590
+ #
591
+ # Includes fields providing the configuration for each RPC in this service.
592
+ # Each configuration object is of type `Gapic::Config::Method` and includes
593
+ # the following configuration fields:
594
+ #
595
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
596
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
597
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
598
+ # include the following keys:
599
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
600
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
601
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
602
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
603
+ # trigger a retry.
604
+ #
605
+ class Rpcs
606
+ ##
607
+ # RPC-specific configuration for `write_user_event`
608
+ # @return [::Gapic::Config::Method]
609
+ #
610
+ attr_reader :write_user_event
611
+ ##
612
+ # RPC-specific configuration for `collect_user_event`
613
+ # @return [::Gapic::Config::Method]
614
+ #
615
+ attr_reader :collect_user_event
616
+ ##
617
+ # RPC-specific configuration for `import_user_events`
618
+ # @return [::Gapic::Config::Method]
619
+ #
620
+ attr_reader :import_user_events
621
+
622
+ # @private
623
+ def initialize parent_rpcs = nil
624
+ write_user_event_config = parent_rpcs.write_user_event if parent_rpcs.respond_to? :write_user_event
625
+ @write_user_event = ::Gapic::Config::Method.new write_user_event_config
626
+ collect_user_event_config = parent_rpcs.collect_user_event if parent_rpcs.respond_to? :collect_user_event
627
+ @collect_user_event = ::Gapic::Config::Method.new collect_user_event_config
628
+ import_user_events_config = parent_rpcs.import_user_events if parent_rpcs.respond_to? :import_user_events
629
+ @import_user_events = ::Gapic::Config::Method.new import_user_events_config
630
+
631
+ yield self if block_given?
632
+ end
633
+ end
634
+ end
635
+ end
636
+ end
637
+ end
638
+ end
639
+ end
640
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2023 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 "googleauth"
20
+
21
+ module Google
22
+ module Cloud
23
+ module DiscoveryEngine
24
+ module V1
25
+ module UserEventService
26
+ # Credentials for the UserEventService API.
27
+ class Credentials < ::Google::Auth::Credentials
28
+ self.scope = [
29
+ "https://www.googleapis.com/auth/cloud-platform"
30
+ ]
31
+ self.env_vars = [
32
+ "GOOGLE_CLOUD_CREDENTIALS",
33
+ "GOOGLE_CLOUD_KEYFILE",
34
+ "GCLOUD_KEYFILE",
35
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
36
+ "GOOGLE_CLOUD_KEYFILE_JSON",
37
+ "GCLOUD_KEYFILE_JSON"
38
+ ]
39
+ self.paths = [
40
+ "~/.config/google_cloud/application_default_credentials.json"
41
+ ]
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end