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,839 @@
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/schema_service_pb"
21
+
22
+ module Google
23
+ module Cloud
24
+ module DiscoveryEngine
25
+ module V1
26
+ module SchemaService
27
+ ##
28
+ # Client for the SchemaService service.
29
+ #
30
+ # Service for managing {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}s.
31
+ #
32
+ class Client
33
+ include Paths
34
+
35
+ # @private
36
+ attr_reader :schema_service_stub
37
+
38
+ ##
39
+ # Configure the SchemaService Client class.
40
+ #
41
+ # See {::Google::Cloud::DiscoveryEngine::V1::SchemaService::Client::Configuration}
42
+ # for a description of the configuration fields.
43
+ #
44
+ # @example
45
+ #
46
+ # # Modify the configuration for all SchemaService clients
47
+ # ::Google::Cloud::DiscoveryEngine::V1::SchemaService::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
73
+ end
74
+ yield @configure if block_given?
75
+ @configure
76
+ end
77
+
78
+ ##
79
+ # Configure the SchemaService Client instance.
80
+ #
81
+ # The configuration is set to the derived mode, meaning that values can be changed,
82
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
83
+ # should be made on {Client.configure}.
84
+ #
85
+ # See {::Google::Cloud::DiscoveryEngine::V1::SchemaService::Client::Configuration}
86
+ # for a description of the configuration fields.
87
+ #
88
+ # @yield [config] Configure the Client client.
89
+ # @yieldparam config [Client::Configuration]
90
+ #
91
+ # @return [Client::Configuration]
92
+ #
93
+ def configure
94
+ yield @config if block_given?
95
+ @config
96
+ end
97
+
98
+ ##
99
+ # Create a new SchemaService client object.
100
+ #
101
+ # @example
102
+ #
103
+ # # Create a client using the default configuration
104
+ # client = ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Client.new
105
+ #
106
+ # # Create a client using a custom configuration
107
+ # client = ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Client.new do |config|
108
+ # config.timeout = 10.0
109
+ # end
110
+ #
111
+ # @yield [config] Configure the SchemaService client.
112
+ # @yieldparam config [Client::Configuration]
113
+ #
114
+ def initialize
115
+ # These require statements are intentionally placed here to initialize
116
+ # the gRPC module only when it's required.
117
+ # See https://github.com/googleapis/toolkit/issues/446
118
+ require "gapic/grpc"
119
+ require "google/cloud/discoveryengine/v1/schema_service_services_pb"
120
+
121
+ # Create the configuration object
122
+ @config = Configuration.new Client.configure
123
+
124
+ # Yield the configuration if needed
125
+ yield @config if block_given?
126
+
127
+ # Create credentials
128
+ credentials = @config.credentials
129
+ # Use self-signed JWT if the endpoint is unchanged from default,
130
+ # but only if the default endpoint does not have a region prefix.
131
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
132
+ !@config.endpoint.split(".").first.include?("-")
133
+ credentials ||= Credentials.default scope: @config.scope,
134
+ enable_self_signed_jwt: enable_self_signed_jwt
135
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
136
+ credentials = Credentials.new credentials, scope: @config.scope
137
+ end
138
+ @quota_project_id = @config.quota_project
139
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
140
+
141
+ @operations_client = Operations.new do |config|
142
+ config.credentials = credentials
143
+ config.quota_project = @quota_project_id
144
+ config.endpoint = @config.endpoint
145
+ end
146
+
147
+ @schema_service_stub = ::Gapic::ServiceStub.new(
148
+ ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Stub,
149
+ credentials: credentials,
150
+ endpoint: @config.endpoint,
151
+ channel_args: @config.channel_args,
152
+ interceptors: @config.interceptors
153
+ )
154
+ end
155
+
156
+ ##
157
+ # Get the associated client for long-running operations.
158
+ #
159
+ # @return [::Google::Cloud::DiscoveryEngine::V1::SchemaService::Operations]
160
+ #
161
+ attr_reader :operations_client
162
+
163
+ # Service calls
164
+
165
+ ##
166
+ # Gets a {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}.
167
+ #
168
+ # @overload get_schema(request, options = nil)
169
+ # Pass arguments to `get_schema` via a request object, either of type
170
+ # {::Google::Cloud::DiscoveryEngine::V1::GetSchemaRequest} or an equivalent Hash.
171
+ #
172
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::GetSchemaRequest, ::Hash]
173
+ # A request object representing the call parameters. Required. To specify no
174
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
175
+ # @param options [::Gapic::CallOptions, ::Hash]
176
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
177
+ #
178
+ # @overload get_schema(name: nil)
179
+ # Pass arguments to `get_schema` via keyword arguments. Note that at
180
+ # least one keyword argument is required. To specify no parameters, or to keep all
181
+ # the default parameter values, pass an empty Hash as a request object (see above).
182
+ #
183
+ # @param name [::String]
184
+ # Required. The full resource name of the schema, in the format of
185
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}`.
186
+ #
187
+ # @yield [response, operation] Access the result along with the RPC operation
188
+ # @yieldparam response [::Google::Cloud::DiscoveryEngine::V1::Schema]
189
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
190
+ #
191
+ # @return [::Google::Cloud::DiscoveryEngine::V1::Schema]
192
+ #
193
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
194
+ #
195
+ # @example Basic example
196
+ # require "google/cloud/discovery_engine/v1"
197
+ #
198
+ # # Create a client object. The client can be reused for multiple calls.
199
+ # client = Google::Cloud::DiscoveryEngine::V1::SchemaService::Client.new
200
+ #
201
+ # # Create a request. To set request fields, pass in keyword arguments.
202
+ # request = Google::Cloud::DiscoveryEngine::V1::GetSchemaRequest.new
203
+ #
204
+ # # Call the get_schema method.
205
+ # result = client.get_schema request
206
+ #
207
+ # # The returned object is of type Google::Cloud::DiscoveryEngine::V1::Schema.
208
+ # p result
209
+ #
210
+ def get_schema request, options = nil
211
+ raise ::ArgumentError, "request must be provided" if request.nil?
212
+
213
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::GetSchemaRequest
214
+
215
+ # Converts hash and nil to an options object
216
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
217
+
218
+ # Customize the options with defaults
219
+ metadata = @config.rpcs.get_schema.metadata.to_h
220
+
221
+ # Set x-goog-api-client and x-goog-user-project headers
222
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
223
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
224
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
225
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
226
+
227
+ header_params = {}
228
+ if request.name
229
+ header_params["name"] = request.name
230
+ end
231
+
232
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
233
+ metadata[:"x-goog-request-params"] ||= request_params_header
234
+
235
+ options.apply_defaults timeout: @config.rpcs.get_schema.timeout,
236
+ metadata: metadata,
237
+ retry_policy: @config.rpcs.get_schema.retry_policy
238
+
239
+ options.apply_defaults timeout: @config.timeout,
240
+ metadata: @config.metadata,
241
+ retry_policy: @config.retry_policy
242
+
243
+ @schema_service_stub.call_rpc :get_schema, request, options: options do |response, operation|
244
+ yield response, operation if block_given?
245
+ return response
246
+ end
247
+ rescue ::GRPC::BadStatus => e
248
+ raise ::Google::Cloud::Error.from_error(e)
249
+ end
250
+
251
+ ##
252
+ # Gets a list of {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}s.
253
+ #
254
+ # @overload list_schemas(request, options = nil)
255
+ # Pass arguments to `list_schemas` via a request object, either of type
256
+ # {::Google::Cloud::DiscoveryEngine::V1::ListSchemasRequest} or an equivalent Hash.
257
+ #
258
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::ListSchemasRequest, ::Hash]
259
+ # A request object representing the call parameters. Required. To specify no
260
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
261
+ # @param options [::Gapic::CallOptions, ::Hash]
262
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
263
+ #
264
+ # @overload list_schemas(parent: nil, page_size: nil, page_token: nil)
265
+ # Pass arguments to `list_schemas` via keyword arguments. Note that at
266
+ # least one keyword argument is required. To specify no parameters, or to keep all
267
+ # the default parameter values, pass an empty Hash as a request object (see above).
268
+ #
269
+ # @param parent [::String]
270
+ # Required. The parent data store resource name, in the format of
271
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
272
+ # @param page_size [::Integer]
273
+ # The maximum number of {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}s to
274
+ # return. The service may return fewer than this value.
275
+ #
276
+ # If unspecified, at most 100
277
+ # {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}s will be returned.
278
+ #
279
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
280
+ # @param page_token [::String]
281
+ # A page token, received from a previous
282
+ # {::Google::Cloud::DiscoveryEngine::V1::SchemaService::Client#list_schemas SchemaService.ListSchemas}
283
+ # call. Provide this to retrieve the subsequent page.
284
+ #
285
+ # When paginating, all other parameters provided to
286
+ # {::Google::Cloud::DiscoveryEngine::V1::SchemaService::Client#list_schemas SchemaService.ListSchemas}
287
+ # must match the call that provided the page token.
288
+ #
289
+ # @yield [response, operation] Access the result along with the RPC operation
290
+ # @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Schema>]
291
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
292
+ #
293
+ # @return [::Gapic::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Schema>]
294
+ #
295
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
296
+ #
297
+ # @example Basic example
298
+ # require "google/cloud/discovery_engine/v1"
299
+ #
300
+ # # Create a client object. The client can be reused for multiple calls.
301
+ # client = Google::Cloud::DiscoveryEngine::V1::SchemaService::Client.new
302
+ #
303
+ # # Create a request. To set request fields, pass in keyword arguments.
304
+ # request = Google::Cloud::DiscoveryEngine::V1::ListSchemasRequest.new
305
+ #
306
+ # # Call the list_schemas method.
307
+ # result = client.list_schemas request
308
+ #
309
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
310
+ # # over elements, and API calls will be issued to fetch pages as needed.
311
+ # result.each do |item|
312
+ # # Each element is of type ::Google::Cloud::DiscoveryEngine::V1::Schema.
313
+ # p item
314
+ # end
315
+ #
316
+ def list_schemas request, options = nil
317
+ raise ::ArgumentError, "request must be provided" if request.nil?
318
+
319
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ListSchemasRequest
320
+
321
+ # Converts hash and nil to an options object
322
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
323
+
324
+ # Customize the options with defaults
325
+ metadata = @config.rpcs.list_schemas.metadata.to_h
326
+
327
+ # Set x-goog-api-client and x-goog-user-project headers
328
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
329
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
330
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
331
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
332
+
333
+ header_params = {}
334
+ if request.parent
335
+ header_params["parent"] = request.parent
336
+ end
337
+
338
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
339
+ metadata[:"x-goog-request-params"] ||= request_params_header
340
+
341
+ options.apply_defaults timeout: @config.rpcs.list_schemas.timeout,
342
+ metadata: metadata,
343
+ retry_policy: @config.rpcs.list_schemas.retry_policy
344
+
345
+ options.apply_defaults timeout: @config.timeout,
346
+ metadata: @config.metadata,
347
+ retry_policy: @config.retry_policy
348
+
349
+ @schema_service_stub.call_rpc :list_schemas, request, options: options do |response, operation|
350
+ response = ::Gapic::PagedEnumerable.new @schema_service_stub, :list_schemas, request, response, operation, options
351
+ yield response, operation if block_given?
352
+ return response
353
+ end
354
+ rescue ::GRPC::BadStatus => e
355
+ raise ::Google::Cloud::Error.from_error(e)
356
+ end
357
+
358
+ ##
359
+ # Creates a {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}.
360
+ #
361
+ # @overload create_schema(request, options = nil)
362
+ # Pass arguments to `create_schema` via a request object, either of type
363
+ # {::Google::Cloud::DiscoveryEngine::V1::CreateSchemaRequest} or an equivalent Hash.
364
+ #
365
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::CreateSchemaRequest, ::Hash]
366
+ # A request object representing the call parameters. Required. To specify no
367
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
368
+ # @param options [::Gapic::CallOptions, ::Hash]
369
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
370
+ #
371
+ # @overload create_schema(parent: nil, schema: nil, schema_id: nil)
372
+ # Pass arguments to `create_schema` via keyword arguments. Note that at
373
+ # least one keyword argument is required. To specify no parameters, or to keep all
374
+ # the default parameter values, pass an empty Hash as a request object (see above).
375
+ #
376
+ # @param parent [::String]
377
+ # Required. The parent data store resource name, in the format of
378
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
379
+ # @param schema [::Google::Cloud::DiscoveryEngine::V1::Schema, ::Hash]
380
+ # Required. The {::Google::Cloud::DiscoveryEngine::V1::Schema Schema} to create.
381
+ # @param schema_id [::String]
382
+ # Required. The ID to use for the
383
+ # {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}, which will become the
384
+ # final component of the
385
+ # {::Google::Cloud::DiscoveryEngine::V1::Schema#name Schema.name}.
386
+ #
387
+ # This field should conform to
388
+ # [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length
389
+ # limit of 63 characters.
390
+ #
391
+ # @yield [response, operation] Access the result along with the RPC operation
392
+ # @yieldparam response [::Gapic::Operation]
393
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
394
+ #
395
+ # @return [::Gapic::Operation]
396
+ #
397
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
398
+ #
399
+ # @example Basic example
400
+ # require "google/cloud/discovery_engine/v1"
401
+ #
402
+ # # Create a client object. The client can be reused for multiple calls.
403
+ # client = Google::Cloud::DiscoveryEngine::V1::SchemaService::Client.new
404
+ #
405
+ # # Create a request. To set request fields, pass in keyword arguments.
406
+ # request = Google::Cloud::DiscoveryEngine::V1::CreateSchemaRequest.new
407
+ #
408
+ # # Call the create_schema method.
409
+ # result = client.create_schema request
410
+ #
411
+ # # The returned object is of type Gapic::Operation. You can use it to
412
+ # # check the status of an operation, cancel it, or wait for results.
413
+ # # Here is how to wait for a response.
414
+ # result.wait_until_done! timeout: 60
415
+ # if result.response?
416
+ # p result.response
417
+ # else
418
+ # puts "No response received."
419
+ # end
420
+ #
421
+ def create_schema request, options = nil
422
+ raise ::ArgumentError, "request must be provided" if request.nil?
423
+
424
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::CreateSchemaRequest
425
+
426
+ # Converts hash and nil to an options object
427
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
428
+
429
+ # Customize the options with defaults
430
+ metadata = @config.rpcs.create_schema.metadata.to_h
431
+
432
+ # Set x-goog-api-client and x-goog-user-project headers
433
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
434
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
435
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
436
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
437
+
438
+ header_params = {}
439
+ if request.parent
440
+ header_params["parent"] = request.parent
441
+ end
442
+
443
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
444
+ metadata[:"x-goog-request-params"] ||= request_params_header
445
+
446
+ options.apply_defaults timeout: @config.rpcs.create_schema.timeout,
447
+ metadata: metadata,
448
+ retry_policy: @config.rpcs.create_schema.retry_policy
449
+
450
+ options.apply_defaults timeout: @config.timeout,
451
+ metadata: @config.metadata,
452
+ retry_policy: @config.retry_policy
453
+
454
+ @schema_service_stub.call_rpc :create_schema, request, options: options do |response, operation|
455
+ response = ::Gapic::Operation.new response, @operations_client, options: options
456
+ yield response, operation if block_given?
457
+ return response
458
+ end
459
+ rescue ::GRPC::BadStatus => e
460
+ raise ::Google::Cloud::Error.from_error(e)
461
+ end
462
+
463
+ ##
464
+ # Updates a {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}.
465
+ #
466
+ # @overload update_schema(request, options = nil)
467
+ # Pass arguments to `update_schema` via a request object, either of type
468
+ # {::Google::Cloud::DiscoveryEngine::V1::UpdateSchemaRequest} or an equivalent Hash.
469
+ #
470
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::UpdateSchemaRequest, ::Hash]
471
+ # A request object representing the call parameters. Required. To specify no
472
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
473
+ # @param options [::Gapic::CallOptions, ::Hash]
474
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
475
+ #
476
+ # @overload update_schema(schema: nil, allow_missing: nil)
477
+ # Pass arguments to `update_schema` via keyword arguments. Note that at
478
+ # least one keyword argument is required. To specify no parameters, or to keep all
479
+ # the default parameter values, pass an empty Hash as a request object (see above).
480
+ #
481
+ # @param schema [::Google::Cloud::DiscoveryEngine::V1::Schema, ::Hash]
482
+ # Required. The {::Google::Cloud::DiscoveryEngine::V1::Schema Schema} to update.
483
+ # @param allow_missing [::Boolean]
484
+ # If set to true, and the {::Google::Cloud::DiscoveryEngine::V1::Schema Schema} is
485
+ # not found, a new {::Google::Cloud::DiscoveryEngine::V1::Schema Schema} will be
486
+ # created. In this situation, `update_mask` is ignored.
487
+ #
488
+ # @yield [response, operation] Access the result along with the RPC operation
489
+ # @yieldparam response [::Gapic::Operation]
490
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
491
+ #
492
+ # @return [::Gapic::Operation]
493
+ #
494
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
495
+ #
496
+ # @example Basic example
497
+ # require "google/cloud/discovery_engine/v1"
498
+ #
499
+ # # Create a client object. The client can be reused for multiple calls.
500
+ # client = Google::Cloud::DiscoveryEngine::V1::SchemaService::Client.new
501
+ #
502
+ # # Create a request. To set request fields, pass in keyword arguments.
503
+ # request = Google::Cloud::DiscoveryEngine::V1::UpdateSchemaRequest.new
504
+ #
505
+ # # Call the update_schema method.
506
+ # result = client.update_schema request
507
+ #
508
+ # # The returned object is of type Gapic::Operation. You can use it to
509
+ # # check the status of an operation, cancel it, or wait for results.
510
+ # # Here is how to wait for a response.
511
+ # result.wait_until_done! timeout: 60
512
+ # if result.response?
513
+ # p result.response
514
+ # else
515
+ # puts "No response received."
516
+ # end
517
+ #
518
+ def update_schema request, options = nil
519
+ raise ::ArgumentError, "request must be provided" if request.nil?
520
+
521
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::UpdateSchemaRequest
522
+
523
+ # Converts hash and nil to an options object
524
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
525
+
526
+ # Customize the options with defaults
527
+ metadata = @config.rpcs.update_schema.metadata.to_h
528
+
529
+ # Set x-goog-api-client and x-goog-user-project headers
530
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
531
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
532
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
533
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
534
+
535
+ header_params = {}
536
+ if request.schema&.name
537
+ header_params["schema.name"] = request.schema.name
538
+ end
539
+
540
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
541
+ metadata[:"x-goog-request-params"] ||= request_params_header
542
+
543
+ options.apply_defaults timeout: @config.rpcs.update_schema.timeout,
544
+ metadata: metadata,
545
+ retry_policy: @config.rpcs.update_schema.retry_policy
546
+
547
+ options.apply_defaults timeout: @config.timeout,
548
+ metadata: @config.metadata,
549
+ retry_policy: @config.retry_policy
550
+
551
+ @schema_service_stub.call_rpc :update_schema, request, options: options do |response, operation|
552
+ response = ::Gapic::Operation.new response, @operations_client, options: options
553
+ yield response, operation if block_given?
554
+ return response
555
+ end
556
+ rescue ::GRPC::BadStatus => e
557
+ raise ::Google::Cloud::Error.from_error(e)
558
+ end
559
+
560
+ ##
561
+ # Deletes a {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}.
562
+ #
563
+ # @overload delete_schema(request, options = nil)
564
+ # Pass arguments to `delete_schema` via a request object, either of type
565
+ # {::Google::Cloud::DiscoveryEngine::V1::DeleteSchemaRequest} or an equivalent Hash.
566
+ #
567
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::DeleteSchemaRequest, ::Hash]
568
+ # A request object representing the call parameters. Required. To specify no
569
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
570
+ # @param options [::Gapic::CallOptions, ::Hash]
571
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
572
+ #
573
+ # @overload delete_schema(name: nil)
574
+ # Pass arguments to `delete_schema` via keyword arguments. Note that at
575
+ # least one keyword argument is required. To specify no parameters, or to keep all
576
+ # the default parameter values, pass an empty Hash as a request object (see above).
577
+ #
578
+ # @param name [::String]
579
+ # Required. The full resource name of the schema, in the format of
580
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}`.
581
+ #
582
+ # @yield [response, operation] Access the result along with the RPC operation
583
+ # @yieldparam response [::Gapic::Operation]
584
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
585
+ #
586
+ # @return [::Gapic::Operation]
587
+ #
588
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
589
+ #
590
+ # @example Basic example
591
+ # require "google/cloud/discovery_engine/v1"
592
+ #
593
+ # # Create a client object. The client can be reused for multiple calls.
594
+ # client = Google::Cloud::DiscoveryEngine::V1::SchemaService::Client.new
595
+ #
596
+ # # Create a request. To set request fields, pass in keyword arguments.
597
+ # request = Google::Cloud::DiscoveryEngine::V1::DeleteSchemaRequest.new
598
+ #
599
+ # # Call the delete_schema method.
600
+ # result = client.delete_schema request
601
+ #
602
+ # # The returned object is of type Gapic::Operation. You can use it to
603
+ # # check the status of an operation, cancel it, or wait for results.
604
+ # # Here is how to wait for a response.
605
+ # result.wait_until_done! timeout: 60
606
+ # if result.response?
607
+ # p result.response
608
+ # else
609
+ # puts "No response received."
610
+ # end
611
+ #
612
+ def delete_schema request, options = nil
613
+ raise ::ArgumentError, "request must be provided" if request.nil?
614
+
615
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::DeleteSchemaRequest
616
+
617
+ # Converts hash and nil to an options object
618
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
619
+
620
+ # Customize the options with defaults
621
+ metadata = @config.rpcs.delete_schema.metadata.to_h
622
+
623
+ # Set x-goog-api-client and x-goog-user-project headers
624
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
625
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
626
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION
627
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
628
+
629
+ header_params = {}
630
+ if request.name
631
+ header_params["name"] = request.name
632
+ end
633
+
634
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
635
+ metadata[:"x-goog-request-params"] ||= request_params_header
636
+
637
+ options.apply_defaults timeout: @config.rpcs.delete_schema.timeout,
638
+ metadata: metadata,
639
+ retry_policy: @config.rpcs.delete_schema.retry_policy
640
+
641
+ options.apply_defaults timeout: @config.timeout,
642
+ metadata: @config.metadata,
643
+ retry_policy: @config.retry_policy
644
+
645
+ @schema_service_stub.call_rpc :delete_schema, request, options: options do |response, operation|
646
+ response = ::Gapic::Operation.new response, @operations_client, options: options
647
+ yield response, operation if block_given?
648
+ return response
649
+ end
650
+ rescue ::GRPC::BadStatus => e
651
+ raise ::Google::Cloud::Error.from_error(e)
652
+ end
653
+
654
+ ##
655
+ # Configuration class for the SchemaService API.
656
+ #
657
+ # This class represents the configuration for SchemaService,
658
+ # providing control over timeouts, retry behavior, logging, transport
659
+ # parameters, and other low-level controls. Certain parameters can also be
660
+ # applied individually to specific RPCs. See
661
+ # {::Google::Cloud::DiscoveryEngine::V1::SchemaService::Client::Configuration::Rpcs}
662
+ # for a list of RPCs that can be configured independently.
663
+ #
664
+ # Configuration can be applied globally to all clients, or to a single client
665
+ # on construction.
666
+ #
667
+ # @example
668
+ #
669
+ # # Modify the global config, setting the timeout for
670
+ # # get_schema to 20 seconds,
671
+ # # and all remaining timeouts to 10 seconds.
672
+ # ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Client.configure do |config|
673
+ # config.timeout = 10.0
674
+ # config.rpcs.get_schema.timeout = 20.0
675
+ # end
676
+ #
677
+ # # Apply the above configuration only to a new client.
678
+ # client = ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Client.new do |config|
679
+ # config.timeout = 10.0
680
+ # config.rpcs.get_schema.timeout = 20.0
681
+ # end
682
+ #
683
+ # @!attribute [rw] endpoint
684
+ # The hostname or hostname:port of the service endpoint.
685
+ # Defaults to `"discoveryengine.googleapis.com"`.
686
+ # @return [::String]
687
+ # @!attribute [rw] credentials
688
+ # Credentials to send with calls. You may provide any of the following types:
689
+ # * (`String`) The path to a service account key file in JSON format
690
+ # * (`Hash`) A service account key as a Hash
691
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
692
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
693
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
694
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
695
+ # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
696
+ # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
697
+ # * (`nil`) indicating no credentials
698
+ # @return [::Object]
699
+ # @!attribute [rw] scope
700
+ # The OAuth scopes
701
+ # @return [::Array<::String>]
702
+ # @!attribute [rw] lib_name
703
+ # The library name as recorded in instrumentation and logging
704
+ # @return [::String]
705
+ # @!attribute [rw] lib_version
706
+ # The library version as recorded in instrumentation and logging
707
+ # @return [::String]
708
+ # @!attribute [rw] channel_args
709
+ # Extra parameters passed to the gRPC channel. Note: this is ignored if a
710
+ # `GRPC::Core::Channel` object is provided as the credential.
711
+ # @return [::Hash]
712
+ # @!attribute [rw] interceptors
713
+ # An array of interceptors that are run before calls are executed.
714
+ # @return [::Array<::GRPC::ClientInterceptor>]
715
+ # @!attribute [rw] timeout
716
+ # The call timeout in seconds.
717
+ # @return [::Numeric]
718
+ # @!attribute [rw] metadata
719
+ # Additional gRPC headers to be sent with the call.
720
+ # @return [::Hash{::Symbol=>::String}]
721
+ # @!attribute [rw] retry_policy
722
+ # The retry policy. The value is a hash with the following keys:
723
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
724
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
725
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
726
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
727
+ # trigger a retry.
728
+ # @return [::Hash]
729
+ # @!attribute [rw] quota_project
730
+ # A separate project against which to charge quota.
731
+ # @return [::String]
732
+ #
733
+ class Configuration
734
+ extend ::Gapic::Config
735
+
736
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
737
+
738
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
739
+ config_attr :credentials, nil do |value|
740
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
741
+ allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
742
+ allowed.any? { |klass| klass === value }
743
+ end
744
+ config_attr :scope, nil, ::String, ::Array, nil
745
+ config_attr :lib_name, nil, ::String, nil
746
+ config_attr :lib_version, nil, ::String, nil
747
+ config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
748
+ config_attr :interceptors, nil, ::Array, nil
749
+ config_attr :timeout, nil, ::Numeric, nil
750
+ config_attr :metadata, nil, ::Hash, nil
751
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
752
+ config_attr :quota_project, nil, ::String, nil
753
+
754
+ # @private
755
+ def initialize parent_config = nil
756
+ @parent_config = parent_config unless parent_config.nil?
757
+
758
+ yield self if block_given?
759
+ end
760
+
761
+ ##
762
+ # Configurations for individual RPCs
763
+ # @return [Rpcs]
764
+ #
765
+ def rpcs
766
+ @rpcs ||= begin
767
+ parent_rpcs = nil
768
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
769
+ Rpcs.new parent_rpcs
770
+ end
771
+ end
772
+
773
+ ##
774
+ # Configuration RPC class for the SchemaService API.
775
+ #
776
+ # Includes fields providing the configuration for each RPC in this service.
777
+ # Each configuration object is of type `Gapic::Config::Method` and includes
778
+ # the following configuration fields:
779
+ #
780
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
781
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
782
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
783
+ # include the following keys:
784
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
785
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
786
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
787
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
788
+ # trigger a retry.
789
+ #
790
+ class Rpcs
791
+ ##
792
+ # RPC-specific configuration for `get_schema`
793
+ # @return [::Gapic::Config::Method]
794
+ #
795
+ attr_reader :get_schema
796
+ ##
797
+ # RPC-specific configuration for `list_schemas`
798
+ # @return [::Gapic::Config::Method]
799
+ #
800
+ attr_reader :list_schemas
801
+ ##
802
+ # RPC-specific configuration for `create_schema`
803
+ # @return [::Gapic::Config::Method]
804
+ #
805
+ attr_reader :create_schema
806
+ ##
807
+ # RPC-specific configuration for `update_schema`
808
+ # @return [::Gapic::Config::Method]
809
+ #
810
+ attr_reader :update_schema
811
+ ##
812
+ # RPC-specific configuration for `delete_schema`
813
+ # @return [::Gapic::Config::Method]
814
+ #
815
+ attr_reader :delete_schema
816
+
817
+ # @private
818
+ def initialize parent_rpcs = nil
819
+ get_schema_config = parent_rpcs.get_schema if parent_rpcs.respond_to? :get_schema
820
+ @get_schema = ::Gapic::Config::Method.new get_schema_config
821
+ list_schemas_config = parent_rpcs.list_schemas if parent_rpcs.respond_to? :list_schemas
822
+ @list_schemas = ::Gapic::Config::Method.new list_schemas_config
823
+ create_schema_config = parent_rpcs.create_schema if parent_rpcs.respond_to? :create_schema
824
+ @create_schema = ::Gapic::Config::Method.new create_schema_config
825
+ update_schema_config = parent_rpcs.update_schema if parent_rpcs.respond_to? :update_schema
826
+ @update_schema = ::Gapic::Config::Method.new update_schema_config
827
+ delete_schema_config = parent_rpcs.delete_schema if parent_rpcs.respond_to? :delete_schema
828
+ @delete_schema = ::Gapic::Config::Method.new delete_schema_config
829
+
830
+ yield self if block_given?
831
+ end
832
+ end
833
+ end
834
+ end
835
+ end
836
+ end
837
+ end
838
+ end
839
+ end