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