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

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