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