source_context.proto 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. // Copyright 2019 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. //
  15. syntax = "proto3";
  16. package google.devtools.source.v1;
  17. import "google/api/annotations.proto";
  18. option cc_enable_arenas = true;
  19. option csharp_namespace = "Google.Cloud.DevTools.Source.V1";
  20. option go_package = "google.golang.org/genproto/googleapis/devtools/source/v1;source";
  21. option java_multiple_files = true;
  22. option java_outer_classname = "SourceContextProto";
  23. option java_package = "com.google.devtools.source.v1";
  24. option php_namespace = "Google\\Cloud\\DevTools\\Source\\V1";
  25. // A SourceContext is a reference to a tree of files. A SourceContext together
  26. // with a path point to a unique revision of a single file or directory.
  27. message SourceContext {
  28. // A SourceContext can refer any one of the following types of repositories.
  29. oneof context {
  30. // A SourceContext referring to a revision in a cloud repo.
  31. CloudRepoSourceContext cloud_repo = 1;
  32. // A SourceContext referring to a snapshot in a cloud workspace.
  33. CloudWorkspaceSourceContext cloud_workspace = 2;
  34. // A SourceContext referring to a Gerrit project.
  35. GerritSourceContext gerrit = 3;
  36. // A SourceContext referring to any third party Git repo (e.g. GitHub).
  37. GitSourceContext git = 6;
  38. }
  39. }
  40. // An ExtendedSourceContext is a SourceContext combined with additional
  41. // details describing the context.
  42. message ExtendedSourceContext {
  43. // Any source context.
  44. SourceContext context = 1;
  45. // Labels with user defined metadata.
  46. map<string, string> labels = 2;
  47. }
  48. // An alias to a repo revision.
  49. message AliasContext {
  50. // The type of an Alias.
  51. enum Kind {
  52. // Do not use.
  53. ANY = 0;
  54. // Git tag
  55. FIXED = 1;
  56. // Git branch
  57. MOVABLE = 2;
  58. // OTHER is used to specify non-standard aliases, those not of the kinds
  59. // above. For example, if a Git repo has a ref named "refs/foo/bar", it
  60. // is considered to be of kind OTHER.
  61. OTHER = 4;
  62. }
  63. // The alias kind.
  64. Kind kind = 1;
  65. // The alias name.
  66. string name = 2;
  67. }
  68. // A CloudRepoSourceContext denotes a particular revision in a cloud
  69. // repo (a repo hosted by the Google Cloud Platform).
  70. message CloudRepoSourceContext {
  71. // The ID of the repo.
  72. RepoId repo_id = 1;
  73. // A revision in a cloud repository can be identified by either its revision
  74. // ID or its Alias.
  75. oneof revision {
  76. // A revision ID.
  77. string revision_id = 2;
  78. // The name of an alias (branch, tag, etc.).
  79. string alias_name = 3 [deprecated = true];
  80. // An alias, which may be a branch or tag.
  81. AliasContext alias_context = 4;
  82. }
  83. }
  84. // A CloudWorkspaceSourceContext denotes a workspace at a particular snapshot.
  85. message CloudWorkspaceSourceContext {
  86. // The ID of the workspace.
  87. CloudWorkspaceId workspace_id = 1;
  88. // The ID of the snapshot.
  89. // An empty snapshot_id refers to the most recent snapshot.
  90. string snapshot_id = 2;
  91. }
  92. // A SourceContext referring to a Gerrit project.
  93. message GerritSourceContext {
  94. // The URI of a running Gerrit instance.
  95. string host_uri = 1;
  96. // The full project name within the host. Projects may be nested, so
  97. // "project/subproject" is a valid project name.
  98. // The "repo name" is hostURI/project.
  99. string gerrit_project = 2;
  100. // A revision in a Gerrit project can be identified by either its revision ID
  101. // or its alias.
  102. oneof revision {
  103. // A revision (commit) ID.
  104. string revision_id = 3;
  105. // The name of an alias (branch, tag, etc.).
  106. string alias_name = 4 [deprecated = true];
  107. // An alias, which may be a branch or tag.
  108. AliasContext alias_context = 5;
  109. }
  110. }
  111. // A GitSourceContext denotes a particular revision in a third party Git
  112. // repository (e.g. GitHub).
  113. message GitSourceContext {
  114. // Git repository URL.
  115. string url = 1;
  116. // Git commit hash.
  117. // required.
  118. string revision_id = 2;
  119. }
  120. // A unique identifier for a cloud repo.
  121. message RepoId {
  122. // A cloud repository can be identified by either its project ID and
  123. // repository name combination, or its globally unique identifier.
  124. oneof id {
  125. // A combination of a project ID and a repo name.
  126. ProjectRepoId project_repo_id = 1;
  127. // A server-assigned, globally unique identifier.
  128. string uid = 2;
  129. }
  130. }
  131. // Selects a repo using a Google Cloud Platform project ID
  132. // (e.g. winged-cargo-31) and a repo name within that project.
  133. message ProjectRepoId {
  134. // The ID of the project.
  135. string project_id = 1;
  136. // The name of the repo. Leave empty for the default repo.
  137. string repo_name = 2;
  138. }
  139. // A CloudWorkspaceId is a unique identifier for a cloud workspace.
  140. // A cloud workspace is a place associated with a repo where modified files
  141. // can be stored before they are committed.
  142. message CloudWorkspaceId {
  143. // The ID of the repo containing the workspace.
  144. RepoId repo_id = 1;
  145. // The unique name of the workspace within the repo. This is the name
  146. // chosen by the client in the Source API's CreateWorkspace method.
  147. string name = 2;
  148. }