import_config.proto 16 KB

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