google-cloud-discovery_engine-v1beta 0.a → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +149 -0
- data/README.md +144 -8
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/client.rb +429 -0
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/paths.rb +78 -0
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/client.rb +386 -0
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest/service_stub.rb +114 -0
- data/lib/google/cloud/discovery_engine/v1beta/completion_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1beta/completion_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service/client.rb +1159 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service/operations.rb +768 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service/paths.rb +135 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/client.rb +960 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/operations.rb +919 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest/service_stub.rb +518 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service/rest.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1beta/document_service.rb +58 -0
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/client.rb +486 -0
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/paths.rb +135 -0
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/client.rb +443 -0
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest/service_stub.rb +116 -0
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1beta/recommendation_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1beta/rest.rb +42 -0
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/client.rb +840 -0
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/operations.rb +768 -0
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/paths.rb +127 -0
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/client.rb +680 -0
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/operations.rb +919 -0
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest/service_stub.rb +382 -0
- data/lib/google/cloud/discovery_engine/v1beta/schema_service/rest.rb +53 -0
- data/lib/google/cloud/discovery_engine/v1beta/schema_service.rb +56 -0
- data/lib/google/cloud/discovery_engine/v1beta/search_service/client.rb +511 -0
- data/lib/google/cloud/discovery_engine/v1beta/search_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1beta/search_service/paths.rb +131 -0
- data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/client.rb +463 -0
- data/lib/google/cloud/discovery_engine/v1beta/search_service/rest/service_stub.rb +116 -0
- data/lib/google/cloud/discovery_engine/v1beta/search_service/rest.rb +52 -0
- data/lib/google/cloud/discovery_engine/v1beta/search_service.rb +55 -0
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/client.rb +638 -0
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/credentials.rb +47 -0
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/operations.rb +768 -0
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/paths.rb +131 -0
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/client.rb +542 -0
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/operations.rb +919 -0
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest/service_stub.rb +250 -0
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service/rest.rb +53 -0
- data/lib/google/cloud/discovery_engine/v1beta/user_event_service.rb +56 -0
- data/lib/google/cloud/discovery_engine/v1beta/version.rb +7 -2
- data/lib/google/cloud/discovery_engine/v1beta.rb +50 -0
- data/lib/google/cloud/discoveryengine/v1beta/common_pb.rb +46 -0
- data/lib/google/cloud/discoveryengine/v1beta/completion_service_pb.rb +49 -0
- data/lib/google/cloud/discoveryengine/v1beta/completion_service_services_pb.rb +45 -0
- data/lib/google/cloud/discoveryengine/v1beta/document_pb.rb +48 -0
- data/lib/google/cloud/discoveryengine/v1beta/document_service_pb.rb +58 -0
- data/lib/google/cloud/discoveryengine/v1beta/document_service_services_pb.rb +81 -0
- data/lib/google/cloud/discoveryengine/v1beta/import_config_pb.rb +66 -0
- data/lib/google/cloud/discoveryengine/v1beta/purge_config_pb.rb +49 -0
- data/lib/google/cloud/discoveryengine/v1beta/recommendation_service_pb.rb +55 -0
- data/lib/google/cloud/discoveryengine/v1beta/recommendation_service_services_pb.rb +45 -0
- data/lib/google/cloud/discoveryengine/v1beta/schema_pb.rb +47 -0
- data/lib/google/cloud/discoveryengine/v1beta/schema_service_pb.rb +61 -0
- data/lib/google/cloud/discoveryengine/v1beta/schema_service_services_pb.rb +53 -0
- data/lib/google/cloud/discoveryengine/v1beta/search_service_pb.rb +71 -0
- data/lib/google/cloud/discoveryengine/v1beta/search_service_services_pb.rb +45 -0
- data/lib/google/cloud/discoveryengine/v1beta/user_event_pb.rb +58 -0
- data/lib/google/cloud/discoveryengine/v1beta/user_event_service_pb.rb +53 -0
- data/lib/google/cloud/discoveryengine/v1beta/user_event_service_services_pb.rb +59 -0
- data/lib/google-cloud-discovery_engine-v1beta.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +381 -0
- data/proto_docs/google/api/field_behavior.rb +71 -0
- data/proto_docs/google/api/httpbody.rb +80 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +222 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/common.rb +107 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/completion_service.rb +98 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/document.rb +107 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/document_service.rb +181 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/import_config.rb +340 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/purge_config.rb +84 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/recommendation_service.rb +210 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/schema.rb +45 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/schema_service.rb +180 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/search_service.rb +603 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/user_event.rb +473 -0
- data/proto_docs/google/cloud/discoveryengine/v1beta/user_event_service.rb +64 -0
- data/proto_docs/google/longrunning/operations.rb +164 -0
- data/proto_docs/google/protobuf/any.rb +144 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- data/proto_docs/google/protobuf/empty.rb +34 -0
- data/proto_docs/google/protobuf/struct.rb +96 -0
- data/proto_docs/google/protobuf/timestamp.rb +127 -0
- data/proto_docs/google/rpc/status.rb +48 -0
- data/proto_docs/google/type/date.rb +53 -0
- metadata +254 -12
|
@@ -0,0 +1,960 @@
|
|
|
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/v1beta/document_service_pb"
|
|
21
|
+
require "google/cloud/discovery_engine/v1beta/document_service/rest/service_stub"
|
|
22
|
+
|
|
23
|
+
module Google
|
|
24
|
+
module Cloud
|
|
25
|
+
module DiscoveryEngine
|
|
26
|
+
module V1beta
|
|
27
|
+
module DocumentService
|
|
28
|
+
module Rest
|
|
29
|
+
##
|
|
30
|
+
# REST client for the DocumentService service.
|
|
31
|
+
#
|
|
32
|
+
# Service for ingesting
|
|
33
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document} information of the
|
|
34
|
+
# customer's website.
|
|
35
|
+
#
|
|
36
|
+
class Client
|
|
37
|
+
include Paths
|
|
38
|
+
|
|
39
|
+
# @private
|
|
40
|
+
attr_reader :document_service_stub
|
|
41
|
+
|
|
42
|
+
##
|
|
43
|
+
# Configure the DocumentService Client class.
|
|
44
|
+
#
|
|
45
|
+
# See {::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client::Configuration}
|
|
46
|
+
# for a description of the configuration fields.
|
|
47
|
+
#
|
|
48
|
+
# @example
|
|
49
|
+
#
|
|
50
|
+
# # Modify the configuration for all DocumentService clients
|
|
51
|
+
# ::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client.configure do |config|
|
|
52
|
+
# config.timeout = 10.0
|
|
53
|
+
# end
|
|
54
|
+
#
|
|
55
|
+
# @yield [config] Configure the Client client.
|
|
56
|
+
# @yieldparam config [Client::Configuration]
|
|
57
|
+
#
|
|
58
|
+
# @return [Client::Configuration]
|
|
59
|
+
#
|
|
60
|
+
def self.configure
|
|
61
|
+
@configure ||= begin
|
|
62
|
+
namespace = ["Google", "Cloud", "DiscoveryEngine", "V1beta"]
|
|
63
|
+
parent_config = while namespace.any?
|
|
64
|
+
parent_name = namespace.join "::"
|
|
65
|
+
parent_const = const_get parent_name
|
|
66
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
|
67
|
+
namespace.pop
|
|
68
|
+
end
|
|
69
|
+
default_config = Client::Configuration.new parent_config
|
|
70
|
+
|
|
71
|
+
default_config.timeout = 30.0
|
|
72
|
+
default_config.retry_policy = {
|
|
73
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
default_config.rpcs.import_documents.timeout = 300.0
|
|
77
|
+
default_config.rpcs.import_documents.retry_policy = {
|
|
78
|
+
initial_delay: 1.0, max_delay: 30.0, multiplier: 1.3, retry_codes: [14]
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
default_config
|
|
82
|
+
end
|
|
83
|
+
yield @configure if block_given?
|
|
84
|
+
@configure
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
##
|
|
88
|
+
# Configure the DocumentService Client instance.
|
|
89
|
+
#
|
|
90
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
|
91
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
|
92
|
+
# should be made on {Client.configure}.
|
|
93
|
+
#
|
|
94
|
+
# See {::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client::Configuration}
|
|
95
|
+
# for a description of the configuration fields.
|
|
96
|
+
#
|
|
97
|
+
# @yield [config] Configure the Client client.
|
|
98
|
+
# @yieldparam config [Client::Configuration]
|
|
99
|
+
#
|
|
100
|
+
# @return [Client::Configuration]
|
|
101
|
+
#
|
|
102
|
+
def configure
|
|
103
|
+
yield @config if block_given?
|
|
104
|
+
@config
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
##
|
|
108
|
+
# Create a new DocumentService REST client object.
|
|
109
|
+
#
|
|
110
|
+
# @example
|
|
111
|
+
#
|
|
112
|
+
# # Create a client using the default configuration
|
|
113
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client.new
|
|
114
|
+
#
|
|
115
|
+
# # Create a client using a custom configuration
|
|
116
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client.new do |config|
|
|
117
|
+
# config.timeout = 10.0
|
|
118
|
+
# end
|
|
119
|
+
#
|
|
120
|
+
# @yield [config] Configure the DocumentService client.
|
|
121
|
+
# @yieldparam config [Client::Configuration]
|
|
122
|
+
#
|
|
123
|
+
def initialize
|
|
124
|
+
# Create the configuration object
|
|
125
|
+
@config = Configuration.new Client.configure
|
|
126
|
+
|
|
127
|
+
# Yield the configuration if needed
|
|
128
|
+
yield @config if block_given?
|
|
129
|
+
|
|
130
|
+
# Create credentials
|
|
131
|
+
credentials = @config.credentials
|
|
132
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
|
133
|
+
# but only if the default endpoint does not have a region prefix.
|
|
134
|
+
enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
|
|
135
|
+
!@config.endpoint.split(".").first.include?("-")
|
|
136
|
+
credentials ||= Credentials.default scope: @config.scope,
|
|
137
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
|
138
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
|
139
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
@quota_project_id = @config.quota_project
|
|
143
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
|
144
|
+
|
|
145
|
+
@operations_client = ::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Operations.new do |config|
|
|
146
|
+
config.credentials = credentials
|
|
147
|
+
config.quota_project = @quota_project_id
|
|
148
|
+
config.endpoint = @config.endpoint
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
@document_service_stub = ::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::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::V1beta::DocumentService::Rest::Operations]
|
|
158
|
+
#
|
|
159
|
+
attr_reader :operations_client
|
|
160
|
+
|
|
161
|
+
# Service calls
|
|
162
|
+
|
|
163
|
+
##
|
|
164
|
+
# Gets a {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}.
|
|
165
|
+
#
|
|
166
|
+
# @overload get_document(request, options = nil)
|
|
167
|
+
# Pass arguments to `get_document` via a request object, either of type
|
|
168
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::GetDocumentRequest} or an equivalent Hash.
|
|
169
|
+
#
|
|
170
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::GetDocumentRequest, ::Hash]
|
|
171
|
+
# A request object representing the call parameters. Required. To specify no
|
|
172
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
173
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
174
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
175
|
+
#
|
|
176
|
+
# @overload get_document(name: nil)
|
|
177
|
+
# Pass arguments to `get_document` via keyword arguments. Note that at
|
|
178
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
179
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
180
|
+
#
|
|
181
|
+
# @param name [::String]
|
|
182
|
+
# Required. Full resource name of
|
|
183
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}, such as
|
|
184
|
+
# `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
|
|
185
|
+
#
|
|
186
|
+
# If the caller does not have permission to access the
|
|
187
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}, regardless of
|
|
188
|
+
# whether or not it exists, a `PERMISSION_DENIED` error is returned.
|
|
189
|
+
#
|
|
190
|
+
# If the requested {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}
|
|
191
|
+
# does not exist, a `NOT_FOUND` error is returned.
|
|
192
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
193
|
+
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Document]
|
|
194
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
195
|
+
#
|
|
196
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::Document]
|
|
197
|
+
#
|
|
198
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
199
|
+
def get_document request, options = nil
|
|
200
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
201
|
+
|
|
202
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::GetDocumentRequest
|
|
203
|
+
|
|
204
|
+
# Converts hash and nil to an options object
|
|
205
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
206
|
+
|
|
207
|
+
# Customize the options with defaults
|
|
208
|
+
call_metadata = @config.rpcs.get_document.metadata.to_h
|
|
209
|
+
|
|
210
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
|
211
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
212
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
213
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
|
|
214
|
+
transports_version_send: [:rest]
|
|
215
|
+
|
|
216
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
217
|
+
|
|
218
|
+
options.apply_defaults timeout: @config.rpcs.get_document.timeout,
|
|
219
|
+
metadata: call_metadata,
|
|
220
|
+
retry_policy: @config.rpcs.get_document.retry_policy
|
|
221
|
+
|
|
222
|
+
options.apply_defaults timeout: @config.timeout,
|
|
223
|
+
metadata: @config.metadata,
|
|
224
|
+
retry_policy: @config.retry_policy
|
|
225
|
+
|
|
226
|
+
@document_service_stub.get_document request, options do |result, operation|
|
|
227
|
+
yield result, operation if block_given?
|
|
228
|
+
return result
|
|
229
|
+
end
|
|
230
|
+
rescue ::Gapic::Rest::Error => e
|
|
231
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
232
|
+
end
|
|
233
|
+
|
|
234
|
+
##
|
|
235
|
+
# Gets a list of {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s.
|
|
236
|
+
#
|
|
237
|
+
# @overload list_documents(request, options = nil)
|
|
238
|
+
# Pass arguments to `list_documents` via a request object, either of type
|
|
239
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ListDocumentsRequest} or an equivalent Hash.
|
|
240
|
+
#
|
|
241
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::ListDocumentsRequest, ::Hash]
|
|
242
|
+
# A request object representing the call parameters. Required. To specify no
|
|
243
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
244
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
245
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
246
|
+
#
|
|
247
|
+
# @overload list_documents(parent: nil, page_size: nil, page_token: nil)
|
|
248
|
+
# Pass arguments to `list_documents` via keyword arguments. Note that at
|
|
249
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
250
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
251
|
+
#
|
|
252
|
+
# @param parent [::String]
|
|
253
|
+
# Required. The parent branch resource name, such as
|
|
254
|
+
# `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
|
|
255
|
+
# Use `default_branch` as the branch ID, to list documents under the default
|
|
256
|
+
# branch.
|
|
257
|
+
#
|
|
258
|
+
# If the caller does not have permission to list [Documents][]s under this
|
|
259
|
+
# branch, regardless of whether or not this branch exists, a
|
|
260
|
+
# `PERMISSION_DENIED` error is returned.
|
|
261
|
+
# @param page_size [::Integer]
|
|
262
|
+
# Maximum number of {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s
|
|
263
|
+
# to return. If unspecified, defaults to 100. The maximum allowed value is
|
|
264
|
+
# 1000. Values above 1000 will be coerced to 1000.
|
|
265
|
+
#
|
|
266
|
+
# If this field is negative, an `INVALID_ARGUMENT` error is returned.
|
|
267
|
+
# @param page_token [::String]
|
|
268
|
+
# A page token
|
|
269
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ListDocumentsResponse#next_page_token ListDocumentsResponse.next_page_token},
|
|
270
|
+
# received from a previous
|
|
271
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client#list_documents DocumentService.ListDocuments}
|
|
272
|
+
# call. Provide this to retrieve the subsequent page.
|
|
273
|
+
#
|
|
274
|
+
# When paginating, all other parameters provided to
|
|
275
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client#list_documents DocumentService.ListDocuments}
|
|
276
|
+
# must match the call that provided the page token. Otherwise, an
|
|
277
|
+
# `INVALID_ARGUMENT` error is returned.
|
|
278
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
279
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Document>]
|
|
280
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
281
|
+
#
|
|
282
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::DiscoveryEngine::V1beta::Document>]
|
|
283
|
+
#
|
|
284
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
285
|
+
def list_documents request, options = nil
|
|
286
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
287
|
+
|
|
288
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ListDocumentsRequest
|
|
289
|
+
|
|
290
|
+
# Converts hash and nil to an options object
|
|
291
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
292
|
+
|
|
293
|
+
# Customize the options with defaults
|
|
294
|
+
call_metadata = @config.rpcs.list_documents.metadata.to_h
|
|
295
|
+
|
|
296
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
|
297
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
298
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
299
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
|
|
300
|
+
transports_version_send: [:rest]
|
|
301
|
+
|
|
302
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
303
|
+
|
|
304
|
+
options.apply_defaults timeout: @config.rpcs.list_documents.timeout,
|
|
305
|
+
metadata: call_metadata,
|
|
306
|
+
retry_policy: @config.rpcs.list_documents.retry_policy
|
|
307
|
+
|
|
308
|
+
options.apply_defaults timeout: @config.timeout,
|
|
309
|
+
metadata: @config.metadata,
|
|
310
|
+
retry_policy: @config.retry_policy
|
|
311
|
+
|
|
312
|
+
@document_service_stub.list_documents request, options do |result, operation|
|
|
313
|
+
result = ::Gapic::Rest::PagedEnumerable.new @document_service_stub, :list_documents, "documents", request, result, options
|
|
314
|
+
yield result, operation if block_given?
|
|
315
|
+
return result
|
|
316
|
+
end
|
|
317
|
+
rescue ::Gapic::Rest::Error => e
|
|
318
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
319
|
+
end
|
|
320
|
+
|
|
321
|
+
##
|
|
322
|
+
# Creates a {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}.
|
|
323
|
+
#
|
|
324
|
+
# @overload create_document(request, options = nil)
|
|
325
|
+
# Pass arguments to `create_document` via a request object, either of type
|
|
326
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::CreateDocumentRequest} or an equivalent Hash.
|
|
327
|
+
#
|
|
328
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::CreateDocumentRequest, ::Hash]
|
|
329
|
+
# A request object representing the call parameters. Required. To specify no
|
|
330
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
331
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
332
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
333
|
+
#
|
|
334
|
+
# @overload create_document(parent: nil, document: nil, document_id: nil)
|
|
335
|
+
# Pass arguments to `create_document` via keyword arguments. Note that at
|
|
336
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
337
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
338
|
+
#
|
|
339
|
+
# @param parent [::String]
|
|
340
|
+
# Required. The parent resource name, such as
|
|
341
|
+
# `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
|
|
342
|
+
# @param document [::Google::Cloud::DiscoveryEngine::V1beta::Document, ::Hash]
|
|
343
|
+
# Required. The {::Google::Cloud::DiscoveryEngine::V1beta::Document Document} to
|
|
344
|
+
# create.
|
|
345
|
+
# @param document_id [::String]
|
|
346
|
+
# Required. The ID to use for the
|
|
347
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}, which will become
|
|
348
|
+
# the final component of the
|
|
349
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document#name Document.name}.
|
|
350
|
+
#
|
|
351
|
+
# If the caller does not have permission to create the
|
|
352
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}, regardless of
|
|
353
|
+
# whether or not it exists, a `PERMISSION_DENIED` error is returned.
|
|
354
|
+
#
|
|
355
|
+
# This field must be unique among all
|
|
356
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s with the same
|
|
357
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::CreateDocumentRequest#parent parent}.
|
|
358
|
+
# Otherwise, an `ALREADY_EXISTS` error is returned.
|
|
359
|
+
#
|
|
360
|
+
# This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034)
|
|
361
|
+
# standard with a length limit of 63 characters. Otherwise, an
|
|
362
|
+
# `INVALID_ARGUMENT` error is returned.
|
|
363
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
364
|
+
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Document]
|
|
365
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
366
|
+
#
|
|
367
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::Document]
|
|
368
|
+
#
|
|
369
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
370
|
+
def create_document request, options = nil
|
|
371
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
372
|
+
|
|
373
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::CreateDocumentRequest
|
|
374
|
+
|
|
375
|
+
# Converts hash and nil to an options object
|
|
376
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
377
|
+
|
|
378
|
+
# Customize the options with defaults
|
|
379
|
+
call_metadata = @config.rpcs.create_document.metadata.to_h
|
|
380
|
+
|
|
381
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
|
382
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
383
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
384
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
|
|
385
|
+
transports_version_send: [:rest]
|
|
386
|
+
|
|
387
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
388
|
+
|
|
389
|
+
options.apply_defaults timeout: @config.rpcs.create_document.timeout,
|
|
390
|
+
metadata: call_metadata,
|
|
391
|
+
retry_policy: @config.rpcs.create_document.retry_policy
|
|
392
|
+
|
|
393
|
+
options.apply_defaults timeout: @config.timeout,
|
|
394
|
+
metadata: @config.metadata,
|
|
395
|
+
retry_policy: @config.retry_policy
|
|
396
|
+
|
|
397
|
+
@document_service_stub.create_document request, options do |result, operation|
|
|
398
|
+
yield result, operation if block_given?
|
|
399
|
+
return result
|
|
400
|
+
end
|
|
401
|
+
rescue ::Gapic::Rest::Error => e
|
|
402
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
403
|
+
end
|
|
404
|
+
|
|
405
|
+
##
|
|
406
|
+
# Updates a {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}.
|
|
407
|
+
#
|
|
408
|
+
# @overload update_document(request, options = nil)
|
|
409
|
+
# Pass arguments to `update_document` via a request object, either of type
|
|
410
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::UpdateDocumentRequest} or an equivalent Hash.
|
|
411
|
+
#
|
|
412
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::UpdateDocumentRequest, ::Hash]
|
|
413
|
+
# A request object representing the call parameters. Required. To specify no
|
|
414
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
415
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
416
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
417
|
+
#
|
|
418
|
+
# @overload update_document(document: nil, allow_missing: nil)
|
|
419
|
+
# Pass arguments to `update_document` via keyword arguments. Note that at
|
|
420
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
421
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
422
|
+
#
|
|
423
|
+
# @param document [::Google::Cloud::DiscoveryEngine::V1beta::Document, ::Hash]
|
|
424
|
+
# Required. The document to update/create.
|
|
425
|
+
#
|
|
426
|
+
# If the caller does not have permission to update the
|
|
427
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}, regardless of
|
|
428
|
+
# whether or not it exists, a `PERMISSION_DENIED` error is returned.
|
|
429
|
+
#
|
|
430
|
+
# If the {::Google::Cloud::DiscoveryEngine::V1beta::Document Document} to update
|
|
431
|
+
# does not exist and
|
|
432
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::UpdateDocumentRequest#allow_missing allow_missing}
|
|
433
|
+
# is not set, a `NOT_FOUND` error is returned.
|
|
434
|
+
# @param allow_missing [::Boolean]
|
|
435
|
+
# If set to true, and the
|
|
436
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document} is not found, a
|
|
437
|
+
# new {::Google::Cloud::DiscoveryEngine::V1beta::Document Document} will be
|
|
438
|
+
# created.
|
|
439
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
440
|
+
# @yieldparam result [::Google::Cloud::DiscoveryEngine::V1beta::Document]
|
|
441
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
442
|
+
#
|
|
443
|
+
# @return [::Google::Cloud::DiscoveryEngine::V1beta::Document]
|
|
444
|
+
#
|
|
445
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
446
|
+
def update_document request, options = nil
|
|
447
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
448
|
+
|
|
449
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::UpdateDocumentRequest
|
|
450
|
+
|
|
451
|
+
# Converts hash and nil to an options object
|
|
452
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
453
|
+
|
|
454
|
+
# Customize the options with defaults
|
|
455
|
+
call_metadata = @config.rpcs.update_document.metadata.to_h
|
|
456
|
+
|
|
457
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
|
458
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
459
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
460
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
|
|
461
|
+
transports_version_send: [:rest]
|
|
462
|
+
|
|
463
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
464
|
+
|
|
465
|
+
options.apply_defaults timeout: @config.rpcs.update_document.timeout,
|
|
466
|
+
metadata: call_metadata,
|
|
467
|
+
retry_policy: @config.rpcs.update_document.retry_policy
|
|
468
|
+
|
|
469
|
+
options.apply_defaults timeout: @config.timeout,
|
|
470
|
+
metadata: @config.metadata,
|
|
471
|
+
retry_policy: @config.retry_policy
|
|
472
|
+
|
|
473
|
+
@document_service_stub.update_document request, options do |result, operation|
|
|
474
|
+
yield result, operation if block_given?
|
|
475
|
+
return result
|
|
476
|
+
end
|
|
477
|
+
rescue ::Gapic::Rest::Error => e
|
|
478
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
479
|
+
end
|
|
480
|
+
|
|
481
|
+
##
|
|
482
|
+
# Deletes a {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}.
|
|
483
|
+
#
|
|
484
|
+
# @overload delete_document(request, options = nil)
|
|
485
|
+
# Pass arguments to `delete_document` via a request object, either of type
|
|
486
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::DeleteDocumentRequest} or an equivalent Hash.
|
|
487
|
+
#
|
|
488
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::DeleteDocumentRequest, ::Hash]
|
|
489
|
+
# A request object representing the call parameters. Required. To specify no
|
|
490
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
491
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
492
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
493
|
+
#
|
|
494
|
+
# @overload delete_document(name: nil)
|
|
495
|
+
# Pass arguments to `delete_document` via keyword arguments. Note that at
|
|
496
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
497
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
498
|
+
#
|
|
499
|
+
# @param name [::String]
|
|
500
|
+
# Required. Full resource name of
|
|
501
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}, such as
|
|
502
|
+
# `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
|
|
503
|
+
#
|
|
504
|
+
# If the caller does not have permission to delete the
|
|
505
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}, regardless of
|
|
506
|
+
# whether or not it exists, a `PERMISSION_DENIED` error is returned.
|
|
507
|
+
#
|
|
508
|
+
# If the {::Google::Cloud::DiscoveryEngine::V1beta::Document Document} to delete
|
|
509
|
+
# does not exist, a `NOT_FOUND` error is returned.
|
|
510
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
511
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
|
512
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
513
|
+
#
|
|
514
|
+
# @return [::Google::Protobuf::Empty]
|
|
515
|
+
#
|
|
516
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
517
|
+
def delete_document request, options = nil
|
|
518
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
519
|
+
|
|
520
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::DeleteDocumentRequest
|
|
521
|
+
|
|
522
|
+
# Converts hash and nil to an options object
|
|
523
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
524
|
+
|
|
525
|
+
# Customize the options with defaults
|
|
526
|
+
call_metadata = @config.rpcs.delete_document.metadata.to_h
|
|
527
|
+
|
|
528
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
|
529
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
530
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
531
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
|
|
532
|
+
transports_version_send: [:rest]
|
|
533
|
+
|
|
534
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
535
|
+
|
|
536
|
+
options.apply_defaults timeout: @config.rpcs.delete_document.timeout,
|
|
537
|
+
metadata: call_metadata,
|
|
538
|
+
retry_policy: @config.rpcs.delete_document.retry_policy
|
|
539
|
+
|
|
540
|
+
options.apply_defaults timeout: @config.timeout,
|
|
541
|
+
metadata: @config.metadata,
|
|
542
|
+
retry_policy: @config.retry_policy
|
|
543
|
+
|
|
544
|
+
@document_service_stub.delete_document request, options do |result, operation|
|
|
545
|
+
yield result, operation if block_given?
|
|
546
|
+
return result
|
|
547
|
+
end
|
|
548
|
+
rescue ::Gapic::Rest::Error => e
|
|
549
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
550
|
+
end
|
|
551
|
+
|
|
552
|
+
##
|
|
553
|
+
# Bulk import of multiple
|
|
554
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s. Request
|
|
555
|
+
# processing may be synchronous. Non-existing items will be created.
|
|
556
|
+
#
|
|
557
|
+
# Note: It is possible for a subset of the
|
|
558
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s to be
|
|
559
|
+
# successfully updated.
|
|
560
|
+
#
|
|
561
|
+
# @overload import_documents(request, options = nil)
|
|
562
|
+
# Pass arguments to `import_documents` via a request object, either of type
|
|
563
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ImportDocumentsRequest} or an equivalent Hash.
|
|
564
|
+
#
|
|
565
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::ImportDocumentsRequest, ::Hash]
|
|
566
|
+
# A request object representing the call parameters. Required. To specify no
|
|
567
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
568
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
569
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
570
|
+
#
|
|
571
|
+
# @overload import_documents(inline_source: nil, gcs_source: nil, bigquery_source: nil, parent: nil, error_config: nil, reconciliation_mode: nil, auto_generate_ids: nil, id_field: nil)
|
|
572
|
+
# Pass arguments to `import_documents` via keyword arguments. Note that at
|
|
573
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
574
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
575
|
+
#
|
|
576
|
+
# @param inline_source [::Google::Cloud::DiscoveryEngine::V1beta::ImportDocumentsRequest::InlineSource, ::Hash]
|
|
577
|
+
# The Inline source for the input content for documents.
|
|
578
|
+
# @param gcs_source [::Google::Cloud::DiscoveryEngine::V1beta::GcsSource, ::Hash]
|
|
579
|
+
# Cloud Storage location for the input content.
|
|
580
|
+
# @param bigquery_source [::Google::Cloud::DiscoveryEngine::V1beta::BigQuerySource, ::Hash]
|
|
581
|
+
# BigQuery input source.
|
|
582
|
+
# @param parent [::String]
|
|
583
|
+
# Required. The parent branch resource name, such as
|
|
584
|
+
# `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
|
|
585
|
+
# Requires create/update permission.
|
|
586
|
+
# @param error_config [::Google::Cloud::DiscoveryEngine::V1beta::ImportErrorConfig, ::Hash]
|
|
587
|
+
# The desired location of errors incurred during the Import.
|
|
588
|
+
# @param reconciliation_mode [::Google::Cloud::DiscoveryEngine::V1beta::ImportDocumentsRequest::ReconciliationMode]
|
|
589
|
+
# The mode of reconciliation between existing documents and the documents to
|
|
590
|
+
# be imported. Defaults to
|
|
591
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ImportDocumentsRequest::ReconciliationMode::INCREMENTAL ReconciliationMode.INCREMENTAL}.
|
|
592
|
+
# @param auto_generate_ids [::Boolean]
|
|
593
|
+
# Whether to automatically generate IDs for the documents if absent.
|
|
594
|
+
#
|
|
595
|
+
# If set to `true`,
|
|
596
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document#id Document.id}s are
|
|
597
|
+
# automatically generated based on the hash of the payload, where IDs may not
|
|
598
|
+
# be consistent during multiple imports. In which case
|
|
599
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ImportDocumentsRequest::ReconciliationMode::FULL ReconciliationMode.FULL}
|
|
600
|
+
# is highly recommended to avoid duplicate contents. If unset or set to
|
|
601
|
+
# `false`, {::Google::Cloud::DiscoveryEngine::V1beta::Document#id Document.id}s
|
|
602
|
+
# have to be specified using
|
|
603
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ImportDocumentsRequest#id_field id_field},
|
|
604
|
+
# otherwises, documents without IDs will fail to be imported.
|
|
605
|
+
#
|
|
606
|
+
# Only set this field when using
|
|
607
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::GcsSource GcsSource} or
|
|
608
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::BigQuerySource BigQuerySource}, and
|
|
609
|
+
# when
|
|
610
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::GcsSource#data_schema GcsSource.data_schema}
|
|
611
|
+
# or
|
|
612
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::BigQuerySource#data_schema BigQuerySource.data_schema}
|
|
613
|
+
# is `custom`. Otherwise, an INVALID_ARGUMENT error is thrown.
|
|
614
|
+
# @param id_field [::String]
|
|
615
|
+
# The field in the Cloud Storage and BigQuery sources that indicates the
|
|
616
|
+
# unique IDs of the documents.
|
|
617
|
+
#
|
|
618
|
+
# For {::Google::Cloud::DiscoveryEngine::V1beta::GcsSource GcsSource} it is the
|
|
619
|
+
# key of the JSON field. For instance, `my_id` for JSON `{"my_id":
|
|
620
|
+
# "some_uuid"}`. For
|
|
621
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::BigQuerySource BigQuerySource} it is
|
|
622
|
+
# the column name of the BigQuery table where the unique ids are stored.
|
|
623
|
+
#
|
|
624
|
+
# The values of the JSON field or the BigQuery column will be used as the
|
|
625
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document#id Document.id}s. The JSON
|
|
626
|
+
# field or the BigQuery column must be of string type, and the values must be
|
|
627
|
+
# set as valid strings conform to
|
|
628
|
+
# [RFC-1034](https://tools.ietf.org/html/rfc1034) with 1-63 characters.
|
|
629
|
+
# Otherwise, documents without valid IDs will fail to be imported.
|
|
630
|
+
#
|
|
631
|
+
# Only set this field when using
|
|
632
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::GcsSource GcsSource} or
|
|
633
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::BigQuerySource BigQuerySource}, and
|
|
634
|
+
# when
|
|
635
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::GcsSource#data_schema GcsSource.data_schema}
|
|
636
|
+
# or
|
|
637
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::BigQuerySource#data_schema BigQuerySource.data_schema}
|
|
638
|
+
# is `custom`. And only set this field when
|
|
639
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::ImportDocumentsRequest#auto_generate_ids auto_generate_ids}
|
|
640
|
+
# is unset or set as `false`. Otherwise, an INVALID_ARGUMENT error is thrown.
|
|
641
|
+
#
|
|
642
|
+
# If it is unset, a default value `_id` is used when importing from the
|
|
643
|
+
# allowed data sources.
|
|
644
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
645
|
+
# @yieldparam result [::Gapic::Operation]
|
|
646
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
647
|
+
#
|
|
648
|
+
# @return [::Gapic::Operation]
|
|
649
|
+
#
|
|
650
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
651
|
+
def import_documents request, options = nil
|
|
652
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
653
|
+
|
|
654
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::ImportDocumentsRequest
|
|
655
|
+
|
|
656
|
+
# Converts hash and nil to an options object
|
|
657
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
658
|
+
|
|
659
|
+
# Customize the options with defaults
|
|
660
|
+
call_metadata = @config.rpcs.import_documents.metadata.to_h
|
|
661
|
+
|
|
662
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
|
663
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
664
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
665
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
|
|
666
|
+
transports_version_send: [:rest]
|
|
667
|
+
|
|
668
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
669
|
+
|
|
670
|
+
options.apply_defaults timeout: @config.rpcs.import_documents.timeout,
|
|
671
|
+
metadata: call_metadata,
|
|
672
|
+
retry_policy: @config.rpcs.import_documents.retry_policy
|
|
673
|
+
|
|
674
|
+
options.apply_defaults timeout: @config.timeout,
|
|
675
|
+
metadata: @config.metadata,
|
|
676
|
+
retry_policy: @config.retry_policy
|
|
677
|
+
|
|
678
|
+
@document_service_stub.import_documents request, options do |result, operation|
|
|
679
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
|
680
|
+
yield result, operation if block_given?
|
|
681
|
+
return result
|
|
682
|
+
end
|
|
683
|
+
rescue ::Gapic::Rest::Error => e
|
|
684
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
685
|
+
end
|
|
686
|
+
|
|
687
|
+
##
|
|
688
|
+
# Permanently deletes all selected
|
|
689
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s in a branch.
|
|
690
|
+
#
|
|
691
|
+
# This process is asynchronous. Depending on the number of
|
|
692
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s to be deleted,
|
|
693
|
+
# this operation can take hours to complete. Before the delete operation
|
|
694
|
+
# completes, some {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s
|
|
695
|
+
# might still be returned by
|
|
696
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client#get_document DocumentService.GetDocument}
|
|
697
|
+
# or
|
|
698
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client#list_documents DocumentService.ListDocuments}.
|
|
699
|
+
#
|
|
700
|
+
# To get a list of the
|
|
701
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::Document Document}s to be deleted,
|
|
702
|
+
# set
|
|
703
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::PurgeDocumentsRequest#force PurgeDocumentsRequest.force}
|
|
704
|
+
# to false.
|
|
705
|
+
#
|
|
706
|
+
# @overload purge_documents(request, options = nil)
|
|
707
|
+
# Pass arguments to `purge_documents` via a request object, either of type
|
|
708
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::PurgeDocumentsRequest} or an equivalent Hash.
|
|
709
|
+
#
|
|
710
|
+
# @param request [::Google::Cloud::DiscoveryEngine::V1beta::PurgeDocumentsRequest, ::Hash]
|
|
711
|
+
# A request object representing the call parameters. Required. To specify no
|
|
712
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
|
713
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
|
714
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
|
715
|
+
#
|
|
716
|
+
# @overload purge_documents(parent: nil, filter: nil, force: nil)
|
|
717
|
+
# Pass arguments to `purge_documents` via keyword arguments. Note that at
|
|
718
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
|
719
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
|
720
|
+
#
|
|
721
|
+
# @param parent [::String]
|
|
722
|
+
# Required. The parent resource name, such as
|
|
723
|
+
# `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`.
|
|
724
|
+
# @param filter [::String]
|
|
725
|
+
# Required. Filter matching documents to purge. Only currently supported
|
|
726
|
+
# value is
|
|
727
|
+
# `*` (all items).
|
|
728
|
+
# @param force [::Boolean]
|
|
729
|
+
# Actually performs the purge. If `force` is set to false, return the
|
|
730
|
+
# expected purge count without deleting any documents.
|
|
731
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
|
732
|
+
# @yieldparam result [::Gapic::Operation]
|
|
733
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
|
734
|
+
#
|
|
735
|
+
# @return [::Gapic::Operation]
|
|
736
|
+
#
|
|
737
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
|
738
|
+
def purge_documents request, options = nil
|
|
739
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
|
740
|
+
|
|
741
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::DiscoveryEngine::V1beta::PurgeDocumentsRequest
|
|
742
|
+
|
|
743
|
+
# Converts hash and nil to an options object
|
|
744
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
|
745
|
+
|
|
746
|
+
# Customize the options with defaults
|
|
747
|
+
call_metadata = @config.rpcs.purge_documents.metadata.to_h
|
|
748
|
+
|
|
749
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
|
750
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
|
751
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
|
752
|
+
gapic_version: ::Google::Cloud::DiscoveryEngine::V1beta::VERSION,
|
|
753
|
+
transports_version_send: [:rest]
|
|
754
|
+
|
|
755
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
|
756
|
+
|
|
757
|
+
options.apply_defaults timeout: @config.rpcs.purge_documents.timeout,
|
|
758
|
+
metadata: call_metadata,
|
|
759
|
+
retry_policy: @config.rpcs.purge_documents.retry_policy
|
|
760
|
+
|
|
761
|
+
options.apply_defaults timeout: @config.timeout,
|
|
762
|
+
metadata: @config.metadata,
|
|
763
|
+
retry_policy: @config.retry_policy
|
|
764
|
+
|
|
765
|
+
@document_service_stub.purge_documents request, options do |result, operation|
|
|
766
|
+
result = ::Gapic::Operation.new result, @operations_client, options: options
|
|
767
|
+
yield result, operation if block_given?
|
|
768
|
+
return result
|
|
769
|
+
end
|
|
770
|
+
rescue ::Gapic::Rest::Error => e
|
|
771
|
+
raise ::Google::Cloud::Error.from_error(e)
|
|
772
|
+
end
|
|
773
|
+
|
|
774
|
+
##
|
|
775
|
+
# Configuration class for the DocumentService REST API.
|
|
776
|
+
#
|
|
777
|
+
# This class represents the configuration for DocumentService REST,
|
|
778
|
+
# providing control over timeouts, retry behavior, logging, transport
|
|
779
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
|
780
|
+
# applied individually to specific RPCs. See
|
|
781
|
+
# {::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client::Configuration::Rpcs}
|
|
782
|
+
# for a list of RPCs that can be configured independently.
|
|
783
|
+
#
|
|
784
|
+
# Configuration can be applied globally to all clients, or to a single client
|
|
785
|
+
# on construction.
|
|
786
|
+
#
|
|
787
|
+
# @example
|
|
788
|
+
#
|
|
789
|
+
# # Modify the global config, setting the timeout for
|
|
790
|
+
# # get_document to 20 seconds,
|
|
791
|
+
# # and all remaining timeouts to 10 seconds.
|
|
792
|
+
# ::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client.configure do |config|
|
|
793
|
+
# config.timeout = 10.0
|
|
794
|
+
# config.rpcs.get_document.timeout = 20.0
|
|
795
|
+
# end
|
|
796
|
+
#
|
|
797
|
+
# # Apply the above configuration only to a new client.
|
|
798
|
+
# client = ::Google::Cloud::DiscoveryEngine::V1beta::DocumentService::Rest::Client.new do |config|
|
|
799
|
+
# config.timeout = 10.0
|
|
800
|
+
# config.rpcs.get_document.timeout = 20.0
|
|
801
|
+
# end
|
|
802
|
+
#
|
|
803
|
+
# @!attribute [rw] endpoint
|
|
804
|
+
# The hostname or hostname:port of the service endpoint.
|
|
805
|
+
# Defaults to `"discoveryengine.googleapis.com"`.
|
|
806
|
+
# @return [::String]
|
|
807
|
+
# @!attribute [rw] credentials
|
|
808
|
+
# Credentials to send with calls. You may provide any of the following types:
|
|
809
|
+
# * (`String`) The path to a service account key file in JSON format
|
|
810
|
+
# * (`Hash`) A service account key as a Hash
|
|
811
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
|
812
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
|
813
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
|
814
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
|
815
|
+
# * (`nil`) indicating no credentials
|
|
816
|
+
# @return [::Object]
|
|
817
|
+
# @!attribute [rw] scope
|
|
818
|
+
# The OAuth scopes
|
|
819
|
+
# @return [::Array<::String>]
|
|
820
|
+
# @!attribute [rw] lib_name
|
|
821
|
+
# The library name as recorded in instrumentation and logging
|
|
822
|
+
# @return [::String]
|
|
823
|
+
# @!attribute [rw] lib_version
|
|
824
|
+
# The library version as recorded in instrumentation and logging
|
|
825
|
+
# @return [::String]
|
|
826
|
+
# @!attribute [rw] timeout
|
|
827
|
+
# The call timeout in seconds.
|
|
828
|
+
# @return [::Numeric]
|
|
829
|
+
# @!attribute [rw] metadata
|
|
830
|
+
# Additional headers to be sent with the call.
|
|
831
|
+
# @return [::Hash{::Symbol=>::String}]
|
|
832
|
+
# @!attribute [rw] retry_policy
|
|
833
|
+
# The retry policy. The value is a hash with the following keys:
|
|
834
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
835
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
836
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
837
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
838
|
+
# trigger a retry.
|
|
839
|
+
# @return [::Hash]
|
|
840
|
+
# @!attribute [rw] quota_project
|
|
841
|
+
# A separate project against which to charge quota.
|
|
842
|
+
# @return [::String]
|
|
843
|
+
#
|
|
844
|
+
class Configuration
|
|
845
|
+
extend ::Gapic::Config
|
|
846
|
+
|
|
847
|
+
config_attr :endpoint, "discoveryengine.googleapis.com", ::String
|
|
848
|
+
config_attr :credentials, nil do |value|
|
|
849
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
|
850
|
+
allowed.any? { |klass| klass === value }
|
|
851
|
+
end
|
|
852
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
|
853
|
+
config_attr :lib_name, nil, ::String, nil
|
|
854
|
+
config_attr :lib_version, nil, ::String, nil
|
|
855
|
+
config_attr :timeout, nil, ::Numeric, nil
|
|
856
|
+
config_attr :metadata, nil, ::Hash, nil
|
|
857
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
|
858
|
+
config_attr :quota_project, nil, ::String, nil
|
|
859
|
+
|
|
860
|
+
# @private
|
|
861
|
+
def initialize parent_config = nil
|
|
862
|
+
@parent_config = parent_config unless parent_config.nil?
|
|
863
|
+
|
|
864
|
+
yield self if block_given?
|
|
865
|
+
end
|
|
866
|
+
|
|
867
|
+
##
|
|
868
|
+
# Configurations for individual RPCs
|
|
869
|
+
# @return [Rpcs]
|
|
870
|
+
#
|
|
871
|
+
def rpcs
|
|
872
|
+
@rpcs ||= begin
|
|
873
|
+
parent_rpcs = nil
|
|
874
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
|
875
|
+
Rpcs.new parent_rpcs
|
|
876
|
+
end
|
|
877
|
+
end
|
|
878
|
+
|
|
879
|
+
##
|
|
880
|
+
# Configuration RPC class for the DocumentService API.
|
|
881
|
+
#
|
|
882
|
+
# Includes fields providing the configuration for each RPC in this service.
|
|
883
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
|
884
|
+
# the following configuration fields:
|
|
885
|
+
#
|
|
886
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
|
887
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
|
888
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
|
889
|
+
# include the following keys:
|
|
890
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
|
891
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
|
892
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
|
893
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
|
894
|
+
# trigger a retry.
|
|
895
|
+
#
|
|
896
|
+
class Rpcs
|
|
897
|
+
##
|
|
898
|
+
# RPC-specific configuration for `get_document`
|
|
899
|
+
# @return [::Gapic::Config::Method]
|
|
900
|
+
#
|
|
901
|
+
attr_reader :get_document
|
|
902
|
+
##
|
|
903
|
+
# RPC-specific configuration for `list_documents`
|
|
904
|
+
# @return [::Gapic::Config::Method]
|
|
905
|
+
#
|
|
906
|
+
attr_reader :list_documents
|
|
907
|
+
##
|
|
908
|
+
# RPC-specific configuration for `create_document`
|
|
909
|
+
# @return [::Gapic::Config::Method]
|
|
910
|
+
#
|
|
911
|
+
attr_reader :create_document
|
|
912
|
+
##
|
|
913
|
+
# RPC-specific configuration for `update_document`
|
|
914
|
+
# @return [::Gapic::Config::Method]
|
|
915
|
+
#
|
|
916
|
+
attr_reader :update_document
|
|
917
|
+
##
|
|
918
|
+
# RPC-specific configuration for `delete_document`
|
|
919
|
+
# @return [::Gapic::Config::Method]
|
|
920
|
+
#
|
|
921
|
+
attr_reader :delete_document
|
|
922
|
+
##
|
|
923
|
+
# RPC-specific configuration for `import_documents`
|
|
924
|
+
# @return [::Gapic::Config::Method]
|
|
925
|
+
#
|
|
926
|
+
attr_reader :import_documents
|
|
927
|
+
##
|
|
928
|
+
# RPC-specific configuration for `purge_documents`
|
|
929
|
+
# @return [::Gapic::Config::Method]
|
|
930
|
+
#
|
|
931
|
+
attr_reader :purge_documents
|
|
932
|
+
|
|
933
|
+
# @private
|
|
934
|
+
def initialize parent_rpcs = nil
|
|
935
|
+
get_document_config = parent_rpcs.get_document if parent_rpcs.respond_to? :get_document
|
|
936
|
+
@get_document = ::Gapic::Config::Method.new get_document_config
|
|
937
|
+
list_documents_config = parent_rpcs.list_documents if parent_rpcs.respond_to? :list_documents
|
|
938
|
+
@list_documents = ::Gapic::Config::Method.new list_documents_config
|
|
939
|
+
create_document_config = parent_rpcs.create_document if parent_rpcs.respond_to? :create_document
|
|
940
|
+
@create_document = ::Gapic::Config::Method.new create_document_config
|
|
941
|
+
update_document_config = parent_rpcs.update_document if parent_rpcs.respond_to? :update_document
|
|
942
|
+
@update_document = ::Gapic::Config::Method.new update_document_config
|
|
943
|
+
delete_document_config = parent_rpcs.delete_document if parent_rpcs.respond_to? :delete_document
|
|
944
|
+
@delete_document = ::Gapic::Config::Method.new delete_document_config
|
|
945
|
+
import_documents_config = parent_rpcs.import_documents if parent_rpcs.respond_to? :import_documents
|
|
946
|
+
@import_documents = ::Gapic::Config::Method.new import_documents_config
|
|
947
|
+
purge_documents_config = parent_rpcs.purge_documents if parent_rpcs.respond_to? :purge_documents
|
|
948
|
+
@purge_documents = ::Gapic::Config::Method.new purge_documents_config
|
|
949
|
+
|
|
950
|
+
yield self if block_given?
|
|
951
|
+
end
|
|
952
|
+
end
|
|
953
|
+
end
|
|
954
|
+
end
|
|
955
|
+
end
|
|
956
|
+
end
|
|
957
|
+
end
|
|
958
|
+
end
|
|
959
|
+
end
|
|
960
|
+
end
|