import_config.proto 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. // Copyright 2021 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.retail.v2alpha;
  16. import "google/api/annotations.proto";
  17. import "google/api/field_behavior.proto";
  18. import "google/api/resource.proto";
  19. import "google/cloud/retail/v2alpha/product.proto";
  20. import "google/cloud/retail/v2alpha/user_event.proto";
  21. import "google/protobuf/field_mask.proto";
  22. import "google/protobuf/timestamp.proto";
  23. import "google/rpc/status.proto";
  24. import "google/type/date.proto";
  25. option csharp_namespace = "Google.Cloud.Retail.V2Alpha";
  26. option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha;retail";
  27. option java_multiple_files = true;
  28. option java_outer_classname = "ImportConfigProto";
  29. option java_package = "com.google.cloud.retail.v2alpha";
  30. option objc_class_prefix = "RETAIL";
  31. option php_namespace = "Google\\Cloud\\Retail\\V2alpha";
  32. option ruby_package = "Google::Cloud::Retail::V2alpha";
  33. // Google Cloud Storage location for input content.
  34. // format.
  35. message GcsSource {
  36. // Required. Google Cloud Storage URIs to input files. URI can be up to
  37. // 2000 characters long. URIs can match the full object path (for example,
  38. // `gs://bucket/directory/object.json`) or a pattern matching one or more
  39. // files, such as `gs://bucket/directory/*.json`. A request can
  40. // contain at most 100 files, and each file can be up to 2 GB. See
  41. // [Importing product
  42. // information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog)
  43. // for the expected file format and setup instructions.
  44. repeated string input_uris = 1 [(google.api.field_behavior) = REQUIRED];
  45. // The schema to use when parsing the data from the source.
  46. //
  47. // Supported values for product imports:
  48. //
  49. // * `product` (default): One JSON
  50. // [Product][google.cloud.retail.v2alpha.Product] per line. Each product must
  51. // have a valid [Product.id][google.cloud.retail.v2alpha.Product.id].
  52. // * `product_merchant_center`: See [Importing catalog data from Merchant
  53. // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
  54. //
  55. // Supported values for user events imports:
  56. //
  57. // * `user_event` (default): One JSON
  58. // [UserEvent][google.cloud.retail.v2alpha.UserEvent] per line.
  59. // * `user_event_ga360`: Using
  60. // https://support.google.com/analytics/answer/3437719.
  61. string data_schema = 2;
  62. }
  63. // BigQuery source import data from.
  64. message BigQuerySource {
  65. // BigQuery table partition info. Leave this empty if the BigQuery table
  66. // is not partitioned.
  67. oneof partition {
  68. // BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
  69. //
  70. // Only supported when
  71. // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode]
  72. // is set to `FULL`.
  73. google.type.Date partition_date = 6;
  74. }
  75. // The project ID (can be project # or ID) that the BigQuery source is in with
  76. // a length limit of 128 characters. If not specified, inherits the project
  77. // ID from the parent request.
  78. string project_id = 5;
  79. // Required. The BigQuery data set to copy the data from with a length limit
  80. // of 1,024 characters.
  81. string dataset_id = 1 [(google.api.field_behavior) = REQUIRED];
  82. // Required. The BigQuery table to copy the data from with a length limit of
  83. // 1,024 characters.
  84. string table_id = 2 [(google.api.field_behavior) = REQUIRED];
  85. // Intermediate Cloud Storage directory used for the import with a length
  86. // limit of 2,000 characters. Can be specified if one wants to have the
  87. // BigQuery export to a specific Cloud Storage directory.
  88. string gcs_staging_dir = 3;
  89. // The schema to use when parsing the data from the source.
  90. //
  91. // Supported values for product imports:
  92. //
  93. // * `product` (default): One JSON
  94. // [Product][google.cloud.retail.v2alpha.Product] per line. Each product must
  95. // have a valid [Product.id][google.cloud.retail.v2alpha.Product.id].
  96. // * `product_merchant_center`: See [Importing catalog data from Merchant
  97. // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
  98. //
  99. // Supported values for user events imports:
  100. //
  101. // * `user_event` (default): One JSON
  102. // [UserEvent][google.cloud.retail.v2alpha.UserEvent] per line.
  103. // * `user_event_ga360`: Using
  104. // https://support.google.com/analytics/answer/3437719.
  105. string data_schema = 4;
  106. }
  107. // The inline source for the input config for ImportProducts method.
  108. message ProductInlineSource {
  109. // Required. A list of products to update/create. Each product must have a
  110. // valid [Product.id][google.cloud.retail.v2alpha.Product.id]. Recommended max
  111. // of 100 items.
  112. repeated Product products = 1 [(google.api.field_behavior) = REQUIRED];
  113. }
  114. // The inline source for the input config for ImportUserEvents method.
  115. message UserEventInlineSource {
  116. // Required. A list of user events to import. Recommended max of 10k items.
  117. repeated UserEvent user_events = 1 [(google.api.field_behavior) = REQUIRED];
  118. }
  119. // Configuration of destination for Import related errors.
  120. message ImportErrorsConfig {
  121. // Required. Errors destination.
  122. oneof destination {
  123. // Google Cloud Storage path for import errors. This must be an empty,
  124. // existing Cloud Storage bucket. Import errors will be written to a file in
  125. // this bucket, one per line, as a JSON-encoded
  126. // `google.rpc.Status` message.
  127. string gcs_prefix = 1;
  128. }
  129. }
  130. // Request message for Import methods.
  131. message ImportProductsRequest {
  132. // Indicates how imported products are reconciled with the existing products
  133. // created or imported before.
  134. enum ReconciliationMode {
  135. // Defaults to INCREMENTAL.
  136. RECONCILIATION_MODE_UNSPECIFIED = 0;
  137. // Inserts new products or updates existing products.
  138. INCREMENTAL = 1;
  139. // Calculates diff and replaces the entire product dataset. Existing
  140. // products may be deleted if they are not present in the source location.
  141. //
  142. // Can only be while using
  143. // [BigQuerySource][google.cloud.retail.v2alpha.BigQuerySource].
  144. //
  145. // Add the IAM permission “BigQuery Data Viewer” for
  146. // cloud-retail-customer-data-access@system.gserviceaccount.com before
  147. // using this feature otherwise an error is thrown.
  148. //
  149. // This feature is only available for users who have Retail Search enabled.
  150. // Contact Retail Support (retail-search-support@google.com) if you are
  151. // interested in using Retail Search.
  152. FULL = 2;
  153. }
  154. // Required.
  155. // `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch`
  156. //
  157. // If no updateMask is specified, requires products.create permission.
  158. // If updateMask is specified, requires products.update permission.
  159. string parent = 1 [
  160. (google.api.field_behavior) = REQUIRED,
  161. (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" }
  162. ];
  163. // Unique identifier provided by client, within the ancestor
  164. // dataset scope. Ensures idempotency and used for request deduplication.
  165. // Server-generated if unspecified. Up to 128 characters long and must match
  166. // the pattern: "[a-zA-Z0-9_]+". This is returned as [Operation.name][] in
  167. // [ImportMetadata][google.cloud.retail.v2alpha.ImportMetadata].
  168. //
  169. // Only supported when
  170. // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode]
  171. // is set to `FULL`.
  172. string request_id = 6;
  173. // Required. The desired input location of the data.
  174. ProductInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED];
  175. // The desired location of errors incurred during the Import.
  176. ImportErrorsConfig errors_config = 3;
  177. // Indicates which fields in the provided imported 'products' to update. If
  178. // not set, will by default update all fields.
  179. google.protobuf.FieldMask update_mask = 4;
  180. // The mode of reconciliation between existing products and the products to be
  181. // imported. Defaults to
  182. // [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2alpha.ImportProductsRequest.ReconciliationMode.INCREMENTAL].
  183. ReconciliationMode reconciliation_mode = 5;
  184. // Pub/Sub topic for receiving notification. If this field is set,
  185. // when the import is finished, a notification will be sent to
  186. // specified Pub/Sub topic. The message data will be JSON string of a
  187. // [Operation][google.longrunning.Operation].
  188. // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
  189. //
  190. // Only supported when
  191. // [ImportProductsRequest.reconciliation_mode][google.cloud.retail.v2alpha.ImportProductsRequest.reconciliation_mode]
  192. // is set to `FULL`.
  193. string notification_pubsub_topic = 7;
  194. }
  195. // Request message for the ImportUserEvents request.
  196. message ImportUserEventsRequest {
  197. // Required. `projects/1234/locations/global/catalogs/default_catalog`
  198. string parent = 1 [
  199. (google.api.field_behavior) = REQUIRED,
  200. (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" }
  201. ];
  202. // Required. The desired input location of the data.
  203. UserEventInputConfig input_config = 2
  204. [(google.api.field_behavior) = REQUIRED];
  205. // The desired location of errors incurred during the Import. Cannot be set
  206. // for inline user event imports.
  207. ImportErrorsConfig errors_config = 3;
  208. }
  209. // Request message for ImportCompletionData methods.
  210. message ImportCompletionDataRequest {
  211. // Required. The catalog which the suggestions dataset belongs to.
  212. //
  213. // Format: `projects/1234/locations/global/catalogs/default_catalog`.
  214. string parent = 1 [
  215. (google.api.field_behavior) = REQUIRED,
  216. (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" }
  217. ];
  218. // Required. The desired input location of the data.
  219. CompletionDataInputConfig input_config = 2
  220. [(google.api.field_behavior) = REQUIRED];
  221. // Pub/Sub topic for receiving notification. If this field is set,
  222. // when the import is finished, a notification will be sent to
  223. // specified Pub/Sub topic. The message data will be JSON string of a
  224. // [Operation][google.longrunning.Operation].
  225. // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
  226. string notification_pubsub_topic = 3;
  227. }
  228. // The input config source for products.
  229. message ProductInputConfig {
  230. // Required. The source of the input.
  231. oneof source {
  232. // The Inline source for the input content for products.
  233. ProductInlineSource product_inline_source = 1;
  234. // Google Cloud Storage location for the input content.
  235. GcsSource gcs_source = 2;
  236. // BigQuery input source.
  237. BigQuerySource big_query_source = 3;
  238. }
  239. }
  240. // The input config source for user events.
  241. message UserEventInputConfig {
  242. // The source of the input.
  243. oneof source {
  244. // Required. The Inline source for the input content for UserEvents.
  245. UserEventInlineSource user_event_inline_source = 1
  246. [(google.api.field_behavior) = REQUIRED];
  247. // Required. Google Cloud Storage location for the input content.
  248. GcsSource gcs_source = 2 [(google.api.field_behavior) = REQUIRED];
  249. // Required. BigQuery input source.
  250. BigQuerySource big_query_source = 3
  251. [(google.api.field_behavior) = REQUIRED];
  252. }
  253. }
  254. // The input config source for completion data.
  255. message CompletionDataInputConfig {
  256. // The source of the input.
  257. //
  258. // Supported
  259. // [BigQuerySource.data_schema][google.cloud.retail.v2alpha.BigQuerySource.data_schema]
  260. // values for suggestions imports:
  261. //
  262. // * `suggestions` (default): One JSON completion suggestion per line.
  263. // * `denylist`: One JSON deny suggestion per line.
  264. // * `allowlist`: One JSON allow suggestion per line.
  265. oneof source {
  266. // Required. BigQuery input source.
  267. //
  268. // Add the IAM permission “BigQuery Data Viewer” for
  269. // cloud-retail-customer-data-access@system.gserviceaccount.com before
  270. // using this feature otherwise an error is thrown.
  271. BigQuerySource big_query_source = 1
  272. [(google.api.field_behavior) = REQUIRED];
  273. }
  274. }
  275. // Metadata related to the progress of the Import operation. This will be
  276. // returned by the google.longrunning.Operation.metadata field.
  277. message ImportMetadata {
  278. // Operation create time.
  279. google.protobuf.Timestamp create_time = 1;
  280. // Operation last update time. If the operation is done, this is also the
  281. // finish time.
  282. google.protobuf.Timestamp update_time = 2;
  283. // Count of entries that were processed successfully.
  284. int64 success_count = 3;
  285. // Count of entries that encountered errors while processing.
  286. int64 failure_count = 4;
  287. // Id of the request / operation. This is parroting back the requestId
  288. // that was passed in the request.
  289. string request_id = 5;
  290. // Pub/Sub topic for receiving notification. If this field is set,
  291. // when the import is finished, a notification will be sent to
  292. // specified Pub/Sub topic. The message data will be JSON string of a
  293. // [Operation][google.longrunning.Operation].
  294. // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
  295. string notification_pubsub_topic = 6;
  296. }
  297. // Response of the
  298. // [ImportProductsRequest][google.cloud.retail.v2alpha.ImportProductsRequest].
  299. // If the long running operation is done, then this message is returned by the
  300. // google.longrunning.Operations.response field if the operation was successful.
  301. message ImportProductsResponse {
  302. // A sample of errors encountered while processing the request.
  303. repeated google.rpc.Status error_samples = 1;
  304. // Echoes the destination for the complete errors in the request if set.
  305. ImportErrorsConfig errors_config = 2;
  306. }
  307. // Response of the ImportUserEventsRequest. If the long running
  308. // operation was successful, then this message is returned by the
  309. // google.longrunning.Operations.response field if the operation was successful.
  310. message ImportUserEventsResponse {
  311. // A sample of errors encountered while processing the request.
  312. repeated google.rpc.Status error_samples = 1;
  313. // Echoes the destination for the complete errors if this field was set in
  314. // the request.
  315. ImportErrorsConfig errors_config = 2;
  316. // Aggregated statistics of user event import status.
  317. UserEventImportSummary import_summary = 3;
  318. }
  319. // A summary of import result. The UserEventImportSummary summarizes
  320. // the import status for user events.
  321. message UserEventImportSummary {
  322. // Count of user events imported with complete existing catalog information.
  323. int64 joined_events_count = 1;
  324. // Count of user events imported, but with catalog information not found
  325. // in the imported catalog.
  326. int64 unjoined_events_count = 2;
  327. }
  328. // Response of the
  329. // [ImportCompletionDataRequest][google.cloud.retail.v2alpha.ImportCompletionDataRequest].
  330. // If the long running operation is done, this message is returned by the
  331. // google.longrunning.Operations.response field if the operation is successful.
  332. message ImportCompletionDataResponse {
  333. // A sample of errors encountered while processing the request.
  334. repeated google.rpc.Status error_samples = 1;
  335. }