serving_config_service.proto 9.1 KB

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