label_service.proto 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. // Copyright 2022 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.apps.drive.labels.v2beta;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/apps/drive/labels/v2beta/label.proto";
  19. import "google/apps/drive/labels/v2beta/label_limits.proto";
  20. import "google/apps/drive/labels/v2beta/label_permission.proto";
  21. import "google/apps/drive/labels/v2beta/requests.proto";
  22. import "google/apps/drive/labels/v2beta/user_capabilities.proto";
  23. import "google/protobuf/empty.proto";
  24. option go_package = "google.golang.org/genproto/googleapis/apps/drive/labels/v2beta;labels";
  25. option java_multiple_files = true;
  26. option java_outer_classname = "LabelServiceProto";
  27. option java_package = "com.google.apps.drive.labels.v2beta";
  28. option objc_class_prefix = "DLBL";
  29. // Manage metadata taxonomies based on Labels and Fields that may be used within
  30. // Google Drive to organize and find files using custom metadata.
  31. service LabelService {
  32. option (google.api.default_host) = "drivelabels.googleapis.com";
  33. // Gets the user capabilities.
  34. rpc GetUserCapabilities(GetUserCapabilitiesRequest)
  35. returns (UserCapabilities) {
  36. option (google.api.http) = {
  37. get: "/v2beta/{name=users/*/capabilities}"
  38. };
  39. option (google.api.method_signature) = "name";
  40. }
  41. // List labels.
  42. rpc ListLabels(ListLabelsRequest) returns (ListLabelsResponse) {
  43. option (google.api.http) = {
  44. get: "/v2beta/labels"
  45. };
  46. }
  47. // Get a label by its resource name.
  48. // Resource name may be any of:
  49. //
  50. // * `labels/{id}` - See `labels/{id}@latest`
  51. // * `labels/{id}@latest` - Gets the latest revision of the label.
  52. // * `labels/{id}@published` - Gets the current published revision of the
  53. // label.
  54. // * `labels/{id}@{revision_id}` - Gets the label at the specified revision
  55. // ID.
  56. rpc GetLabel(GetLabelRequest) returns (Label) {
  57. option (google.api.http) = {
  58. get: "/v2beta/{name=labels/*}"
  59. };
  60. option (google.api.method_signature) = "name";
  61. }
  62. // Get the constraints on the structure of a Label; such as, the maximum
  63. // number of Fields allowed and maximum length of the label title.
  64. rpc GetLabelLimits(GetLabelLimitsRequest) returns (LabelLimits) {
  65. option (google.api.http) = {
  66. get: "/v2beta/limits/label"
  67. };
  68. }
  69. // Creates a new Label.
  70. rpc CreateLabel(CreateLabelRequest) returns (Label) {
  71. option (google.api.http) = {
  72. post: "/v2beta/labels"
  73. body: "label"
  74. };
  75. option (google.api.method_signature) = "label";
  76. }
  77. // Updates a single Label by applying a set of update requests resulting in a
  78. // new draft revision. The batch update is all-or-nothing: If any of the
  79. // update requests are invalid, no changes are applied. The resulting draft
  80. // revision must be published before the changes may be used with Drive Items.
  81. rpc DeltaUpdateLabel(DeltaUpdateLabelRequest)
  82. returns (DeltaUpdateLabelResponse) {
  83. option (google.api.http) = {
  84. post: "/v2beta/{name=labels/*}:delta"
  85. body: "*"
  86. };
  87. option (google.api.method_signature) = "name";
  88. }
  89. // Updates a Label's `CopyMode`. Changes to this policy are not revisioned, do
  90. // not require publishing, and take effect immediately.
  91. rpc UpdateLabelCopyMode(UpdateLabelCopyModeRequest) returns (Label) {
  92. option (google.api.http) = {
  93. post: "/v2beta/{name=labels/*}:updateLabelCopyMode"
  94. body: "*"
  95. };
  96. option (google.api.method_signature) = "name";
  97. }
  98. // Publish all draft changes to the Label. Once published, the Label may not
  99. // return to its draft state. See
  100. // `google.apps.drive.labels.v2.Lifecycle` for more information.
  101. //
  102. // Publishing a Label will result in a new published revision. All previous
  103. // draft revisions will be deleted. Previous published revisions will be kept
  104. // but are subject to automated deletion as needed.
  105. //
  106. // Once published, some changes are no longer permitted. Generally, any change
  107. // that would invalidate or cause new restrictions on existing metadata
  108. // related to the Label will be rejected. For example, the following changes
  109. // to a Label will be rejected after the Label is published:
  110. // * The label cannot be directly deleted. It must be disabled first, then
  111. // deleted.
  112. // * Field.FieldType cannot be changed.
  113. // * Changes to Field validation options cannot reject something that was
  114. // previously accepted.
  115. // * Reducing the max entries.
  116. rpc PublishLabel(PublishLabelRequest) returns (Label) {
  117. option (google.api.http) = {
  118. post: "/v2beta/{name=labels/*}:publish"
  119. body: "*"
  120. };
  121. option (google.api.method_signature) = "name";
  122. }
  123. // Disable a published Label.
  124. // Disabling a Label will result in a new disabled published revision based on
  125. // the current published revision. If there is a draft revision, a new
  126. // disabled draft revision will be created based on the latest draft revision.
  127. // Older draft revisions will be deleted.
  128. //
  129. // Once disabled, a label may be deleted with `DeleteLabel`.
  130. rpc DisableLabel(DisableLabelRequest) returns (Label) {
  131. option (google.api.http) = {
  132. post: "/v2beta/{name=labels/*}:disable"
  133. body: "*"
  134. };
  135. option (google.api.method_signature) = "name";
  136. }
  137. // Enable a disabled Label and restore it to its published state.
  138. // This will result in a new published revision based on the current disabled
  139. // published revision. If there is an existing disabled draft revision, a new
  140. // revision will be created based on that draft and will be enabled.
  141. rpc EnableLabel(EnableLabelRequest) returns (Label) {
  142. option (google.api.http) = {
  143. post: "/v2beta/{name=labels/*}:enable"
  144. body: "*"
  145. };
  146. option (google.api.method_signature) = "name";
  147. }
  148. // Permanently deletes a Label and related metadata on Drive Items.
  149. //
  150. // Once deleted, the Label and related Drive item metadata will be deleted.
  151. // Only draft Labels, and disabled Labels may be deleted.
  152. rpc DeleteLabel(DeleteLabelRequest) returns (google.protobuf.Empty) {
  153. option (google.api.http) = {
  154. delete: "/v2beta/{name=labels/*}"
  155. };
  156. option (google.api.method_signature) = "name";
  157. }
  158. // Lists a Label's permissions.
  159. rpc ListLabelPermissions(ListLabelPermissionsRequest)
  160. returns (ListLabelPermissionsResponse) {
  161. option (google.api.http) = {
  162. get: "/v2beta/{parent=labels/*}/permissions"
  163. additional_bindings {
  164. get: "/v2beta/{parent=labels/*/revisions/*}/permissions"
  165. }
  166. };
  167. option (google.api.method_signature) = "parent";
  168. }
  169. // Updates a Label's permissions. If a permission for the indicated principal
  170. // doesn't exist, a new Label Permission is created, otherwise the existing
  171. // permission is updated. Permissions affect the Label resource as a whole,
  172. // are not revisioned, and do not require publishing.
  173. rpc CreateLabelPermission(CreateLabelPermissionRequest)
  174. returns (LabelPermission) {
  175. option (google.api.http) = {
  176. post: "/v2beta/{parent=labels/*}/permissions"
  177. body: "label_permission"
  178. additional_bindings {
  179. post: "/v2beta/{parent=labels/*/revisions/*}/permissions"
  180. body: "label_permission"
  181. }
  182. };
  183. option (google.api.method_signature) = "parent,label_permission";
  184. }
  185. // Updates a Label's permissions. If a permission for the indicated principal
  186. // doesn't exist, a new Label Permission is created, otherwise the existing
  187. // permission is updated. Permissions affect the Label resource as a whole,
  188. // are not revisioned, and do not require publishing.
  189. rpc UpdateLabelPermission(UpdateLabelPermissionRequest)
  190. returns (LabelPermission) {
  191. option (google.api.http) = {
  192. patch: "/v2beta/{parent=labels/*}/permissions"
  193. body: "label_permission"
  194. additional_bindings {
  195. patch: "/v2beta/{parent=labels/*/revisions/*}/permissions"
  196. body: "label_permission"
  197. }
  198. };
  199. option (google.api.method_signature) = "parent";
  200. }
  201. // Deletes a Label's permission. Permissions affect the Label resource as a
  202. // whole, are not revisioned, and do not require publishing.
  203. rpc DeleteLabelPermission(DeleteLabelPermissionRequest)
  204. returns (google.protobuf.Empty) {
  205. option (google.api.http) = {
  206. delete: "/v2beta/{name=labels/*/permissions/*}"
  207. additional_bindings {
  208. delete: "/v2beta/{name=labels/*/revisions/*/permissions/*}"
  209. }
  210. };
  211. option (google.api.method_signature) = "name";
  212. }
  213. // Updates Label permissions. If a permission for the
  214. // indicated principal doesn't exist, a new Label Permission is created,
  215. // otherwise the existing permission is updated. Permissions affect the Label
  216. // resource as a whole, are not revisioned, and do not require publishing.
  217. rpc BatchUpdateLabelPermissions(BatchUpdateLabelPermissionsRequest)
  218. returns (BatchUpdateLabelPermissionsResponse) {
  219. option (google.api.http) = {
  220. post: "/v2beta/{parent=labels/*}/permissions:batchUpdate"
  221. body: "*"
  222. additional_bindings {
  223. post: "/v2beta/{parent=labels/*/revisions/*}/permissions:batchUpdate"
  224. body: "*"
  225. }
  226. };
  227. option (google.api.method_signature) = "parent";
  228. }
  229. // Deletes Label permissions. Permissions affect the Label resource as a
  230. // whole, are not revisioned, and do not require publishing.
  231. rpc BatchDeleteLabelPermissions(BatchDeleteLabelPermissionsRequest)
  232. returns (google.protobuf.Empty) {
  233. option (google.api.http) = {
  234. post: "/v2beta/{parent=labels/*}/permissions:batchDelete"
  235. body: "*"
  236. additional_bindings {
  237. post: "/v2beta/{parent=labels/*/revisions/*}/permissions:batchDelete"
  238. body: "*"
  239. }
  240. };
  241. option (google.api.method_signature) = "parent";
  242. }
  243. // Lists the LabelLocks on a Label.
  244. rpc ListLabelLocks(ListLabelLocksRequest) returns (ListLabelLocksResponse) {
  245. option (google.api.http) = {
  246. get: "/v2beta/{parent=labels/*}/locks"
  247. additional_bindings { get: "/v2beta/{parent=labels/*/revisions/*}/locks" }
  248. };
  249. option (google.api.method_signature) = "parent";
  250. }
  251. }