grafeas.proto 18 KB

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