grafeas.proto 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  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;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/devtools/containeranalysis/v1beta1/attestation/attestation.proto";
  19. import "google/devtools/containeranalysis/v1beta1/build/build.proto";
  20. import "google/devtools/containeranalysis/v1beta1/common/common.proto";
  21. import "google/devtools/containeranalysis/v1beta1/deployment/deployment.proto";
  22. import "google/devtools/containeranalysis/v1beta1/discovery/discovery.proto";
  23. import "google/devtools/containeranalysis/v1beta1/image/image.proto";
  24. import "google/devtools/containeranalysis/v1beta1/package/package.proto";
  25. import "google/devtools/containeranalysis/v1beta1/provenance/provenance.proto";
  26. import "google/devtools/containeranalysis/v1beta1/vulnerability/vulnerability.proto";
  27. import "google/protobuf/empty.proto";
  28. import "google/protobuf/field_mask.proto";
  29. import "google/protobuf/timestamp.proto";
  30. option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas;grafeas";
  31. option java_multiple_files = true;
  32. option java_package = "io.grafeas.v1beta1";
  33. option objc_class_prefix = "GRA";
  34. // [Grafeas](grafeas.io) API.
  35. //
  36. // Retrieves analysis results of Cloud components such as Docker container
  37. // images.
  38. //
  39. // Analysis results are stored as a series of occurrences. An `Occurrence`
  40. // contains information about a specific analysis instance on a resource. An
  41. // occurrence refers to a `Note`. A note contains details describing the
  42. // analysis and is generally stored in a separate project, called a `Provider`.
  43. // Multiple occurrences can refer to the same note.
  44. //
  45. // For example, an SSL vulnerability could affect multiple images. In this case,
  46. // there would be one note for the vulnerability and an occurrence for each
  47. // image with the vulnerability referring to that note.
  48. service GrafeasV1Beta1 {
  49. option (google.api.default_host) = "containeranalysis.googleapis.com";
  50. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  51. // Gets the specified occurrence.
  52. rpc GetOccurrence(GetOccurrenceRequest) returns (Occurrence) {
  53. option (google.api.http) = {
  54. get: "/v1beta1/{name=projects/*/occurrences/*}"
  55. };
  56. }
  57. // Lists occurrences for the specified project.
  58. rpc ListOccurrences(ListOccurrencesRequest)
  59. returns (ListOccurrencesResponse) {
  60. option (google.api.http) = {
  61. get: "/v1beta1/{parent=projects/*}/occurrences"
  62. };
  63. }
  64. // Deletes the specified occurrence. For example, use this method to delete an
  65. // occurrence when the occurrence is no longer applicable for the given
  66. // resource.
  67. rpc DeleteOccurrence(DeleteOccurrenceRequest)
  68. returns (google.protobuf.Empty) {
  69. option (google.api.http) = {
  70. delete: "/v1beta1/{name=projects/*/occurrences/*}"
  71. };
  72. }
  73. // Creates a new occurrence.
  74. rpc CreateOccurrence(CreateOccurrenceRequest) returns (Occurrence) {
  75. option (google.api.http) = {
  76. post: "/v1beta1/{parent=projects/*}/occurrences"
  77. body: "occurrence"
  78. };
  79. }
  80. // Creates new occurrences in batch.
  81. rpc BatchCreateOccurrences(BatchCreateOccurrencesRequest)
  82. returns (BatchCreateOccurrencesResponse) {
  83. option (google.api.http) = {
  84. post: "/v1beta1/{parent=projects/*}/occurrences:batchCreate"
  85. body: "*"
  86. };
  87. }
  88. // Updates the specified occurrence.
  89. rpc UpdateOccurrence(UpdateOccurrenceRequest) returns (Occurrence) {
  90. option (google.api.http) = {
  91. patch: "/v1beta1/{name=projects/*/occurrences/*}"
  92. body: "occurrence"
  93. };
  94. }
  95. // Gets the note attached to the specified occurrence. Consumer projects can
  96. // use this method to get a note that belongs to a provider project.
  97. rpc GetOccurrenceNote(GetOccurrenceNoteRequest) returns (Note) {
  98. option (google.api.http) = {
  99. get: "/v1beta1/{name=projects/*/occurrences/*}/notes"
  100. };
  101. }
  102. // Gets the specified note.
  103. rpc GetNote(GetNoteRequest) returns (Note) {
  104. option (google.api.http) = {
  105. get: "/v1beta1/{name=projects/*/notes/*}"
  106. };
  107. }
  108. // Lists notes for the specified project.
  109. rpc ListNotes(ListNotesRequest) returns (ListNotesResponse) {
  110. option (google.api.http) = {
  111. get: "/v1beta1/{parent=projects/*}/notes"
  112. };
  113. }
  114. // Deletes the specified note.
  115. rpc DeleteNote(DeleteNoteRequest) returns (google.protobuf.Empty) {
  116. option (google.api.http) = {
  117. delete: "/v1beta1/{name=projects/*/notes/*}"
  118. };
  119. }
  120. // Creates a new note.
  121. rpc CreateNote(CreateNoteRequest) returns (Note) {
  122. option (google.api.http) = {
  123. post: "/v1beta1/{parent=projects/*}/notes"
  124. body: "note"
  125. };
  126. }
  127. // Creates new notes in batch.
  128. rpc BatchCreateNotes(BatchCreateNotesRequest)
  129. returns (BatchCreateNotesResponse) {
  130. option (google.api.http) = {
  131. post: "/v1beta1/{parent=projects/*}/notes:batchCreate"
  132. body: "*"
  133. };
  134. }
  135. // Updates the specified note.
  136. rpc UpdateNote(UpdateNoteRequest) returns (Note) {
  137. option (google.api.http) = {
  138. patch: "/v1beta1/{name=projects/*/notes/*}"
  139. body: "note"
  140. };
  141. }
  142. // Lists occurrences referencing the specified note. Provider projects can use
  143. // this method to get all occurrences across consumer projects referencing the
  144. // specified note.
  145. rpc ListNoteOccurrences(ListNoteOccurrencesRequest)
  146. returns (ListNoteOccurrencesResponse) {
  147. option (google.api.http) = {
  148. get: "/v1beta1/{name=projects/*/notes/*}/occurrences"
  149. };
  150. }
  151. // Gets a summary of the number and severity of occurrences.
  152. rpc GetVulnerabilityOccurrencesSummary(
  153. GetVulnerabilityOccurrencesSummaryRequest)
  154. returns (VulnerabilityOccurrencesSummary) {
  155. option (google.api.http) = {
  156. get: "/v1beta1/{parent=projects/*}/occurrences:vulnerabilitySummary"
  157. };
  158. }
  159. }
  160. // An instance of an analysis type that has been found on a resource.
  161. message Occurrence {
  162. // Output only. The name of the occurrence in the form of
  163. // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
  164. string name = 1;
  165. // Required. Immutable. The resource for which the occurrence applies.
  166. Resource resource = 2;
  167. // Required. Immutable. The analysis note associated with this occurrence, in
  168. // the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`. This field can be
  169. // used as a filter in list requests.
  170. string note_name = 3;
  171. // Output only. This explicitly denotes which of the occurrence details are
  172. // specified. This field can be used as a filter in list requests.
  173. grafeas.v1beta1.NoteKind kind = 4;
  174. // A description of actions that can be taken to remedy the note.
  175. string remediation = 5;
  176. // Output only. The time this occurrence was created.
  177. google.protobuf.Timestamp create_time = 6;
  178. // Output only. The time this occurrence was last updated.
  179. google.protobuf.Timestamp update_time = 7;
  180. // Required. Immutable. Describes the details of the note kind found on this
  181. // resource.
  182. oneof details {
  183. // Describes a security vulnerability.
  184. grafeas.v1beta1.vulnerability.Details vulnerability = 8;
  185. // Describes a verifiable build.
  186. grafeas.v1beta1.build.Details build = 9;
  187. // Describes how this resource derives from the basis in the associated
  188. // note.
  189. grafeas.v1beta1.image.Details derived_image = 10;
  190. // Describes the installation of a package on the linked resource.
  191. grafeas.v1beta1.package.Details installation = 11;
  192. // Describes the deployment of an artifact on a runtime.
  193. grafeas.v1beta1.deployment.Details deployment = 12;
  194. // Describes when a resource was discovered.
  195. grafeas.v1beta1.discovery.Details discovered = 13;
  196. // Describes an attestation of an artifact.
  197. grafeas.v1beta1.attestation.Details attestation = 14;
  198. }
  199. // next_id = 15;
  200. }
  201. // An entity that can have metadata. For example, a Docker image.
  202. message Resource {
  203. // The name of the resource. For example, the name of a Docker image -
  204. // "Debian".
  205. string name = 1;
  206. // Required. The unique URI of the resource. For example,
  207. // `https://gcr.io/project/image@sha256:foo` for a Docker image.
  208. string uri = 2;
  209. // The hash of the resource content. For example, the Docker digest.
  210. grafeas.v1beta1.provenance.Hash content_hash = 3;
  211. // next_id = 4;
  212. }
  213. // A type of analysis that can be done for a resource.
  214. message Note {
  215. // Output only. The name of the note in the form of
  216. // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
  217. string name = 1;
  218. // A one sentence description of this note.
  219. string short_description = 2;
  220. // A detailed description of this note.
  221. string long_description = 3;
  222. // Output only. The type of analysis. This field can be used as a filter in
  223. // list requests.
  224. grafeas.v1beta1.NoteKind kind = 4;
  225. // URLs associated with this note.
  226. repeated grafeas.v1beta1.RelatedUrl related_url = 5;
  227. // Time of expiration for this note. Empty if note does not expire.
  228. google.protobuf.Timestamp expiration_time = 6;
  229. // Output only. The time this note was created. This field can be used as a
  230. // filter in list requests.
  231. google.protobuf.Timestamp create_time = 7;
  232. // Output only. The time this note was last updated. This field can be used as
  233. // a filter in list requests.
  234. google.protobuf.Timestamp update_time = 8;
  235. // Other notes related to this note.
  236. repeated string related_note_names = 9;
  237. // Required. Immutable. The type of analysis this note represents.
  238. oneof type {
  239. // A note describing a package vulnerability.
  240. grafeas.v1beta1.vulnerability.Vulnerability vulnerability = 10;
  241. // A note describing build provenance for a verifiable build.
  242. grafeas.v1beta1.build.Build build = 11;
  243. // A note describing a base image.
  244. grafeas.v1beta1.image.Basis base_image = 12;
  245. // A note describing a package hosted by various package managers.
  246. grafeas.v1beta1.package.Package package = 13;
  247. // A note describing something that can be deployed.
  248. grafeas.v1beta1.deployment.Deployable deployable = 14;
  249. // A note describing the initial analysis of a resource.
  250. grafeas.v1beta1.discovery.Discovery discovery = 15;
  251. // A note describing an attestation role.
  252. grafeas.v1beta1.attestation.Authority attestation_authority = 16;
  253. }
  254. // next_id = 17;
  255. }
  256. // Request to get an occurrence.
  257. message GetOccurrenceRequest {
  258. // The name of the occurrence in the form of
  259. // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
  260. string name = 1;
  261. }
  262. // Request to list occurrences.
  263. message ListOccurrencesRequest {
  264. // The name of the project to list occurrences for in the form of
  265. // `projects/[PROJECT_ID]`.
  266. string parent = 1;
  267. // The filter expression.
  268. string filter = 2;
  269. // Number of occurrences to return in the list.
  270. int32 page_size = 3;
  271. // Token to provide to skip to a particular spot in the list.
  272. string page_token = 4;
  273. // next_id = 7;
  274. }
  275. // Response for listing occurrences.
  276. message ListOccurrencesResponse {
  277. // The occurrences requested.
  278. repeated Occurrence occurrences = 1;
  279. // The next pagination token in the list response. It should be used as
  280. // `page_token` for the following request. An empty value means no more
  281. // results.
  282. string next_page_token = 2;
  283. }
  284. // Request to delete a occurrence.
  285. message DeleteOccurrenceRequest {
  286. // The name of the occurrence in the form of
  287. // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
  288. string name = 1;
  289. }
  290. // Request to create a new occurrence.
  291. message CreateOccurrenceRequest {
  292. // The name of the project in the form of `projects/[PROJECT_ID]`, under which
  293. // the occurrence is to be created.
  294. string parent = 1;
  295. // The occurrence to create.
  296. Occurrence occurrence = 2;
  297. }
  298. // Request to update an occurrence.
  299. message UpdateOccurrenceRequest {
  300. // The name of the occurrence in the form of
  301. // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
  302. string name = 1;
  303. // The updated occurrence.
  304. Occurrence occurrence = 2;
  305. // The fields to update.
  306. google.protobuf.FieldMask update_mask = 3;
  307. }
  308. // Request to get a note.
  309. message GetNoteRequest {
  310. // The name of the note in the form of
  311. // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
  312. string name = 1;
  313. }
  314. // Request to get the note to which the specified occurrence is attached.
  315. message GetOccurrenceNoteRequest {
  316. // The name of the occurrence in the form of
  317. // `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
  318. string name = 1;
  319. }
  320. // Request to list notes.
  321. message ListNotesRequest {
  322. // The name of the project to list notes for in the form of
  323. // `projects/[PROJECT_ID]`.
  324. string parent = 1;
  325. // The filter expression.
  326. string filter = 2;
  327. // Number of notes to return in the list.
  328. int32 page_size = 3;
  329. // Token to provide to skip to a particular spot in the list.
  330. string page_token = 4;
  331. }
  332. // Response for listing notes.
  333. message ListNotesResponse {
  334. // The notes requested.
  335. repeated Note notes = 1;
  336. // The next pagination token in the list response. It should be used as
  337. // `page_token` for the following request. An empty value means no more
  338. // results.
  339. string next_page_token = 2;
  340. }
  341. // Request to delete a note.
  342. message DeleteNoteRequest {
  343. // The name of the note in the form of
  344. // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
  345. string name = 1;
  346. }
  347. // Request to create a new note.
  348. message CreateNoteRequest {
  349. // The name of the project in the form of `projects/[PROJECT_ID]`, under which
  350. // the note is to be created.
  351. string parent = 1;
  352. // The ID to use for this note.
  353. string note_id = 2;
  354. // The note to create.
  355. Note note = 3;
  356. }
  357. // Request to update a note.
  358. message UpdateNoteRequest {
  359. // The name of the note in the form of
  360. // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
  361. string name = 1;
  362. // The updated note.
  363. Note note = 2;
  364. // The fields to update.
  365. google.protobuf.FieldMask update_mask = 3;
  366. }
  367. // Request to list occurrences for a note.
  368. message ListNoteOccurrencesRequest {
  369. // The name of the note to list occurrences for in the form of
  370. // `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
  371. string name = 1;
  372. // The filter expression.
  373. string filter = 2;
  374. // Number of occurrences to return in the list.
  375. int32 page_size = 3;
  376. // Token to provide to skip to a particular spot in the list.
  377. string page_token = 4;
  378. }
  379. // Response for listing occurrences for a note.
  380. message ListNoteOccurrencesResponse {
  381. // The occurrences attached to the specified note.
  382. repeated Occurrence occurrences = 1;
  383. // Token to provide to skip to a particular spot in the list.
  384. string next_page_token = 2;
  385. }
  386. // Request to create notes in batch.
  387. message BatchCreateNotesRequest {
  388. // The name of the project in the form of `projects/[PROJECT_ID]`, under which
  389. // the notes are to be created.
  390. string parent = 1;
  391. // The notes to create.
  392. map<string, Note> notes = 2;
  393. }
  394. // Response for creating notes in batch.
  395. message BatchCreateNotesResponse {
  396. // The notes that were created.
  397. repeated Note notes = 1;
  398. }
  399. // Request to create occurrences in batch.
  400. message BatchCreateOccurrencesRequest {
  401. // The name of the project in the form of `projects/[PROJECT_ID]`, under which
  402. // the occurrences are to be created.
  403. string parent = 1;
  404. // The occurrences to create.
  405. repeated Occurrence occurrences = 2;
  406. }
  407. // Response for creating occurrences in batch.
  408. message BatchCreateOccurrencesResponse {
  409. // The occurrences that were created.
  410. repeated Occurrence occurrences = 1;
  411. }
  412. // Request to get a vulnerability summary for some set of occurrences.
  413. message GetVulnerabilityOccurrencesSummaryRequest {
  414. // The name of the project to get a vulnerability summary for in the form of
  415. // `projects/[PROJECT_ID]`.
  416. string parent = 1;
  417. // The filter expression.
  418. string filter = 2;
  419. }
  420. // A summary of how many vulnerability occurrences there are per resource and
  421. // severity type.
  422. message VulnerabilityOccurrencesSummary {
  423. // A listing by resource of the number of fixable and total vulnerabilities.
  424. repeated FixableTotalByDigest counts = 1;
  425. // Per resource and severity counts of fixable and total vulnerabilities.
  426. message FixableTotalByDigest {
  427. // The affected resource.
  428. Resource resource = 1;
  429. // The severity for this count. SEVERITY_UNSPECIFIED indicates total across
  430. // all severities.
  431. grafeas.v1beta1.vulnerability.Severity severity = 2;
  432. // The number of fixable vulnerabilities associated with this resource.
  433. int64 fixable_count = 3;
  434. // The total number of vulnerabilities associated with this resource.
  435. int64 total_count = 4;
  436. }
  437. }