control_service.proto 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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.v2;
  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/v2/control.proto";
  21. import "google/protobuf/empty.proto";
  22. import "google/protobuf/field_mask.proto";
  23. option csharp_namespace = "Google.Cloud.Retail.V2";
  24. option go_package = "google.golang.org/genproto/googleapis/cloud/retail/v2;retail";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "ControlServiceProto";
  27. option java_package = "com.google.cloud.retail.v2";
  28. option objc_class_prefix = "RETAIL";
  29. option php_namespace = "Google\\Cloud\\Retail\\V2";
  30. option ruby_package = "Google::Cloud::Retail::V2";
  31. // Service for modifying Control.
  32. service ControlService {
  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 Control.
  37. //
  38. // If the [Control][google.cloud.retail.v2.Control] to create already exists,
  39. // an ALREADY_EXISTS error is returned.
  40. rpc CreateControl(CreateControlRequest) returns (Control) {
  41. option (google.api.http) = {
  42. post: "/v2/{parent=projects/*/locations/*/catalogs/*}/controls"
  43. body: "control"
  44. };
  45. option (google.api.method_signature) = "parent,control,control_id";
  46. }
  47. // Deletes a Control.
  48. //
  49. // If the [Control][google.cloud.retail.v2.Control] to delete does not exist,
  50. // a NOT_FOUND error is returned.
  51. rpc DeleteControl(DeleteControlRequest) returns (google.protobuf.Empty) {
  52. option (google.api.http) = {
  53. delete: "/v2/{name=projects/*/locations/*/catalogs/*/controls/*}"
  54. };
  55. option (google.api.method_signature) = "name";
  56. }
  57. // Updates a Control.
  58. //
  59. // [Control][google.cloud.retail.v2.Control] cannot be set to a different
  60. // oneof field, if so an INVALID_ARGUMENT is returned. If the
  61. // [Control][google.cloud.retail.v2.Control] to update does not exist, a
  62. // NOT_FOUND error is returned.
  63. rpc UpdateControl(UpdateControlRequest) returns (Control) {
  64. option (google.api.http) = {
  65. patch: "/v2/{control.name=projects/*/locations/*/catalogs/*/controls/*}"
  66. body: "control"
  67. };
  68. option (google.api.method_signature) = "control,update_mask";
  69. }
  70. // Gets a Control.
  71. rpc GetControl(GetControlRequest) returns (Control) {
  72. option (google.api.http) = {
  73. get: "/v2/{name=projects/*/locations/*/catalogs/*/controls/*}"
  74. };
  75. option (google.api.method_signature) = "name";
  76. }
  77. // Lists all Controls by their parent
  78. // [Catalog][google.cloud.retail.v2.Catalog].
  79. rpc ListControls(ListControlsRequest) returns (ListControlsResponse) {
  80. option (google.api.http) = {
  81. get: "/v2/{parent=projects/*/locations/*/catalogs/*}/controls"
  82. };
  83. option (google.api.method_signature) = "parent";
  84. }
  85. }
  86. // Request for CreateControl method.
  87. message CreateControlRequest {
  88. // Required. Full resource name of parent catalog. Format:
  89. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
  90. string parent = 1 [
  91. (google.api.field_behavior) = REQUIRED,
  92. (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" }
  93. ];
  94. // Required. The Control to create.
  95. Control control = 2 [(google.api.field_behavior) = REQUIRED];
  96. // Required. The ID to use for the Control, which will become the final
  97. // component of the Control's resource name.
  98. //
  99. // This value should be 4-63 characters, and valid characters
  100. // are /[a-z][0-9]-_/.
  101. string control_id = 3 [(google.api.field_behavior) = REQUIRED];
  102. }
  103. // Request for UpdateControl method.
  104. message UpdateControlRequest {
  105. // Required. The Control to update.
  106. Control control = 1 [(google.api.field_behavior) = REQUIRED];
  107. // Indicates which fields in the provided
  108. // [Control][google.cloud.retail.v2.Control] to update. The following are NOT
  109. // supported:
  110. //
  111. // * [Control.name][google.cloud.retail.v2.Control.name]
  112. //
  113. // If not set or empty, all supported fields are updated.
  114. google.protobuf.FieldMask update_mask = 2;
  115. }
  116. // Request for DeleteControl method.
  117. message DeleteControlRequest {
  118. // Required. The resource name of the Control to delete. Format:
  119. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
  120. string name = 1 [
  121. (google.api.field_behavior) = REQUIRED,
  122. (google.api.resource_reference) = { type: "retail.googleapis.com/Control" }
  123. ];
  124. }
  125. // Request for GetControl method.
  126. message GetControlRequest {
  127. // Required. The resource name of the Control to get. Format:
  128. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}/controls/{control_id}`
  129. string name = 1 [
  130. (google.api.field_behavior) = REQUIRED,
  131. (google.api.resource_reference) = { type: "retail.googleapis.com/Control" }
  132. ];
  133. }
  134. // Request for ListControls method.
  135. message ListControlsRequest {
  136. // Required. The catalog resource name. Format:
  137. // `projects/{project_number}/locations/{location_id}/catalogs/{catalog_id}`
  138. string parent = 1 [
  139. (google.api.field_behavior) = REQUIRED,
  140. (google.api.resource_reference) = { type: "retail.googleapis.com/Catalog" }
  141. ];
  142. // Optional. Maximum number of results to return. If unspecified, defaults
  143. // to 50. Max allowed value is 1000.
  144. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  145. // Optional. A page token, received from a previous `ListControls` call.
  146. // Provide this to retrieve the subsequent page.
  147. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  148. // Optional. A filter to apply on the list results. Supported features:
  149. //
  150. // * List all the products under the parent branch if
  151. // [filter][google.cloud.retail.v2.ListControlsRequest.filter] is unset.
  152. // * List controls that are used in a single ServingConfig:
  153. // 'serving_config = "boosted_home_page_cvr"'
  154. string filter = 4 [(google.api.field_behavior) = OPTIONAL];
  155. }
  156. // Response for ListControls method.
  157. message ListControlsResponse {
  158. // All the Controls for a given catalog.
  159. repeated Control controls = 1;
  160. // Pagination token, if not returned indicates the last page.
  161. string next_page_token = 2;
  162. }