folders.proto 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  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.resourcemanager.v3;
  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/iam/v1/iam_policy.proto";
  21. import "google/iam/v1/policy.proto";
  22. import "google/longrunning/operations.proto";
  23. import "google/protobuf/field_mask.proto";
  24. import "google/protobuf/timestamp.proto";
  25. option csharp_namespace = "Google.Cloud.ResourceManager.V3";
  26. option go_package = "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3;resourcemanager";
  27. option java_multiple_files = true;
  28. option java_outer_classname = "FoldersProto";
  29. option java_package = "com.google.cloud.resourcemanager.v3";
  30. option php_namespace = "Google\\Cloud\\ResourceManager\\V3";
  31. option ruby_package = "Google::Cloud::ResourceManager::V3";
  32. // Manages Cloud Platform folder resources.
  33. // Folders can be used to organize the resources under an
  34. // organization and to control the policies applied to groups of resources.
  35. service Folders {
  36. option (google.api.default_host) = "cloudresourcemanager.googleapis.com";
  37. option (google.api.oauth_scopes) =
  38. "https://www.googleapis.com/auth/cloud-platform,"
  39. "https://www.googleapis.com/auth/cloud-platform.read-only";
  40. // Retrieves a folder identified by the supplied resource name.
  41. // Valid folder resource names have the format `folders/{folder_id}`
  42. // (for example, `folders/1234`).
  43. // The caller must have `resourcemanager.folders.get` permission on the
  44. // identified folder.
  45. rpc GetFolder(GetFolderRequest) returns (Folder) {
  46. option (google.api.http) = {
  47. get: "/v3/{name=folders/*}"
  48. };
  49. option (google.api.method_signature) = "name";
  50. }
  51. // Lists the folders that are direct descendants of supplied parent resource.
  52. // `list()` provides a strongly consistent view of the folders underneath
  53. // the specified parent resource.
  54. // `list()` returns folders sorted based upon the (ascending) lexical ordering
  55. // of their display_name.
  56. // The caller must have `resourcemanager.folders.list` permission on the
  57. // identified parent.
  58. rpc ListFolders(ListFoldersRequest) returns (ListFoldersResponse) {
  59. option (google.api.http) = {
  60. get: "/v3/folders"
  61. };
  62. option (google.api.method_signature) = "parent";
  63. }
  64. // Search for folders that match specific filter criteria.
  65. // `search()` provides an eventually consistent view of the folders a user has
  66. // access to which meet the specified filter criteria.
  67. //
  68. // This will only return folders on which the caller has the
  69. // permission `resourcemanager.folders.get`.
  70. rpc SearchFolders(SearchFoldersRequest) returns (SearchFoldersResponse) {
  71. option (google.api.http) = {
  72. get: "/v3/folders:search"
  73. };
  74. option (google.api.method_signature) = "query";
  75. }
  76. // Creates a folder in the resource hierarchy.
  77. // Returns an `Operation` which can be used to track the progress of the
  78. // folder creation workflow.
  79. // Upon success, the `Operation.response` field will be populated with the
  80. // created Folder.
  81. //
  82. // In order to succeed, the addition of this new folder must not violate
  83. // the folder naming, height, or fanout constraints.
  84. //
  85. // + The folder's `display_name` must be distinct from all other folders that
  86. // share its parent.
  87. // + The addition of the folder must not cause the active folder hierarchy
  88. // to exceed a height of 10. Note, the full active + deleted folder hierarchy
  89. // is allowed to reach a height of 20; this provides additional headroom when
  90. // moving folders that contain deleted folders.
  91. // + The addition of the folder must not cause the total number of folders
  92. // under its parent to exceed 300.
  93. //
  94. // If the operation fails due to a folder constraint violation, some errors
  95. // may be returned by the `CreateFolder` request, with status code
  96. // `FAILED_PRECONDITION` and an error description. Other folder constraint
  97. // violations will be communicated in the `Operation`, with the specific
  98. // `PreconditionFailure` returned in the details list in the `Operation.error`
  99. // field.
  100. //
  101. // The caller must have `resourcemanager.folders.create` permission on the
  102. // identified parent.
  103. rpc CreateFolder(CreateFolderRequest) returns (google.longrunning.Operation) {
  104. option (google.api.http) = {
  105. post: "/v3/folders"
  106. body: "folder"
  107. };
  108. option (google.api.method_signature) = "folder";
  109. option (google.longrunning.operation_info) = {
  110. response_type: "Folder"
  111. metadata_type: "CreateFolderMetadata"
  112. };
  113. }
  114. // Updates a folder, changing its `display_name`.
  115. // Changes to the folder `display_name` will be rejected if they violate
  116. // either the `display_name` formatting rules or the naming constraints
  117. // described in the [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder] documentation.
  118. //
  119. // The folder's `display_name` must start and end with a letter or digit,
  120. // may contain letters, digits, spaces, hyphens and underscores and can be
  121. // between 3 and 30 characters. This is captured by the regular expression:
  122. // `[\p{L}\p{N}][\p{L}\p{N}_- ]{1,28}[\p{L}\p{N}]`.
  123. // The caller must have `resourcemanager.folders.update` permission on the
  124. // identified folder.
  125. //
  126. // If the update fails due to the unique name constraint then a
  127. // `PreconditionFailure` explaining this violation will be returned
  128. // in the Status.details field.
  129. rpc UpdateFolder(UpdateFolderRequest) returns (google.longrunning.Operation) {
  130. option (google.api.http) = {
  131. patch: "/v3/{folder.name=folders/*}"
  132. body: "folder"
  133. };
  134. option (google.api.method_signature) = "folder,update_mask";
  135. option (google.longrunning.operation_info) = {
  136. response_type: "Folder"
  137. metadata_type: "UpdateFolderMetadata"
  138. };
  139. }
  140. // Moves a folder under a new resource parent.
  141. // Returns an `Operation` which can be used to track the progress of the
  142. // folder move workflow.
  143. // Upon success, the `Operation.response` field will be populated with the
  144. // moved folder.
  145. // Upon failure, a `FolderOperationError` categorizing the failure cause will
  146. // be returned - if the failure occurs synchronously then the
  147. // `FolderOperationError` will be returned in the `Status.details` field.
  148. // If it occurs asynchronously, then the FolderOperation will be returned
  149. // in the `Operation.error` field.
  150. // In addition, the `Operation.metadata` field will be populated with a
  151. // `FolderOperation` message as an aid to stateless clients.
  152. // Folder moves will be rejected if they violate either the naming, height,
  153. // or fanout constraints described in the
  154. // [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder] documentation.
  155. // The caller must have `resourcemanager.folders.move` permission on the
  156. // folder's current and proposed new parent.
  157. rpc MoveFolder(MoveFolderRequest) returns (google.longrunning.Operation) {
  158. option (google.api.http) = {
  159. post: "/v3/{name=folders/*}:move"
  160. body: "*"
  161. };
  162. option (google.api.method_signature) = "name,destination_parent";
  163. option (google.longrunning.operation_info) = {
  164. response_type: "Folder"
  165. metadata_type: "MoveFolderMetadata"
  166. };
  167. }
  168. // Requests deletion of a folder. The folder is moved into the
  169. // [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED] state
  170. // immediately, and is deleted approximately 30 days later. This method may
  171. // only be called on an empty folder, where a folder is empty if it doesn't
  172. // contain any folders or projects in the [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state.
  173. // If called on a folder in [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED]
  174. // state the operation will result in a no-op success.
  175. // The caller must have `resourcemanager.folders.delete` permission on the
  176. // identified folder.
  177. rpc DeleteFolder(DeleteFolderRequest) returns (google.longrunning.Operation) {
  178. option (google.api.http) = {
  179. delete: "/v3/{name=folders/*}"
  180. };
  181. option (google.api.method_signature) = "name";
  182. option (google.longrunning.operation_info) = {
  183. response_type: "Folder"
  184. metadata_type: "DeleteFolderMetadata"
  185. };
  186. }
  187. // Cancels the deletion request for a folder. This method may be called on a
  188. // folder in any state. If the folder is in the [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE]
  189. // state the result will be a no-op success. In order to succeed, the folder's
  190. // parent must be in the [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE] state. In addition,
  191. // reintroducing the folder into the tree must not violate folder naming,
  192. // height, and fanout constraints described in the
  193. // [CreateFolder][google.cloud.resourcemanager.v3.Folders.CreateFolder] documentation.
  194. // The caller must have `resourcemanager.folders.undelete` permission on the
  195. // identified folder.
  196. rpc UndeleteFolder(UndeleteFolderRequest) returns (google.longrunning.Operation) {
  197. option (google.api.http) = {
  198. post: "/v3/{name=folders/*}:undelete"
  199. body: "*"
  200. };
  201. option (google.api.method_signature) = "name";
  202. option (google.longrunning.operation_info) = {
  203. response_type: "Folder"
  204. metadata_type: "UndeleteFolderMetadata"
  205. };
  206. }
  207. // Gets the access control policy for a folder. The returned policy may be
  208. // empty if no such policy or resource exists. The `resource` field should
  209. // be the folder's resource name, for example: "folders/1234".
  210. // The caller must have `resourcemanager.folders.getIamPolicy` permission
  211. // on the identified folder.
  212. rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
  213. option (google.api.http) = {
  214. post: "/v3/{resource=folders/*}:getIamPolicy"
  215. body: "*"
  216. };
  217. option (google.api.method_signature) = "resource";
  218. }
  219. // Sets the access control policy on a folder, replacing any existing policy.
  220. // The `resource` field should be the folder's resource name, for example:
  221. // "folders/1234".
  222. // The caller must have `resourcemanager.folders.setIamPolicy` permission
  223. // on the identified folder.
  224. rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) {
  225. option (google.api.http) = {
  226. post: "/v3/{resource=folders/*}:setIamPolicy"
  227. body: "*"
  228. };
  229. option (google.api.method_signature) = "resource,policy";
  230. }
  231. // Returns permissions that a caller has on the specified folder.
  232. // The `resource` field should be the folder's resource name,
  233. // for example: "folders/1234".
  234. //
  235. // There are no permissions required for making this API call.
  236. rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) {
  237. option (google.api.http) = {
  238. post: "/v3/{resource=folders/*}:testIamPermissions"
  239. body: "*"
  240. };
  241. option (google.api.method_signature) = "resource,permissions";
  242. }
  243. }
  244. // A folder in an organization's resource hierarchy, used to
  245. // organize that organization's resources.
  246. message Folder {
  247. option (google.api.resource) = {
  248. type: "cloudresourcemanager.googleapis.com/Folder"
  249. pattern: "folders/{folder}"
  250. style: DECLARATIVE_FRIENDLY
  251. };
  252. // Folder lifecycle states.
  253. enum State {
  254. // Unspecified state.
  255. STATE_UNSPECIFIED = 0;
  256. // The normal and active state.
  257. ACTIVE = 1;
  258. // The folder has been marked for deletion by the user.
  259. DELETE_REQUESTED = 2;
  260. }
  261. // Output only. The resource name of the folder.
  262. // Its format is `folders/{folder_id}`, for example: "folders/1234".
  263. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
  264. // Required. The folder's parent's resource name.
  265. // Updates to the folder's parent must be performed using
  266. // [MoveFolder][google.cloud.resourcemanager.v3.Folders.MoveFolder].
  267. string parent = 2 [(google.api.field_behavior) = REQUIRED];
  268. // The folder's display name.
  269. // A folder's display name must be unique amongst its siblings. For example,
  270. // no two folders with the same parent can share the same display name.
  271. // The display name must start and end with a letter or digit, may contain
  272. // letters, digits, spaces, hyphens and underscores and can be no longer
  273. // than 30 characters. This is captured by the regular expression:
  274. // `[\p{L}\p{N}]([\p{L}\p{N}_- ]{0,28}[\p{L}\p{N}])?`.
  275. string display_name = 3;
  276. // Output only. The lifecycle state of the folder.
  277. // Updates to the state must be performed using
  278. // [DeleteFolder][google.cloud.resourcemanager.v3.Folders.DeleteFolder] and
  279. // [UndeleteFolder][google.cloud.resourcemanager.v3.Folders.UndeleteFolder].
  280. State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY];
  281. // Output only. Timestamp when the folder was created.
  282. google.protobuf.Timestamp create_time = 5 [(google.api.field_behavior) = OUTPUT_ONLY];
  283. // Output only. Timestamp when the folder was last modified.
  284. google.protobuf.Timestamp update_time = 6 [(google.api.field_behavior) = OUTPUT_ONLY];
  285. // Output only. Timestamp when the folder was requested to be deleted.
  286. google.protobuf.Timestamp delete_time = 7 [(google.api.field_behavior) = OUTPUT_ONLY];
  287. // Output only. A checksum computed by the server based on the current value of the folder
  288. // resource. This may be sent on update and delete requests to ensure the
  289. // client has an up-to-date value before proceeding.
  290. string etag = 8 [(google.api.field_behavior) = OUTPUT_ONLY];
  291. }
  292. // The GetFolder request message.
  293. message GetFolderRequest {
  294. // Required. The resource name of the folder to retrieve.
  295. // Must be of the form `folders/{folder_id}`.
  296. string name = 1 [
  297. (google.api.field_behavior) = REQUIRED,
  298. (google.api.resource_reference) = {
  299. type: "cloudresourcemanager.googleapis.com/Folder"
  300. }
  301. ];
  302. }
  303. // The ListFolders request message.
  304. message ListFoldersRequest {
  305. // Required. The resource name of the organization or folder whose folders are
  306. // being listed.
  307. // Must be of the form `folders/{folder_id}` or `organizations/{org_id}`.
  308. // Access to this method is controlled by checking the
  309. // `resourcemanager.folders.list` permission on the `parent`.
  310. string parent = 1 [
  311. (google.api.field_behavior) = REQUIRED,
  312. (google.api.resource_reference) = {
  313. child_type: "*"
  314. }
  315. ];
  316. // Optional. The maximum number of folders to return in the response.
  317. // If unspecified, server picks an appropriate default.
  318. int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL];
  319. // Optional. A pagination token returned from a previous call to `ListFolders`
  320. // that indicates where this listing should continue from.
  321. string page_token = 3 [(google.api.field_behavior) = OPTIONAL];
  322. // Optional. Controls whether folders in the
  323. // [DELETE_REQUESTED][google.cloud.resourcemanager.v3.Folder.State.DELETE_REQUESTED]
  324. // state should be returned. Defaults to false.
  325. bool show_deleted = 4 [(google.api.field_behavior) = OPTIONAL];
  326. }
  327. // The ListFolders response message.
  328. message ListFoldersResponse {
  329. // A possibly paginated list of folders that are direct descendants of
  330. // the specified parent resource.
  331. repeated Folder folders = 1;
  332. // A pagination token returned from a previous call to `ListFolders`
  333. // that indicates from where listing should continue.
  334. string next_page_token = 2;
  335. }
  336. // The request message for searching folders.
  337. message SearchFoldersRequest {
  338. // Optional. The maximum number of folders to return in the response.
  339. // If unspecified, server picks an appropriate default.
  340. int32 page_size = 1 [(google.api.field_behavior) = OPTIONAL];
  341. // Optional. A pagination token returned from a previous call to `SearchFolders`
  342. // that indicates from where search should continue.
  343. string page_token = 2 [(google.api.field_behavior) = OPTIONAL];
  344. // Optional. Search criteria used to select the folders to return.
  345. // If no search criteria is specified then all accessible folders will be
  346. // returned.
  347. //
  348. // Query expressions can be used to restrict results based upon displayName,
  349. // state and parent, where the operators `=` (`:`) `NOT`, `AND` and `OR`
  350. // can be used along with the suffix wildcard symbol `*`.
  351. //
  352. // The `displayName` field in a query expression should use escaped quotes
  353. // for values that include whitespace to prevent unexpected behavior.
  354. //
  355. // ```
  356. // | Field | Description |
  357. // |-------------------------|----------------------------------------|
  358. // | displayName | Filters by displayName. |
  359. // | parent | Filters by parent (for example: folders/123). |
  360. // | state, lifecycleState | Filters by state. |
  361. // ```
  362. //
  363. // Some example queries are:
  364. //
  365. // * Query `displayName=Test*` returns Folder resources whose display name
  366. // starts with "Test".
  367. // * Query `state=ACTIVE` returns Folder resources with
  368. // `state` set to `ACTIVE`.
  369. // * Query `parent=folders/123` returns Folder resources that have
  370. // `folders/123` as a parent resource.
  371. // * Query `parent=folders/123 AND state=ACTIVE` returns active
  372. // Folder resources that have `folders/123` as a parent resource.
  373. // * Query `displayName=\\"Test String\\"` returns Folder resources with
  374. // display names that include both "Test" and "String".
  375. string query = 3 [(google.api.field_behavior) = OPTIONAL];
  376. }
  377. // The response message for searching folders.
  378. message SearchFoldersResponse {
  379. // A possibly paginated folder search results.
  380. // the specified parent resource.
  381. repeated Folder folders = 1;
  382. // A pagination token returned from a previous call to `SearchFolders`
  383. // that indicates from where searching should continue.
  384. string next_page_token = 2;
  385. }
  386. // The CreateFolder request message.
  387. message CreateFolderRequest {
  388. // Required. The folder being created, only the display name and parent will be
  389. // consulted. All other fields will be ignored.
  390. Folder folder = 2 [(google.api.field_behavior) = REQUIRED];
  391. }
  392. // Metadata pertaining to the Folder creation process.
  393. message CreateFolderMetadata {
  394. // The display name of the folder.
  395. string display_name = 1;
  396. // The resource name of the folder or organization we are creating the folder
  397. // under.
  398. string parent = 2;
  399. }
  400. // The request sent to the
  401. // [UpdateFolder][google.cloud.resourcemanager.v3.Folder.UpdateFolder]
  402. // method.
  403. //
  404. // Only the `display_name` field can be changed. All other fields will be
  405. // ignored. Use the
  406. // [MoveFolder][google.cloud.resourcemanager.v3.Folders.MoveFolder] method to
  407. // change the `parent` field.
  408. message UpdateFolderRequest {
  409. // Required. The new definition of the Folder. It must include the `name` field, which
  410. // cannot be changed.
  411. Folder folder = 1 [(google.api.field_behavior) = REQUIRED];
  412. // Required. Fields to be updated.
  413. // Only the `display_name` can be updated.
  414. google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED];
  415. }
  416. // A status object which is used as the `metadata` field for the Operation
  417. // returned by UpdateFolder.
  418. message UpdateFolderMetadata {
  419. }
  420. // The MoveFolder request message.
  421. message MoveFolderRequest {
  422. // Required. The resource name of the Folder to move.
  423. // Must be of the form folders/{folder_id}
  424. string name = 1 [
  425. (google.api.field_behavior) = REQUIRED,
  426. (google.api.resource_reference) = {
  427. type: "cloudresourcemanager.googleapis.com/Folder"
  428. }
  429. ];
  430. // Required. The resource name of the folder or organization which should be the
  431. // folder's new parent.
  432. // Must be of the form `folders/{folder_id}` or `organizations/{org_id}`.
  433. string destination_parent = 2 [
  434. (google.api.field_behavior) = REQUIRED,
  435. (google.api.resource_reference) = {
  436. child_type: "*"
  437. }
  438. ];
  439. }
  440. // Metadata pertaining to the folder move process.
  441. message MoveFolderMetadata {
  442. // The display name of the folder.
  443. string display_name = 1;
  444. // The resource name of the folder's parent.
  445. string source_parent = 2;
  446. // The resource name of the folder or organization to move the folder to.
  447. string destination_parent = 3;
  448. }
  449. // The DeleteFolder request message.
  450. message DeleteFolderRequest {
  451. // Required. The resource name of the folder to be deleted.
  452. // Must be of the form `folders/{folder_id}`.
  453. string name = 1 [
  454. (google.api.field_behavior) = REQUIRED,
  455. (google.api.resource_reference) = {
  456. type: "cloudresourcemanager.googleapis.com/Folder"
  457. }
  458. ];
  459. }
  460. // A status object which is used as the `metadata` field for the `Operation`
  461. // returned by `DeleteFolder`.
  462. message DeleteFolderMetadata {
  463. }
  464. // The UndeleteFolder request message.
  465. message UndeleteFolderRequest {
  466. // Required. The resource name of the folder to undelete.
  467. // Must be of the form `folders/{folder_id}`.
  468. string name = 1 [
  469. (google.api.field_behavior) = REQUIRED,
  470. (google.api.resource_reference) = {
  471. type: "cloudresourcemanager.googleapis.com/Folder"
  472. }
  473. ];
  474. }
  475. // A status object which is used as the `metadata` field for the `Operation`
  476. // returned by `UndeleteFolder`.
  477. message UndeleteFolderMetadata {
  478. }