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