1// Copyright 2020 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 15syntax = "proto3"; 16 17package google.cloud.recommendationengine.v1beta1; 18 19import "google/api/field_behavior.proto"; 20import "google/api/resource.proto"; 21import "google/cloud/recommendationengine/v1beta1/catalog.proto"; 22import "google/cloud/recommendationengine/v1beta1/user_event.proto"; 23import "google/cloud/recommendationengine/v1beta1/recommendationengine_resources.proto"; 24import "google/protobuf/timestamp.proto"; 25import "google/rpc/status.proto"; 26 27option csharp_namespace = "Google.Cloud.RecommendationEngine.V1Beta1"; 28option go_package = "cloud.google.com/go/recommendationengine/apiv1beta1/recommendationenginepb;recommendationenginepb"; 29option java_multiple_files = true; 30option java_package = "com.google.cloud.recommendationengine.v1beta1"; 31option objc_class_prefix = "RECAI"; 32option php_namespace = "Google\\Cloud\\RecommendationEngine\\V1beta1"; 33option ruby_package = "Google::Cloud::RecommendationEngine::V1beta1"; 34 35// Google Cloud Storage location for input content. 36// format. 37message GcsSource { 38 // Required. Google Cloud Storage URIs to input files. URI can be up to 39 // 2000 characters long. URIs can match the full object path (for example, 40 // `gs://bucket/directory/object.json`) or a pattern matching one or more 41 // files, such as `gs://bucket/directory/*.json`. A request can 42 // contain at most 100 files, and each file can be up to 2 GB. See 43 // [Importing catalog information](/recommendations-ai/docs/upload-catalog) 44 // for the expected file format and setup instructions. 45 repeated string input_uris = 1 [(google.api.field_behavior) = REQUIRED]; 46} 47 48// The inline source for the input config for ImportCatalogItems method. 49message CatalogInlineSource { 50 // Optional. A list of catalog items to update/create. Recommended max of 10k 51 // items. 52 repeated CatalogItem catalog_items = 1 53 [(google.api.field_behavior) = OPTIONAL]; 54} 55 56// The inline source for the input config for ImportUserEvents method. 57message UserEventInlineSource { 58 // Optional. A list of user events to import. Recommended max of 10k items. 59 repeated UserEvent user_events = 1 [(google.api.field_behavior) = OPTIONAL]; 60} 61 62// Configuration of destination for Import related errors. 63message ImportErrorsConfig { 64 // Required. Errors destination. 65 oneof destination { 66 // Google Cloud Storage path for import errors. This must be an empty, 67 // existing Cloud Storage bucket. Import errors will be written to a file in 68 // this bucket, one per line, as a JSON-encoded 69 // `google.rpc.Status` message. 70 string gcs_prefix = 1; 71 } 72} 73 74// Request message for Import methods. 75message ImportCatalogItemsRequest { 76 // Required. `projects/1234/locations/global/catalogs/default_catalog` 77 string parent = 1 [ 78 (google.api.field_behavior) = REQUIRED, 79 (google.api.resource_reference) = { 80 type: "recommendationengine.googleapis.com/Catalog" 81 } 82 ]; 83 84 // Optional. Unique identifier provided by client, within the ancestor 85 // dataset scope. Ensures idempotency and used for request deduplication. 86 // Server-generated if unspecified. Up to 128 characters long. This is 87 // returned as google.longrunning.Operation.name in the response. 88 string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; 89 90 // Required. The desired input location of the data. 91 InputConfig input_config = 3 [(google.api.field_behavior) = REQUIRED]; 92 93 // Optional. The desired location of errors incurred during the Import. 94 ImportErrorsConfig errors_config = 4 [(google.api.field_behavior) = OPTIONAL]; 95} 96 97// Request message for the ImportUserEvents request. 98message ImportUserEventsRequest { 99 // Required. 100 // `projects/1234/locations/global/catalogs/default_catalog/eventStores/default_event_store` 101 string parent = 1 [ 102 (google.api.field_behavior) = REQUIRED, 103 (google.api.resource_reference) = { 104 type: "recommendationengine.googleapis.com/EventStore" 105 } 106 ]; 107 108 // Optional. Unique identifier provided by client, within the ancestor 109 // dataset scope. Ensures idempotency for expensive long running operations. 110 // Server-generated if unspecified. Up to 128 characters long. This is 111 // returned as google.longrunning.Operation.name in the response. Note that 112 // this field must not be set if the desired input config is 113 // catalog_inline_source. 114 string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; 115 116 // Required. The desired input location of the data. 117 InputConfig input_config = 3 [(google.api.field_behavior) = REQUIRED]; 118 119 // Optional. The desired location of errors incurred during the Import. 120 ImportErrorsConfig errors_config = 4 [(google.api.field_behavior) = OPTIONAL]; 121} 122 123// The input config source. 124message InputConfig { 125 // Required. The source of the input. 126 oneof source { 127 // The Inline source for the input content for Catalog items. 128 CatalogInlineSource catalog_inline_source = 1; 129 130 // Google Cloud Storage location for the input content. 131 GcsSource gcs_source = 2; 132 133 // The Inline source for the input content for UserEvents. 134 UserEventInlineSource user_event_inline_source = 3; 135 } 136} 137 138// Metadata related to the progress of the Import operation. This will be 139// returned by the google.longrunning.Operation.metadata field. 140message ImportMetadata { 141 // Name of the operation. 142 string operation_name = 5; 143 144 // Id of the request / operation. This is parroting back the requestId that 145 // was passed in the request. 146 string request_id = 3; 147 148 // Operation create time. 149 google.protobuf.Timestamp create_time = 4; 150 151 // Count of entries that were processed successfully. 152 int64 success_count = 1; 153 154 // Count of entries that encountered errors while processing. 155 int64 failure_count = 2; 156 157 // Operation last update time. If the operation is done, this is also the 158 // finish time. 159 google.protobuf.Timestamp update_time = 6; 160} 161 162// Response of the ImportCatalogItemsRequest. If the long running 163// operation is done, then this message is returned by the 164// google.longrunning.Operations.response field if the operation was successful. 165message ImportCatalogItemsResponse { 166 // A sample of errors encountered while processing the request. 167 repeated google.rpc.Status error_samples = 1; 168 169 // Echoes the destination for the complete errors in the request if set. 170 ImportErrorsConfig errors_config = 2; 171} 172 173// Response of the ImportUserEventsRequest. If the long running 174// operation was successful, then this message is returned by the 175// google.longrunning.Operations.response field if the operation was successful. 176message ImportUserEventsResponse { 177 // A sample of errors encountered while processing the request. 178 repeated google.rpc.Status error_samples = 1; 179 180 // Echoes the destination for the complete errors if this field was set in 181 // the request. 182 ImportErrorsConfig errors_config = 2; 183 184 // Aggregated statistics of user event import status. 185 UserEventImportSummary import_summary = 3; 186} 187 188// A summary of import result. The UserEventImportSummary summarizes 189// the import status for user events. 190message UserEventImportSummary { 191 // Count of user events imported with complete existing catalog information. 192 int64 joined_events_count = 1; 193 194 // Count of user events imported, but with catalog information not found 195 // in the imported catalog. 196 int64 unjoined_events_count = 2; 197} 198