source_context.proto 5.1 KB

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