sourcerepo.proto 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. // Copyright 2017 Google Inc.
  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.devtools.sourcerepo.v1;
  16. import "google/api/annotations.proto";
  17. import "google/iam/v1/iam_policy.proto";
  18. import "google/iam/v1/policy.proto";
  19. import "google/protobuf/empty.proto";
  20. option go_package = "google.golang.org/genproto/googleapis/devtools/sourcerepo/v1;sourcerepo";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "SourceRepoProto";
  23. option java_package = "com.google.devtools.sourcerepo.v1";
  24. // The Source Repo API service.
  25. service SourceRepo {
  26. // Returns all repos belonging to a project. The sizes of the repos are
  27. // not set by ListRepos. To get the size of a repo, use GetRepo.
  28. rpc ListRepos(ListReposRequest) returns (ListReposResponse) {
  29. option (google.api.http) = {
  30. get: "/v1/{name=projects/*}/repos"
  31. };
  32. }
  33. // Returns information about a repo.
  34. rpc GetRepo(GetRepoRequest) returns (Repo) {
  35. option (google.api.http) = {
  36. get: "/v1/{name=projects/*/repos/**}"
  37. };
  38. }
  39. // Creates a repo in the given project with the given name.
  40. //
  41. // If the named repository already exists, `CreateRepo` returns
  42. // `ALREADY_EXISTS`.
  43. rpc CreateRepo(CreateRepoRequest) returns (Repo) {
  44. option (google.api.http) = {
  45. post: "/v1/{parent=projects/*}/repos"
  46. body: "repo"
  47. };
  48. }
  49. // Deletes a repo.
  50. rpc DeleteRepo(DeleteRepoRequest) returns (google.protobuf.Empty) {
  51. option (google.api.http) = {
  52. delete: "/v1/{name=projects/*/repos/**}"
  53. };
  54. }
  55. // Sets the access control policy on the specified resource. Replaces any
  56. // existing policy.
  57. rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest)
  58. returns (google.iam.v1.Policy) {
  59. option (google.api.http) = {
  60. post: "/v1/{resource=projects/*/repos/**}:setIamPolicy"
  61. body: "*"
  62. };
  63. }
  64. // Gets the access control policy for a resource.
  65. // Returns an empty policy if the resource exists and does not have a policy
  66. // set.
  67. rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest)
  68. returns (google.iam.v1.Policy) {
  69. option (google.api.http) = {
  70. get: "/v1/{resource=projects/*/repos/**}:getIamPolicy"
  71. };
  72. }
  73. // Returns permissions that a caller has on the specified resource.
  74. // If the resource does not exist, this will return an empty set of
  75. // permissions, not a NOT_FOUND error.
  76. rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest)
  77. returns (google.iam.v1.TestIamPermissionsResponse) {
  78. option (google.api.http) = {
  79. post: "/v1/{resource=projects/*/repos/**}:testIamPermissions"
  80. body: "*"
  81. };
  82. }
  83. }
  84. // A repository (or repo) is a Git repository storing versioned source content.
  85. message Repo {
  86. // Resource name of the repository, of the form
  87. // `projects/<project>/repos/<repo>`. The repo name may contain slashes.
  88. // eg, `projects/myproject/repos/name/with/slash`
  89. string name = 1;
  90. // The disk usage of the repo, in bytes. Read-only field. Size is only
  91. // returned by GetRepo.
  92. int64 size = 2;
  93. // URL to clone the repository from Google Cloud Source Repositories.
  94. // Read-only field.
  95. string url = 3;
  96. // How this repository mirrors a repository managed by another service.
  97. // Read-only field.
  98. MirrorConfig mirror_config = 4;
  99. }
  100. // Configuration to automatically mirror a repository from another
  101. // hosting service, for example GitHub or BitBucket.
  102. message MirrorConfig {
  103. // URL of the main repository at the other hosting service.
  104. string url = 1;
  105. // ID of the webhook listening to updates to trigger mirroring.
  106. // Removing this webhook from the other hosting service will stop
  107. // Google Cloud Source Repositories from receiving notifications,
  108. // and thereby disabling mirroring.
  109. string webhook_id = 2;
  110. // ID of the SSH deploy key at the other hosting service.
  111. // Removing this key from the other service would deauthorize
  112. // Google Cloud Source Repositories from mirroring.
  113. string deploy_key_id = 3;
  114. }
  115. // Request for GetRepo.
  116. message GetRepoRequest {
  117. // The name of the requested repository. Values are of the form
  118. // `projects/<project>/repos/<repo>`.
  119. string name = 1;
  120. }
  121. // Request for ListRepos.
  122. message ListReposRequest {
  123. // The project ID whose repos should be listed. Values are of the form
  124. // `projects/<project>`.
  125. string name = 1;
  126. // Maximum number of repositories to return; between 1 and 500.
  127. // If not set or zero, defaults to 100 at the server.
  128. int32 page_size = 2;
  129. // Resume listing repositories where a prior ListReposResponse
  130. // left off. This is an opaque token that must be obtained from
  131. // a recent, prior ListReposResponse's next_page_token field.
  132. string page_token = 3;
  133. }
  134. // Response for ListRepos. The size is not set in the returned repositories.
  135. message ListReposResponse {
  136. // The listed repos.
  137. repeated Repo repos = 1;
  138. // If non-empty, additional repositories exist within the project. These
  139. // can be retrieved by including this value in the next ListReposRequest's
  140. // page_token field.
  141. string next_page_token = 2;
  142. }
  143. // Request for CreateRepo
  144. message CreateRepoRequest {
  145. // The project in which to create the repo. Values are of the form
  146. // `projects/<project>`.
  147. string parent = 1;
  148. // The repo to create. Only name should be set; setting other fields
  149. // is an error. The project in the name should match the parent field.
  150. Repo repo = 2;
  151. }
  152. // Request for DeleteRepo.
  153. message DeleteRepoRequest {
  154. // The name of the repo to delete. Values are of the form
  155. // `projects/<project>/repos/<repo>`.
  156. string name = 1;
  157. }