source.proto 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. // Copyright 2018 The Grafeas Authors. All rights reserved.
  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 grafeas.v1beta1.source;
  16. option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/source;source";
  17. option java_multiple_files = true;
  18. option java_package = "io.grafeas.v1beta1.source";
  19. option objc_class_prefix = "GRA";
  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 Google Cloud Source Repo.
  26. CloudRepoSourceContext cloud_repo = 1;
  27. // A SourceContext referring to a Gerrit project.
  28. GerritSourceContext gerrit = 2;
  29. // A SourceContext referring to any third party Git repo (e.g., GitHub).
  30. GitSourceContext git = 3;
  31. }
  32. // Labels with user defined metadata.
  33. map<string, string> labels = 4;
  34. }
  35. // An alias to a repo revision.
  36. message AliasContext {
  37. // The type of an alias.
  38. enum Kind {
  39. // Unknown.
  40. KIND_UNSPECIFIED = 0;
  41. // Git tag.
  42. FIXED = 1;
  43. // Git branch.
  44. MOVABLE = 2;
  45. // Used to specify non-standard aliases. For example, if a Git repo has a
  46. // ref named "refs/foo/bar".
  47. OTHER = 4;
  48. }
  49. // The alias kind.
  50. Kind kind = 1;
  51. // The alias name.
  52. string name = 2;
  53. }
  54. // A CloudRepoSourceContext denotes a particular revision in a Google Cloud
  55. // Source Repo.
  56. message CloudRepoSourceContext {
  57. // The ID of the repo.
  58. RepoId repo_id = 1;
  59. // A revision in a Cloud Repo can be identified by either its revision ID or
  60. // its alias.
  61. oneof revision {
  62. // A revision ID.
  63. string revision_id = 2;
  64. // An alias, which may be a branch or tag.
  65. AliasContext alias_context = 3;
  66. }
  67. }
  68. // A SourceContext referring to a Gerrit project.
  69. message GerritSourceContext {
  70. // The URI of a running Gerrit instance.
  71. string host_uri = 1;
  72. // The full project name within the host. Projects may be nested, so
  73. // "project/subproject" is a valid project name. The "repo name" is the
  74. // hostURI/project.
  75. string gerrit_project = 2;
  76. // A revision in a Gerrit project can be identified by either its revision ID
  77. // or its alias.
  78. oneof revision {
  79. // A revision (commit) ID.
  80. string revision_id = 3;
  81. // An alias, which may be a branch or tag.
  82. AliasContext alias_context = 4;
  83. }
  84. }
  85. // A GitSourceContext denotes a particular revision in a third party Git
  86. // repository (e.g., GitHub).
  87. message GitSourceContext {
  88. // Git repository URL.
  89. string url = 1;
  90. // Git commit hash.
  91. string revision_id = 2;
  92. }
  93. // A unique identifier for a Cloud Repo.
  94. message RepoId {
  95. // A cloud repo can be identified by either its project ID and repository name
  96. // combination, or its globally unique identifier.
  97. oneof id {
  98. // A combination of a project ID and a repo name.
  99. ProjectRepoId project_repo_id = 1;
  100. // A server-assigned, globally unique identifier.
  101. string uid = 2;
  102. }
  103. }
  104. // Selects a repo using a Google Cloud Platform project ID (e.g.,
  105. // winged-cargo-31) and a repo name within that project.
  106. message ProjectRepoId {
  107. // The ID of the project.
  108. string project_id = 1;
  109. // The name of the repo. Leave empty for the default repo.
  110. string repo_name = 2;
  111. }