import_config.proto 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  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.v2;
  16. import "google/api/field_behavior.proto";
  17. import "google/api/resource.proto";
  18. import "google/cloud/retail/v2/product.proto";
  19. import "google/cloud/retail/v2/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.V2";
  25. option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail";
  26. option java_multiple_files = true;
  27. option java_outer_classname = "ImportConfigProto";
  28. option java_package = "com.google.cloud.retail.v2";
  29. option objc_class_prefix = "RETAIL";
  30. option php_namespace = "Google\\Cloud\\Retail\\V2";
  31. option ruby_package = "Google::Cloud::Retail::V2";
  32. // Google Cloud Storage location for input content.
  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. See
  39. // [Importing product
  40. // information](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog)
  41. // for the expected file format and setup instructions.
  42. repeated string input_uris = 1 [(google.api.field_behavior) = REQUIRED];
  43. // The schema to use when parsing the data from the source.
  44. //
  45. // Supported values for product imports:
  46. //
  47. // * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
  48. // per line. Each product must
  49. // have a valid [Product.id][google.cloud.retail.v2.Product.id].
  50. // * `product_merchant_center`: See [Importing catalog data from Merchant
  51. // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
  52. //
  53. // Supported values for user events imports:
  54. //
  55. // * `user_event` (default): One JSON
  56. // [UserEvent][google.cloud.retail.v2.UserEvent] per line.
  57. // * `user_event_ga360`: Using
  58. // https://support.google.com/analytics/answer/3437719.
  59. //
  60. // Supported values for control imports:
  61. //
  62. // * `control` (default): One JSON [Control][google.cloud.retail.v2.Control]
  63. // per line.
  64. //
  65. // Supported values for catalog attribute imports:
  66. //
  67. // * `catalog_attribute` (default): One CSV
  68. // [CatalogAttribute][google.cloud.retail.v2.CatalogAttribute] per line.
  69. string data_schema = 2;
  70. }
  71. // BigQuery source import data from.
  72. message BigQuerySource {
  73. // BigQuery table partition info. Leave this empty if the BigQuery table
  74. // is not partitioned.
  75. oneof partition {
  76. // BigQuery time partitioned table's _PARTITIONDATE in YYYY-MM-DD format.
  77. //
  78. // Only supported in
  79. // [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest].
  80. google.type.Date partition_date = 6;
  81. }
  82. // The project ID (can be project # or ID) that the BigQuery source is in with
  83. // a length limit of 128 characters. If not specified, inherits the project
  84. // ID from the parent request.
  85. string project_id = 5;
  86. // Required. The BigQuery data set to copy the data from with a length limit
  87. // of 1,024 characters.
  88. string dataset_id = 1 [(google.api.field_behavior) = REQUIRED];
  89. // Required. The BigQuery table to copy the data from with a length limit of
  90. // 1,024 characters.
  91. string table_id = 2 [(google.api.field_behavior) = REQUIRED];
  92. // Intermediate Cloud Storage directory used for the import with a length
  93. // limit of 2,000 characters. Can be specified if one wants to have the
  94. // BigQuery export to a specific Cloud Storage directory.
  95. string gcs_staging_dir = 3;
  96. // The schema to use when parsing the data from the source.
  97. //
  98. // Supported values for product imports:
  99. //
  100. // * `product` (default): One JSON [Product][google.cloud.retail.v2.Product]
  101. // per line. Each product must
  102. // have a valid [Product.id][google.cloud.retail.v2.Product.id].
  103. // * `product_merchant_center`: See [Importing catalog data from Merchant
  104. // Center](https://cloud.google.com/retail/recommendations-ai/docs/upload-catalog#mc).
  105. //
  106. // Supported values for user events imports:
  107. //
  108. // * `user_event` (default): One JSON
  109. // [UserEvent][google.cloud.retail.v2.UserEvent] per line.
  110. // * `user_event_ga360`:
  111. // The schema is available here:
  112. // https://support.google.com/analytics/answer/3437719.
  113. // * `user_event_ga4`:
  114. // The schema is available here:
  115. // https://support.google.com/analytics/answer/7029846.
  116. //
  117. // Supported values for auto-completion imports:
  118. //
  119. // * `suggestions` (default): One JSON completion suggestion per line.
  120. // * `denylist`: One JSON deny suggestion per line.
  121. // * `allowlist`: One JSON allow suggestion per line.
  122. string data_schema = 4;
  123. }
  124. // The inline source for the input config for ImportProducts method.
  125. message ProductInlineSource {
  126. // Required. A list of products to update/create. Each product must have a
  127. // valid [Product.id][google.cloud.retail.v2.Product.id]. Recommended max of
  128. // 100 items.
  129. repeated Product products = 1 [(google.api.field_behavior) = REQUIRED];
  130. }
  131. // The inline source for the input config for ImportUserEvents method.
  132. message UserEventInlineSource {
  133. // Required. A list of user events to import. Recommended max of 10k items.
  134. repeated UserEvent user_events = 1 [(google.api.field_behavior) = REQUIRED];
  135. }
  136. // Configuration of destination for Import related errors.
  137. message ImportErrorsConfig {
  138. // Required. Errors destination.
  139. oneof destination {
  140. // Google Cloud Storage prefix for import errors. This must be an empty,
  141. // existing Cloud Storage directory. Import errors are written to
  142. // sharded files in this directory, one per line, as a JSON-encoded
  143. // `google.rpc.Status` message.
  144. string gcs_prefix = 1;
  145. }
  146. }
  147. // Request message for Import methods.
  148. message ImportProductsRequest {
  149. // Indicates how imported products are reconciled with the existing products
  150. // created or imported before.
  151. enum ReconciliationMode {
  152. // Defaults to INCREMENTAL.
  153. RECONCILIATION_MODE_UNSPECIFIED = 0;
  154. // Inserts new products or updates existing products.
  155. INCREMENTAL = 1;
  156. // Calculates diff and replaces the entire product dataset. Existing
  157. // products may be deleted if they are not present in the source location.
  158. FULL = 2;
  159. }
  160. // Required.
  161. // `projects/1234/locations/global/catalogs/default_catalog/branches/default_branch`
  162. //
  163. // If no updateMask is specified, requires products.create permission.
  164. // If updateMask is specified, requires products.update permission.
  165. string parent = 1 [
  166. (google.api.field_behavior) = REQUIRED,
  167. (google.api.resource_reference) = { type: "retail.googleapis.com/Branch" }
  168. ];
  169. // Deprecated. This field has no effect.
  170. string request_id = 6 [deprecated = true];
  171. // Required. The desired input location of the data.
  172. ProductInputConfig input_config = 2 [(google.api.field_behavior) = REQUIRED];
  173. // The desired location of errors incurred during the Import.
  174. ImportErrorsConfig errors_config = 3;
  175. // Indicates which fields in the provided imported `products` to update. If
  176. // not set, all fields are updated.
  177. google.protobuf.FieldMask update_mask = 4;
  178. // The mode of reconciliation between existing products and the products to be
  179. // imported. Defaults to
  180. // [ReconciliationMode.INCREMENTAL][google.cloud.retail.v2.ImportProductsRequest.ReconciliationMode.INCREMENTAL].
  181. ReconciliationMode reconciliation_mode = 5;
  182. // Full Pub/Sub topic name for receiving notification. If this field is set,
  183. // when the import is finished, a notification is sent to
  184. // specified Pub/Sub topic. The message data is JSON string of a
  185. // [Operation][google.longrunning.Operation].
  186. //
  187. // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`. It has
  188. // to be within the same project as
  189. // [ImportProductsRequest.parent][google.cloud.retail.v2.ImportProductsRequest.parent].
  190. // Make sure that `service-<project
  191. // number>@gcp-sa-retail.iam.gserviceaccount.com` has the
  192. // `pubsub.topics.publish` IAM permission on the topic.
  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 is sent to
  223. // specified Pub/Sub topic. The message data is 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.v2.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 is
  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. // Deprecated. This field is never set.
  288. string request_id = 5 [deprecated = true];
  289. // Pub/Sub topic for receiving notification. If this field is set,
  290. // when the import is finished, a notification is sent to
  291. // specified Pub/Sub topic. The message data is JSON string of a
  292. // [Operation][google.longrunning.Operation].
  293. // Format of the Pub/Sub topic is `projects/{project}/topics/{topic}`.
  294. string notification_pubsub_topic = 6;
  295. }
  296. // Response of the
  297. // [ImportProductsRequest][google.cloud.retail.v2.ImportProductsRequest]. If the
  298. // long running operation is done, then this message is returned by the
  299. // google.longrunning.Operations.response field if the operation was successful.
  300. message ImportProductsResponse {
  301. // A sample of errors encountered while processing the request.
  302. repeated google.rpc.Status error_samples = 1;
  303. // Echoes the destination for the complete errors in the request if set.
  304. ImportErrorsConfig errors_config = 2;
  305. }
  306. // Response of the ImportUserEventsRequest. If the long running
  307. // operation was successful, then this message is returned by the
  308. // google.longrunning.Operations.response field if the operation was successful.
  309. message ImportUserEventsResponse {
  310. // A sample of errors encountered while processing the request.
  311. repeated google.rpc.Status error_samples = 1;
  312. // Echoes the destination for the complete errors if this field was set in
  313. // the request.
  314. ImportErrorsConfig errors_config = 2;
  315. // Aggregated statistics of user event import status.
  316. UserEventImportSummary import_summary = 3;
  317. }
  318. // A summary of import result. The UserEventImportSummary summarizes
  319. // the import status for user events.
  320. message UserEventImportSummary {
  321. // Count of user events imported with complete existing catalog information.
  322. int64 joined_events_count = 1;
  323. // Count of user events imported, but with catalog information not found
  324. // in the imported catalog.
  325. int64 unjoined_events_count = 2;
  326. }
  327. // Response of the
  328. // [ImportCompletionDataRequest][google.cloud.retail.v2.ImportCompletionDataRequest].
  329. // If the long running operation is done, this message is returned by the
  330. // google.longrunning.Operations.response field if the operation is successful.
  331. message ImportCompletionDataResponse {
  332. // A sample of errors encountered while processing the request.
  333. repeated google.rpc.Status error_samples = 1;
  334. }