import_config.proto 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.cloud.discoveryengine.v1beta;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/cloud/discoveryengine/v1beta/document.proto";
  19. import "google/cloud/discoveryengine/v1beta/user_event.proto";
  20. import "google/protobuf/timestamp.proto";
  21. import "google/rpc/status.proto";
  22. import "google/type/date.proto";
  23. option csharp_namespace = "Google.Cloud.DiscoveryEngine.V1Beta";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/discoveryengine/v1beta;discoveryengine";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "ImportConfigProto";
  27. option java_package = "com.google.cloud.discoveryengine.v1beta";
  28. option objc_class_prefix = "DISCOVERYENGINE";
  29. option php_namespace = "Google\\Cloud\\DiscoveryEngine\\V1beta";
  30. option ruby_package = "Google::Cloud::DiscoveryEngine::V1beta";
  31. // Google Cloud Storage location for input content.
  32. // format.
  33. message GcsSource {
  34. // Required. Google Cloud Storage URIs to input files. URI can be up to
  35. // 2000 characters long. URIs can match the full object path (for example,
  36. // `gs://bucket/directory/object.json`) or a pattern matching one or more
  37. // files, such as `gs://bucket/directory/*.json`. A request can
  38. // contain at most 100 files, and each file can be up to 2 GB.
  39. repeated string input_uris = 1 [(google.api.field_behavior) = REQUIRED];
  40. // The schema to use when parsing the data from the source.
  41. //
  42. // Supported values for imports:
  43. //
  44. // * `user_event` (default): One JSON
  45. // [UserEvent][google.cloud.discoveryengine.v1beta.UserEvent] per line.
  46. //
  47. // * `document` (default): One JSON
  48. // [Document][google.cloud.discoveryengine.v1beta.Document] per line. Each
  49. // document must
  50. // have a valid
  51. // [Document.id][google.cloud.discoveryengine.v1beta.Document.id].
  52. string data_schema = 2;
  53. }
  54. // BigQuery source import data from.
  55. message BigQuerySource {
  56. // BigQuery table partition info. Leave this empty if the BigQuery table
  57. // is not partitioned.
  58. oneof partition {
  59. // BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
  60. google.type.Date partition_date = 5;
  61. }
  62. // The project ID (can be project # or ID) that the BigQuery source is in with
  63. // a length limit of 128 characters. If not specified, inherits the project
  64. // ID from the parent request.
  65. string project_id = 1;
  66. // Required. The BigQuery data set to copy the data from with a length limit
  67. // of 1,024 characters.
  68. string dataset_id = 2 [(google.api.field_behavior) = REQUIRED];
  69. // Required. The BigQuery table to copy the data from with a length limit of
  70. // 1,024 characters.
  71. string table_id = 3 [(google.api.field_behavior) = REQUIRED];
  72. // Intermediate Cloud Storage directory used for the import with a length
  73. // limit of 2,000 characters. Can be specified if one wants to have the
  74. // BigQuery export to a specific Cloud Storage directory.
  75. string gcs_staging_dir = 4;
  76. // The schema to use when parsing the data from the source.
  77. //
  78. // Supported values for imports:
  79. //
  80. // * `user_event` (default): One JSON
  81. // [UserEvent][google.cloud.discoveryengine.v1beta.UserEvent] per line.
  82. //
  83. // * `document` (default): One JSON
  84. // [Document][google.cloud.discoveryengine.v1beta.Document] per line. Each
  85. // document must have a valid [document.id][].
  86. string data_schema = 6;
  87. }
  88. // Configuration of destination for Import related errors.
  89. message ImportErrorConfig {
  90. // Required. Errors destination.
  91. oneof destination {
  92. // Google Cloud Storage prefix for import errors. This must be an empty,
  93. // existing Cloud Storage directory. Import errors will be written to
  94. // sharded files in this directory, one per line, as a JSON-encoded
  95. // `google.rpc.Status` message.
  96. string gcs_prefix = 1;
  97. }
  98. }
  99. // Request message for the ImportUserEvents request.
  100. message ImportUserEventsRequest {
  101. // The inline source for the input config for ImportUserEvents method.
  102. message InlineSource {
  103. // Required. A list of user events to import. Recommended max of 10k items.
  104. repeated UserEvent user_events = 1 [(google.api.field_behavior) = REQUIRED];
  105. }
  106. // The desired input source of the user event data.
  107. oneof source {
  108. // Required. The Inline source for the input content for UserEvents.
  109. InlineSource inline_source = 2 [(google.api.field_behavior) = REQUIRED];
  110. // Required. Google Cloud Storage location for the input content.
  111. GcsSource gcs_source = 3 [(google.api.field_behavior) = REQUIRED];
  112. // Required. BigQuery input source.
  113. BigQuerySource bigquery_source = 4 [(google.api.field_behavior) = REQUIRED];
  114. }
  115. // Required. Parent DataStore resource name, of the form
  116. // `projects/{project}/locations/{location}/dataStores/{data_store}`
  117. string parent = 1 [
  118. (google.api.field_behavior) = REQUIRED,
  119. (google.api.resource_reference) = {
  120. type: "discoveryengine.googleapis.com/DataStore"
  121. }
  122. ];
  123. // The desired location of errors incurred during the Import. Cannot be set
  124. // for inline user event imports.
  125. ImportErrorConfig error_config = 5;
  126. }
  127. // Response of the ImportUserEventsRequest. If the long running
  128. // operation was successful, then this message is returned by the
  129. // google.longrunning.Operations.response field if the operation was successful.
  130. message ImportUserEventsResponse {
  131. // A sample of errors encountered while processing the request.
  132. repeated google.rpc.Status error_samples = 1;
  133. // Echoes the destination for the complete errors if this field was set in
  134. // the request.
  135. ImportErrorConfig error_config = 2;
  136. // Count of user events imported with complete existing Documents.
  137. int64 joined_events_count = 3;
  138. // Count of user events imported, but with Document information not found
  139. // in the existing Branch.
  140. int64 unjoined_events_count = 4;
  141. }
  142. // Metadata related to the progress of the Import operation. This will be
  143. // returned by the google.longrunning.Operation.metadata field.
  144. message ImportUserEventsMetadata {
  145. // Operation create time.
  146. google.protobuf.Timestamp create_time = 1;
  147. // Operation last update time. If the operation is done, this is also the
  148. // finish time.
  149. google.protobuf.Timestamp update_time = 2;
  150. // Count of entries that were processed successfully.
  151. int64 success_count = 3;
  152. // Count of entries that encountered errors while processing.
  153. int64 failure_count = 4;
  154. }
  155. // Metadata related to the progress of the ImportDocuments operation. This will
  156. // be returned by the google.longrunning.Operation.metadata field.
  157. message ImportDocumentsMetadata {
  158. // Operation create time.
  159. google.protobuf.Timestamp create_time = 1;
  160. // Operation last update time. If the operation is done, this is also the
  161. // finish time.
  162. google.protobuf.Timestamp update_time = 2;
  163. // Count of entries that were processed successfully.
  164. int64 success_count = 3;
  165. // Count of entries that encountered errors while processing.
  166. int64 failure_count = 4;
  167. }
  168. // Request message for Import methods.
  169. message ImportDocumentsRequest {
  170. // The inline source for the input config for ImportDocuments method.
  171. message InlineSource {
  172. // Required. A list of documents to update/create. Each document must have a
  173. // valid [Document.id][google.cloud.discoveryengine.v1beta.Document.id].
  174. // Recommended max of 100 items.
  175. repeated Document documents = 1 [(google.api.field_behavior) = REQUIRED];
  176. }
  177. // Indicates how imported documents are reconciled with the existing documents
  178. // created or imported before.
  179. enum ReconciliationMode {
  180. // Defaults to INCREMENTAL.
  181. RECONCILIATION_MODE_UNSPECIFIED = 0;
  182. // Inserts new documents or updates existing documents.
  183. INCREMENTAL = 1;
  184. // Calculates diff and replaces the entire document dataset. Existing
  185. // documents may be deleted if they are not present in the source location.
  186. FULL = 2;
  187. }
  188. // Required. The source of the input.
  189. oneof source {
  190. // The Inline source for the input content for documents.
  191. InlineSource inline_source = 2;
  192. // Google Cloud Storage location for the input content.
  193. GcsSource gcs_source = 3;
  194. // BigQuery input source.
  195. BigQuerySource bigquery_source = 4;
  196. }
  197. // Required. The parent branch resource name, such as
  198. // `projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}`.
  199. // Requires create/update permission.
  200. string parent = 1 [
  201. (google.api.field_behavior) = REQUIRED,
  202. (google.api.resource_reference) = {
  203. type: "discoveryengine.googleapis.com/Branch"
  204. }
  205. ];
  206. // The desired location of errors incurred during the Import.
  207. ImportErrorConfig error_config = 5;
  208. // The mode of reconciliation between existing documents and the documents to
  209. // be imported. Defaults to
  210. // [ReconciliationMode.INCREMENTAL][google.cloud.discoveryengine.v1beta.ImportDocumentsRequest.ReconciliationMode.INCREMENTAL].
  211. ReconciliationMode reconciliation_mode = 6;
  212. }
  213. // Response of the
  214. // [ImportDocumentsRequest][google.cloud.discoveryengine.v1beta.ImportDocumentsRequest].
  215. // If the long running operation is done, then this message is returned by the
  216. // google.longrunning.Operations.response field if the operation was successful.
  217. message ImportDocumentsResponse {
  218. // A sample of errors encountered while processing the request.
  219. repeated google.rpc.Status error_samples = 1;
  220. // Echoes the destination for the complete errors in the request if set.
  221. ImportErrorConfig error_config = 2;
  222. }