source_context.proto 5.3 KB

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