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 15syntax = "proto3"; 16 17package google.cloud.retail.v2beta; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/api/field_behavior.proto"; 22import "google/api/resource.proto"; 23import "google/cloud/retail/v2beta/serving_config.proto"; 24import "google/protobuf/empty.proto"; 25import "google/protobuf/field_mask.proto"; 26 27option csharp_namespace = "Google.Cloud.Retail.V2Beta"; 28option go_package = "cloud.google.com/go/retail/apiv2beta/retailpb;retailpb"; 29option java_multiple_files = true; 30option java_outer_classname = "ServingConfigServiceProto"; 31option java_package = "com.google.cloud.retail.v2beta"; 32option objc_class_prefix = "RETAIL"; 33option php_namespace = "Google\\Cloud\\Retail\\V2beta"; 34option ruby_package = "Google::Cloud::Retail::V2beta"; 35 36// Service for modifying ServingConfig. 37service ServingConfigService { 38 option (google.api.default_host) = "retail.googleapis.com"; 39 option (google.api.oauth_scopes) = 40 "https://www.googleapis.com/auth/cloud-platform"; 41 42 // Creates a ServingConfig. 43 // 44 // A maximum of 100 [ServingConfig][google.cloud.retail.v2beta.ServingConfig]s 45 // are allowed in a [Catalog][google.cloud.retail.v2beta.Catalog], otherwise 46 // a FAILED_PRECONDITION error is returned. 47 rpc CreateServingConfig(CreateServingConfigRequest) returns (ServingConfig) { 48 option (google.api.http) = { 49 post: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" 50 body: "serving_config" 51 }; 52 option (google.api.method_signature) = 53 "parent,serving_config,serving_config_id"; 54 } 55 56 // Deletes a ServingConfig. 57 // 58 // Returns a NotFound error if the ServingConfig does not exist. 59 rpc DeleteServingConfig(DeleteServingConfigRequest) 60 returns (google.protobuf.Empty) { 61 option (google.api.http) = { 62 delete: "/v2beta/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" 63 }; 64 option (google.api.method_signature) = "name"; 65 } 66 67 // Updates a ServingConfig. 68 rpc UpdateServingConfig(UpdateServingConfigRequest) returns (ServingConfig) { 69 option (google.api.http) = { 70 patch: "/v2beta/{serving_config.name=projects/*/locations/*/catalogs/*/servingConfigs/*}" 71 body: "serving_config" 72 }; 73 option (google.api.method_signature) = "serving_config,update_mask"; 74 } 75 76 // Gets a ServingConfig. 77 // 78 // Returns a NotFound error if the ServingConfig does not exist. 79 rpc GetServingConfig(GetServingConfigRequest) returns (ServingConfig) { 80 option (google.api.http) = { 81 get: "/v2beta/{name=projects/*/locations/*/catalogs/*/servingConfigs/*}" 82 }; 83 option (google.api.method_signature) = "name"; 84 } 85 86 // Lists all ServingConfigs linked to this catalog. 87 rpc ListServingConfigs(ListServingConfigsRequest) 88 returns (ListServingConfigsResponse) { 89 option (google.api.http) = { 90 get: "/v2beta/{parent=projects/*/locations/*/catalogs/*}/servingConfigs" 91 }; 92 option (google.api.method_signature) = "parent"; 93 } 94 95 // Enables a Control on the specified ServingConfig. 96 // The control is added in the last position of the list of controls 97 // it belongs to (e.g. if it's a facet spec control it will be applied 98 // in the last position of servingConfig.facetSpecIds) 99 // Returns a ALREADY_EXISTS error if the control has already been applied. 100 // Returns a FAILED_PRECONDITION error if the addition could exceed maximum 101 // number of control allowed for that type of control. 102 rpc AddControl(AddControlRequest) returns (ServingConfig) { 103 option (google.api.http) = { 104 post: "/v2beta/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:addControl" 105 body: "*" 106 }; 107 option (google.api.method_signature) = "serving_config"; 108 } 109 110 // Disables a Control on the specified ServingConfig. 111 // The control is removed from the ServingConfig. 112 // Returns a NOT_FOUND error if the Control is not enabled for the 113 // ServingConfig. 114 rpc RemoveControl(RemoveControlRequest) returns (ServingConfig) { 115 option (google.api.http) = { 116 post: "/v2beta/{serving_config=projects/*/locations/*/catalogs/*/servingConfigs/*}:removeControl" 117 body: "*" 118 }; 119 option (google.api.method_signature) = "serving_config"; 120 } 121} 122 123// Request for CreateServingConfig method. 124message CreateServingConfigRequest { 125 // Required. Full resource name of parent. Format: 126 // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` 127 string parent = 1 [ 128 (google.api.field_behavior) = REQUIRED, 129 (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } 130 ]; 131 132 // Required. The ServingConfig to create. 133 ServingConfig serving_config = 2 [(google.api.field_behavior) = REQUIRED]; 134 135 // Required. The ID to use for the ServingConfig, which will become the final 136 // component of the ServingConfig's resource name. 137 // 138 // This value should be 4-63 characters, and valid characters 139 // are /[a-z][0-9]-_/. 140 string serving_config_id = 3 [(google.api.field_behavior) = REQUIRED]; 141} 142 143// Request for UpdateServingConfig method. 144message UpdateServingConfigRequest { 145 // Required. The ServingConfig to update. 146 ServingConfig serving_config = 1 [(google.api.field_behavior) = REQUIRED]; 147 148 // Indicates which fields in the provided 149 // [ServingConfig][google.cloud.retail.v2beta.ServingConfig] to update. The 150 // following are NOT supported: 151 // 152 // * [ServingConfig.name][google.cloud.retail.v2beta.ServingConfig.name] 153 // 154 // If not set, all supported fields are updated. 155 google.protobuf.FieldMask update_mask = 2; 156} 157 158// Request for DeleteServingConfig method. 159message DeleteServingConfigRequest { 160 // Required. The resource name of the ServingConfig to delete. Format: 161 // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` 162 string name = 1 [ 163 (google.api.field_behavior) = REQUIRED, 164 (google.api.resource_reference) = { 165 type: "retail.googleapis.com/ServingConfig" 166 } 167 ]; 168} 169 170// Request for GetServingConfig method. 171message GetServingConfigRequest { 172 // Required. The resource name of the ServingConfig to get. Format: 173 // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` 174 string name = 1 [ 175 (google.api.field_behavior) = REQUIRED, 176 (google.api.resource_reference) = { 177 type: "retail.googleapis.com/ServingConfig" 178 } 179 ]; 180} 181 182// Request for ListServingConfigs method. 183message ListServingConfigsRequest { 184 // Required. The catalog resource name. Format: 185 // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}` 186 string parent = 1 [ 187 (google.api.field_behavior) = REQUIRED, 188 (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" } 189 ]; 190 191 // Optional. Maximum number of results to return. If unspecified, defaults 192 // to 100. If a value greater than 100 is provided, at most 100 results are 193 // returned. 194 int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; 195 196 // Optional. A page token, received from a previous `ListServingConfigs` call. 197 // Provide this to retrieve the subsequent page. 198 string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; 199} 200 201// Response for ListServingConfigs method. 202message ListServingConfigsResponse { 203 // All the ServingConfigs for a given catalog. 204 repeated ServingConfig serving_configs = 1; 205 206 // Pagination token, if not returned indicates the last page. 207 string next_page_token = 2; 208} 209 210// Request for AddControl method. 211message AddControlRequest { 212 // Required. The source ServingConfig resource name . Format: 213 // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` 214 string serving_config = 1 [ 215 (google.api.field_behavior) = REQUIRED, 216 (google.api.resource_reference) = { 217 type: "retail.googleapis.com/ServingConfig" 218 } 219 ]; 220 221 // Required. The id of the control to apply. Assumed to be in the same catalog 222 // as the serving config - if id is not found a NOT_FOUND error is returned. 223 string control_id = 2 [(google.api.field_behavior) = REQUIRED]; 224} 225 226// Request for RemoveControl method. 227message RemoveControlRequest { 228 // Required. The source ServingConfig resource name . Format: 229 // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/servingConfigs/{serving_config_id}` 230 string serving_config = 1 [ 231 (google.api.field_behavior) = REQUIRED, 232 (google.api.resource_reference) = { 233 type: "retail.googleapis.com/ServingConfig" 234 } 235 ]; 236 237 // Required. The id of the control to apply. Assumed to be in the same catalog 238 // as the serving config. 239 string control_id = 2 [(google.api.field_behavior) = REQUIRED]; 240} 241