serving_config_service.proto 9.1 KB

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