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