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,679 @@
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
+ require "google/cloud/discovery_engine/v1/schema_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Cloud
25
+ module DiscoveryEngine
26
+ module V1
27
+ module SchemaService
28
+ module Rest
29
+ ##
30
+ # REST client for the SchemaService service.
31
+ #
32
+ # Service for managing {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}s.
33
+ #
34
+ class Client
35
+ include Paths
36
+
37
+ # @private
38
+ attr_reader :schema_service_stub
39
+
40
+ ##
41
+ # Configure the SchemaService Client class.
42
+ #
43
+ # See {::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client::Configuration}
44
+ # for a description of the configuration fields.
45
+ #
46
+ # @example
47
+ #
48
+ # # Modify the configuration for all SchemaService clients
49
+ # ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client.configure do |config|
50
+ # config.timeout = 10.0
51
+ # end
52
+ #
53
+ # @yield [config] Configure the Client client.
54
+ # @yieldparam config [Client::Configuration]
55
+ #
56
+ # @return [Client::Configuration]
57
+ #
58
+ def self.configure
59
+ @configure ||= begin
60
+ namespace = ["Google", "Cloud", "DiscoveryEngine", "V1"]
61
+ parent_config = while namespace.any?
62
+ parent_name = namespace.join "::"
63
+ parent_const = const_get parent_name
64
+ break parent_const.configure if parent_const.respond_to? :configure
65
+ namespace.pop
66
+ end
67
+ default_config = Client::Configuration.new parent_config
68
+
69
+ default_config.timeout = 30.0
70
+ default_config.retry_policy = {
71
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
72
+ }
73
+
74
+ default_config
75
+ end
76
+ yield @configure if block_given?
77
+ @configure
78
+ end
79
+
80
+ ##
81
+ # Configure the SchemaService Client instance.
82
+ #
83
+ # The configuration is set to the derived mode, meaning that values can be changed,
84
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
85
+ # should be made on {Client.configure}.
86
+ #
87
+ # See {::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client::Configuration}
88
+ # for a description of the configuration fields.
89
+ #
90
+ # @yield [config] Configure the Client client.
91
+ # @yieldparam config [Client::Configuration]
92
+ #
93
+ # @return [Client::Configuration]
94
+ #
95
+ def configure
96
+ yield @config if block_given?
97
+ @config
98
+ end
99
+
100
+ ##
101
+ # Create a new SchemaService REST client object.
102
+ #
103
+ # @example
104
+ #
105
+ # # Create a client using the default configuration
106
+ # client = ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client.new
107
+ #
108
+ # # Create a client using a custom configuration
109
+ # client = ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client.new do |config|
110
+ # config.timeout = 10.0
111
+ # end
112
+ #
113
+ # @yield [config] Configure the SchemaService client.
114
+ # @yieldparam config [Client::Configuration]
115
+ #
116
+ def initialize
117
+ # Create the configuration object
118
+ @config = Configuration.new Client.configure
119
+
120
+ # Yield the configuration if needed
121
+ yield @config if block_given?
122
+
123
+ # Create credentials
124
+ credentials = @config.credentials
125
+ # Use self-signed JWT if the endpoint is unchanged from default,
126
+ # but only if the default endpoint does not have a region prefix.
127
+ enable_self_signed_jwt = @config.endpoint == Configuration::DEFAULT_ENDPOINT &&
128
+ !@config.endpoint.split(".").first.include?("-")
129
+ credentials ||= Credentials.default scope: @config.scope,
130
+ enable_self_signed_jwt: enable_self_signed_jwt
131
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
132
+ credentials = Credentials.new credentials, scope: @config.scope
133
+ end
134
+
135
+ @quota_project_id = @config.quota_project
136
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
137
+
138
+ @operations_client = ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Operations.new do |config|
139
+ config.credentials = credentials
140
+ config.quota_project = @quota_project_id
141
+ config.endpoint = @config.endpoint
142
+ end
143
+
144
+ @schema_service_stub = ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::ServiceStub.new endpoint: @config.endpoint, credentials: credentials
145
+ end
146
+
147
+ ##
148
+ # Get the associated client for long-running operations.
149
+ #
150
+ # @return [::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Operations]
151
+ #
152
+ attr_reader :operations_client
153
+
154
+ # Service calls
155
+
156
+ ##
157
+ # Gets a {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}.
158
+ #
159
+ # @overload get_schema(request, options = nil)
160
+ # Pass arguments to `get_schema` via a request object, either of type
161
+ # {::Google::Cloud::DiscoveryEngine::V1::GetSchemaRequest} or an equivalent Hash.
162
+ #
163
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::GetSchemaRequest, ::Hash]
164
+ # A request object representing the call parameters. Required. To specify no
165
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
166
+ # @param options [::Gapic::CallOptions, ::Hash]
167
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
168
+ #
169
+ # @overload get_schema(name: nil)
170
+ # Pass arguments to `get_schema` via keyword arguments. Note that at
171
+ # least one keyword argument is required. To specify no parameters, or to keep all
172
+ # the default parameter values, pass an empty Hash as a request object (see above).
173
+ #
174
+ # @param name [::String]
175
+ # Required. The full resource name of the schema, in the format of
176
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}`.
177
+ # @yield [result, operation] Access the result along with the TransportOperation object
178
+ # @yieldparam result [::Google::Cloud::DiscoveryEngine::V1::Schema]
179
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
180
+ #
181
+ # @return [::Google::Cloud::DiscoveryEngine::V1::Schema]
182
+ #
183
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
184
+ def get_schema request, options = nil
185
+ raise ::ArgumentError, "request must be provided" if request.nil?
186
+
187
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::GetSchemaRequest
188
+
189
+ # Converts hash and nil to an options object
190
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
191
+
192
+ # Customize the options with defaults
193
+ call_metadata = @config.rpcs.get_schema.metadata.to_h
194
+
195
+ # Set x-goog-api-client and x-goog-user-project headers
196
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
197
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
198
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
199
+ transports_version_send: [:rest]
200
+
201
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
202
+
203
+ options.apply_defaults timeout: @config.rpcs.get_schema.timeout,
204
+ metadata: call_metadata,
205
+ retry_policy: @config.rpcs.get_schema.retry_policy
206
+
207
+ options.apply_defaults timeout: @config.timeout,
208
+ metadata: @config.metadata,
209
+ retry_policy: @config.retry_policy
210
+
211
+ @schema_service_stub.get_schema request, options do |result, operation|
212
+ yield result, operation if block_given?
213
+ return result
214
+ end
215
+ rescue ::Gapic::Rest::Error => e
216
+ raise ::Google::Cloud::Error.from_error(e)
217
+ end
218
+
219
+ ##
220
+ # Gets a list of {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}s.
221
+ #
222
+ # @overload list_schemas(request, options = nil)
223
+ # Pass arguments to `list_schemas` via a request object, either of type
224
+ # {::Google::Cloud::DiscoveryEngine::V1::ListSchemasRequest} or an equivalent Hash.
225
+ #
226
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::ListSchemasRequest, ::Hash]
227
+ # A request object representing the call parameters. Required. To specify no
228
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
229
+ # @param options [::Gapic::CallOptions, ::Hash]
230
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
231
+ #
232
+ # @overload list_schemas(parent: nil, page_size: nil, page_token: nil)
233
+ # Pass arguments to `list_schemas` via keyword arguments. Note that at
234
+ # least one keyword argument is required. To specify no parameters, or to keep all
235
+ # the default parameter values, pass an empty Hash as a request object (see above).
236
+ #
237
+ # @param parent [::String]
238
+ # Required. The parent data store resource name, in the format of
239
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
240
+ # @param page_size [::Integer]
241
+ # The maximum number of {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}s to
242
+ # return. The service may return fewer than this value.
243
+ #
244
+ # If unspecified, at most 100
245
+ # {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}s will be returned.
246
+ #
247
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
248
+ # @param page_token [::String]
249
+ # A page token, received from a previous
250
+ # {::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client#list_schemas SchemaService.ListSchemas}
251
+ # call. Provide this to retrieve the subsequent page.
252
+ #
253
+ # When paginating, all other parameters provided to
254
+ # {::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client#list_schemas SchemaService.ListSchemas}
255
+ # must match the call that provided the page token.
256
+ # @yield [result, operation] Access the result along with the TransportOperation object
257
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Schema>]
258
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
259
+ #
260
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1::Schema>]
261
+ #
262
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
263
+ def list_schemas request, options = nil
264
+ raise ::ArgumentError, "request must be provided" if request.nil?
265
+
266
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::ListSchemasRequest
267
+
268
+ # Converts hash and nil to an options object
269
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
270
+
271
+ # Customize the options with defaults
272
+ call_metadata = @config.rpcs.list_schemas.metadata.to_h
273
+
274
+ # Set x-goog-api-client and x-goog-user-project headers
275
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
276
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
277
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
278
+ transports_version_send: [:rest]
279
+
280
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
281
+
282
+ options.apply_defaults timeout: @config.rpcs.list_schemas.timeout,
283
+ metadata: call_metadata,
284
+ retry_policy: @config.rpcs.list_schemas.retry_policy
285
+
286
+ options.apply_defaults timeout: @config.timeout,
287
+ metadata: @config.metadata,
288
+ retry_policy: @config.retry_policy
289
+
290
+ @schema_service_stub.list_schemas request, options do |result, operation|
291
+ result = ::Gapic::Rest::PagedEnumerable.new @schema_service_stub, :list_schemas, "schemas", request, result, options
292
+ yield result, operation if block_given?
293
+ return result
294
+ end
295
+ rescue ::Gapic::Rest::Error => e
296
+ raise ::Google::Cloud::Error.from_error(e)
297
+ end
298
+
299
+ ##
300
+ # Creates a {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}.
301
+ #
302
+ # @overload create_schema(request, options = nil)
303
+ # Pass arguments to `create_schema` via a request object, either of type
304
+ # {::Google::Cloud::DiscoveryEngine::V1::CreateSchemaRequest} or an equivalent Hash.
305
+ #
306
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::CreateSchemaRequest, ::Hash]
307
+ # A request object representing the call parameters. Required. To specify no
308
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
309
+ # @param options [::Gapic::CallOptions, ::Hash]
310
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
311
+ #
312
+ # @overload create_schema(parent: nil, schema: nil, schema_id: nil)
313
+ # Pass arguments to `create_schema` via keyword arguments. Note that at
314
+ # least one keyword argument is required. To specify no parameters, or to keep all
315
+ # the default parameter values, pass an empty Hash as a request object (see above).
316
+ #
317
+ # @param parent [::String]
318
+ # Required. The parent data store resource name, in the format of
319
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`.
320
+ # @param schema [::Google::Cloud::DiscoveryEngine::V1::Schema, ::Hash]
321
+ # Required. The {::Google::Cloud::DiscoveryEngine::V1::Schema Schema} to create.
322
+ # @param schema_id [::String]
323
+ # Required. The ID to use for the
324
+ # {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}, which will become the
325
+ # final component of the
326
+ # {::Google::Cloud::DiscoveryEngine::V1::Schema#name Schema.name}.
327
+ #
328
+ # This field should conform to
329
+ # [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length
330
+ # limit of 63 characters.
331
+ # @yield [result, operation] Access the result along with the TransportOperation object
332
+ # @yieldparam result [::Gapic::Operation]
333
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
334
+ #
335
+ # @return [::Gapic::Operation]
336
+ #
337
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
338
+ def create_schema request, options = nil
339
+ raise ::ArgumentError, "request must be provided" if request.nil?
340
+
341
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::CreateSchemaRequest
342
+
343
+ # Converts hash and nil to an options object
344
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
345
+
346
+ # Customize the options with defaults
347
+ call_metadata = @config.rpcs.create_schema.metadata.to_h
348
+
349
+ # Set x-goog-api-client and x-goog-user-project headers
350
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
351
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
352
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
353
+ transports_version_send: [:rest]
354
+
355
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
356
+
357
+ options.apply_defaults timeout: @config.rpcs.create_schema.timeout,
358
+ metadata: call_metadata,
359
+ retry_policy: @config.rpcs.create_schema.retry_policy
360
+
361
+ options.apply_defaults timeout: @config.timeout,
362
+ metadata: @config.metadata,
363
+ retry_policy: @config.retry_policy
364
+
365
+ @schema_service_stub.create_schema request, options do |result, operation|
366
+ result = ::Gapic::Operation.new result, @operations_client, options: options
367
+ yield result, operation if block_given?
368
+ return result
369
+ end
370
+ rescue ::Gapic::Rest::Error => e
371
+ raise ::Google::Cloud::Error.from_error(e)
372
+ end
373
+
374
+ ##
375
+ # Updates a {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}.
376
+ #
377
+ # @overload update_schema(request, options = nil)
378
+ # Pass arguments to `update_schema` via a request object, either of type
379
+ # {::Google::Cloud::DiscoveryEngine::V1::UpdateSchemaRequest} or an equivalent Hash.
380
+ #
381
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::UpdateSchemaRequest, ::Hash]
382
+ # A request object representing the call parameters. Required. To specify no
383
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
384
+ # @param options [::Gapic::CallOptions, ::Hash]
385
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
386
+ #
387
+ # @overload update_schema(schema: nil, allow_missing: nil)
388
+ # Pass arguments to `update_schema` via keyword arguments. Note that at
389
+ # least one keyword argument is required. To specify no parameters, or to keep all
390
+ # the default parameter values, pass an empty Hash as a request object (see above).
391
+ #
392
+ # @param schema [::Google::Cloud::DiscoveryEngine::V1::Schema, ::Hash]
393
+ # Required. The {::Google::Cloud::DiscoveryEngine::V1::Schema Schema} to update.
394
+ # @param allow_missing [::Boolean]
395
+ # If set to true, and the {::Google::Cloud::DiscoveryEngine::V1::Schema Schema} is
396
+ # not found, a new {::Google::Cloud::DiscoveryEngine::V1::Schema Schema} will be
397
+ # created. In this situation, `update_mask` is ignored.
398
+ # @yield [result, operation] Access the result along with the TransportOperation object
399
+ # @yieldparam result [::Gapic::Operation]
400
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
401
+ #
402
+ # @return [::Gapic::Operation]
403
+ #
404
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
405
+ def update_schema request, options = nil
406
+ raise ::ArgumentError, "request must be provided" if request.nil?
407
+
408
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::UpdateSchemaRequest
409
+
410
+ # Converts hash and nil to an options object
411
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
412
+
413
+ # Customize the options with defaults
414
+ call_metadata = @config.rpcs.update_schema.metadata.to_h
415
+
416
+ # Set x-goog-api-client and x-goog-user-project headers
417
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
418
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
419
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
420
+ transports_version_send: [:rest]
421
+
422
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
423
+
424
+ options.apply_defaults timeout: @config.rpcs.update_schema.timeout,
425
+ metadata: call_metadata,
426
+ retry_policy: @config.rpcs.update_schema.retry_policy
427
+
428
+ options.apply_defaults timeout: @config.timeout,
429
+ metadata: @config.metadata,
430
+ retry_policy: @config.retry_policy
431
+
432
+ @schema_service_stub.update_schema request, options do |result, operation|
433
+ result = ::Gapic::Operation.new result, @operations_client, options: options
434
+ yield result, operation if block_given?
435
+ return result
436
+ end
437
+ rescue ::Gapic::Rest::Error => e
438
+ raise ::Google::Cloud::Error.from_error(e)
439
+ end
440
+
441
+ ##
442
+ # Deletes a {::Google::Cloud::DiscoveryEngine::V1::Schema Schema}.
443
+ #
444
+ # @overload delete_schema(request, options = nil)
445
+ # Pass arguments to `delete_schema` via a request object, either of type
446
+ # {::Google::Cloud::DiscoveryEngine::V1::DeleteSchemaRequest} or an equivalent Hash.
447
+ #
448
+ # @param request [::Google::Cloud::DiscoveryEngine::V1::DeleteSchemaRequest, ::Hash]
449
+ # A request object representing the call parameters. Required. To specify no
450
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
451
+ # @param options [::Gapic::CallOptions, ::Hash]
452
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
453
+ #
454
+ # @overload delete_schema(name: nil)
455
+ # Pass arguments to `delete_schema` via keyword arguments. Note that at
456
+ # least one keyword argument is required. To specify no parameters, or to keep all
457
+ # the default parameter values, pass an empty Hash as a request object (see above).
458
+ #
459
+ # @param name [::String]
460
+ # Required. The full resource name of the schema, in the format of
461
+ # `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}`.
462
+ # @yield [result, operation] Access the result along with the TransportOperation object
463
+ # @yieldparam result [::Gapic::Operation]
464
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
465
+ #
466
+ # @return [::Gapic::Operation]
467
+ #
468
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
469
+ def delete_schema request, options = nil
470
+ raise ::ArgumentError, "request must be provided" if request.nil?
471
+
472
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1::DeleteSchemaRequest
473
+
474
+ # Converts hash and nil to an options object
475
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
476
+
477
+ # Customize the options with defaults
478
+ call_metadata = @config.rpcs.delete_schema.metadata.to_h
479
+
480
+ # Set x-goog-api-client and x-goog-user-project headers
481
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
482
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
483
+ gapic_version: ::Google::Cloud::DiscoveryEngine::V1::VERSION,
484
+ transports_version_send: [:rest]
485
+
486
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
487
+
488
+ options.apply_defaults timeout: @config.rpcs.delete_schema.timeout,
489
+ metadata: call_metadata,
490
+ retry_policy: @config.rpcs.delete_schema.retry_policy
491
+
492
+ options.apply_defaults timeout: @config.timeout,
493
+ metadata: @config.metadata,
494
+ retry_policy: @config.retry_policy
495
+
496
+ @schema_service_stub.delete_schema request, options do |result, operation|
497
+ result = ::Gapic::Operation.new result, @operations_client, options: options
498
+ yield result, operation if block_given?
499
+ return result
500
+ end
501
+ rescue ::Gapic::Rest::Error => e
502
+ raise ::Google::Cloud::Error.from_error(e)
503
+ end
504
+
505
+ ##
506
+ # Configuration class for the SchemaService REST API.
507
+ #
508
+ # This class represents the configuration for SchemaService REST,
509
+ # providing control over timeouts, retry behavior, logging, transport
510
+ # parameters, and other low-level controls. Certain parameters can also be
511
+ # applied individually to specific RPCs. See
512
+ # {::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client::Configuration::Rpcs}
513
+ # for a list of RPCs that can be configured independently.
514
+ #
515
+ # Configuration can be applied globally to all clients, or to a single client
516
+ # on construction.
517
+ #
518
+ # @example
519
+ #
520
+ # # Modify the global config, setting the timeout for
521
+ # # get_schema to 20 seconds,
522
+ # # and all remaining timeouts to 10 seconds.
523
+ # ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client.configure do |config|
524
+ # config.timeout = 10.0
525
+ # config.rpcs.get_schema.timeout = 20.0
526
+ # end
527
+ #
528
+ # # Apply the above configuration only to a new client.
529
+ # client = ::Google::Cloud::DiscoveryEngine::V1::SchemaService::Rest::Client.new do |config|
530
+ # config.timeout = 10.0
531
+ # config.rpcs.get_schema.timeout = 20.0
532
+ # end
533
+ #
534
+ # @!attribute [rw] endpoint
535
+ # The hostname or hostname:port of the service endpoint.
536
+ # Defaults to `"discoveryengine.googleapis.com"`.
537
+ # @return [::String]
538
+ # @!attribute [rw] credentials
539
+ # Credentials to send with calls. You may provide any of the following types:
540
+ # * (`String`) The path to a service account key file in JSON format
541
+ # * (`Hash`) A service account key as a Hash
542
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
543
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
544
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
545
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
546
+ # * (`nil`) indicating no credentials
547
+ # @return [::Object]
548
+ # @!attribute [rw] scope
549
+ # The OAuth scopes
550
+ # @return [::Array<::String>]
551
+ # @!attribute [rw] lib_name
552
+ # The library name as recorded in instrumentation and logging
553
+ # @return [::String]
554
+ # @!attribute [rw] lib_version
555
+ # The library version as recorded in instrumentation and logging
556
+ # @return [::String]
557
+ # @!attribute [rw] timeout
558
+ # The call timeout in seconds.
559
+ # @return [::Numeric]
560
+ # @!attribute [rw] metadata
561
+ # Additional headers to be sent with the call.
562
+ # @return [::Hash{::Symbol=>::String}]
563
+ # @!attribute [rw] retry_policy
564
+ # The retry policy. The value is a hash with the following keys:
565
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
566
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
567
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
568
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
569
+ # trigger a retry.
570
+ # @return [::Hash]
571
+ # @!attribute [rw] quota_project
572
+ # A separate project against which to charge quota.
573
+ # @return [::String]
574
+ #
575
+ class Configuration
576
+ extend ::Gapic::Config
577
+
578
+ DEFAULT_ENDPOINT = "discoveryengine.googleapis.com"
579
+
580
+ config_attr :endpoint, DEFAULT_ENDPOINT, ::String
581
+ config_attr :credentials, nil do |value|
582
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
583
+ allowed.any? { |klass| klass === value }
584
+ end
585
+ config_attr :scope, nil, ::String, ::Array, nil
586
+ config_attr :lib_name, nil, ::String, nil
587
+ config_attr :lib_version, nil, ::String, nil
588
+ config_attr :timeout, nil, ::Numeric, nil
589
+ config_attr :metadata, nil, ::Hash, nil
590
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
591
+ config_attr :quota_project, nil, ::String, nil
592
+
593
+ # @private
594
+ def initialize parent_config = nil
595
+ @parent_config = parent_config unless parent_config.nil?
596
+
597
+ yield self if block_given?
598
+ end
599
+
600
+ ##
601
+ # Configurations for individual RPCs
602
+ # @return [Rpcs]
603
+ #
604
+ def rpcs
605
+ @rpcs ||= begin
606
+ parent_rpcs = nil
607
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
608
+ Rpcs.new parent_rpcs
609
+ end
610
+ end
611
+
612
+ ##
613
+ # Configuration RPC class for the SchemaService API.
614
+ #
615
+ # Includes fields providing the configuration for each RPC in this service.
616
+ # Each configuration object is of type `Gapic::Config::Method` and includes
617
+ # the following configuration fields:
618
+ #
619
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
620
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
621
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
622
+ # include the following keys:
623
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
624
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
625
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
626
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
627
+ # trigger a retry.
628
+ #
629
+ class Rpcs
630
+ ##
631
+ # RPC-specific configuration for `get_schema`
632
+ # @return [::Gapic::Config::Method]
633
+ #
634
+ attr_reader :get_schema
635
+ ##
636
+ # RPC-specific configuration for `list_schemas`
637
+ # @return [::Gapic::Config::Method]
638
+ #
639
+ attr_reader :list_schemas
640
+ ##
641
+ # RPC-specific configuration for `create_schema`
642
+ # @return [::Gapic::Config::Method]
643
+ #
644
+ attr_reader :create_schema
645
+ ##
646
+ # RPC-specific configuration for `update_schema`
647
+ # @return [::Gapic::Config::Method]
648
+ #
649
+ attr_reader :update_schema
650
+ ##
651
+ # RPC-specific configuration for `delete_schema`
652
+ # @return [::Gapic::Config::Method]
653
+ #
654
+ attr_reader :delete_schema
655
+
656
+ # @private
657
+ def initialize parent_rpcs = nil
658
+ get_schema_config = parent_rpcs.get_schema if parent_rpcs.respond_to? :get_schema
659
+ @get_schema = ::Gapic::Config::Method.new get_schema_config
660
+ list_schemas_config = parent_rpcs.list_schemas if parent_rpcs.respond_to? :list_schemas
661
+ @list_schemas = ::Gapic::Config::Method.new list_schemas_config
662
+ create_schema_config = parent_rpcs.create_schema if parent_rpcs.respond_to? :create_schema
663
+ @create_schema = ::Gapic::Config::Method.new create_schema_config
664
+ update_schema_config = parent_rpcs.update_schema if parent_rpcs.respond_to? :update_schema
665
+ @update_schema = ::Gapic::Config::Method.new update_schema_config
666
+ delete_schema_config = parent_rpcs.delete_schema if parent_rpcs.respond_to? :delete_schema
667
+ @delete_schema = ::Gapic::Config::Method.new delete_schema_config
668
+
669
+ yield self if block_given?
670
+ end
671
+ end
672
+ end
673
+ end
674
+ end
675
+ end
676
+ end
677
+ end
678
+ end
679
+ end