containeranalysis.proto 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. // Copyright 2021 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. syntax = "proto3";
  15. package google.devtools.containeranalysis.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/iam/v1/iam_policy.proto";
  21. import "google/iam/v1/policy.proto";
  22. import "grafeas/v1/severity.proto";
  23. option csharp_namespace = "Google.Cloud.DevTools.ContainerAnalysis.V1";
  24. option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis";
  25. option java_multiple_files = true;
  26. option java_package = "com.google.containeranalysis.v1";
  27. option objc_class_prefix = "GCA";
  28. option ruby_package = "Google::Cloud::ContainerAnalysis::V1";
  29. option php_namespace = "Google\\Cloud\\ContainerAnalysis\\V1";
  30. // Retrieves analysis results of Cloud components such as Docker container
  31. // images. The Container Analysis API is an implementation of the
  32. // [Grafeas](https://grafeas.io) API.
  33. //
  34. // Analysis results are stored as a series of occurrences. An `Occurrence`
  35. // contains information about a specific analysis instance on a resource. An
  36. // occurrence refers to a `Note`. A note contains details describing the
  37. // analysis and is generally stored in a separate project, called a `Provider`.
  38. // Multiple occurrences can refer to the same note.
  39. //
  40. // For example, an SSL vulnerability could affect multiple images. In this case,
  41. // there would be one note for the vulnerability and an occurrence for each
  42. // image with the vulnerability referring to that note.
  43. service ContainerAnalysis {
  44. option (google.api.default_host) = "containeranalysis.googleapis.com";
  45. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  46. // Sets the access control policy on the specified note or occurrence.
  47. // Requires `containeranalysis.notes.setIamPolicy` or
  48. // `containeranalysis.occurrences.setIamPolicy` permission if the resource is
  49. // a note or an occurrence, respectively.
  50. //
  51. // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
  52. // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
  53. // occurrences.
  54. rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) {
  55. option (google.api.http) = {
  56. post: "/v1/{resource=projects/*/notes/*}:setIamPolicy"
  57. body: "*"
  58. additional_bindings {
  59. post: "/v1/{resource=projects/*/occurrences/*}:setIamPolicy"
  60. body: "*"
  61. }
  62. };
  63. option (google.api.method_signature) = "resource,policy";
  64. }
  65. // Gets the access control policy for a note or an occurrence resource.
  66. // Requires `containeranalysis.notes.setIamPolicy` or
  67. // `containeranalysis.occurrences.setIamPolicy` permission if the resource is
  68. // a note or occurrence, respectively.
  69. //
  70. // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
  71. // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
  72. // occurrences.
  73. rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) {
  74. option (google.api.http) = {
  75. post: "/v1/{resource=projects/*/notes/*}:getIamPolicy"
  76. body: "*"
  77. additional_bindings {
  78. post: "/v1/{resource=projects/*/occurrences/*}:getIamPolicy"
  79. body: "*"
  80. }
  81. };
  82. option (google.api.method_signature) = "resource";
  83. }
  84. // Returns the permissions that a caller has on the specified note or
  85. // occurrence. Requires list permission on the project (for example,
  86. // `containeranalysis.notes.list`).
  87. //
  88. // The resource takes the format `projects/[PROJECT_ID]/notes/[NOTE_ID]` for
  89. // notes and `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]` for
  90. // occurrences.
  91. rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) {
  92. option (google.api.http) = {
  93. post: "/v1/{resource=projects/*/notes/*}:testIamPermissions"
  94. body: "*"
  95. additional_bindings {
  96. post: "/v1/{resource=projects/*/occurrences/*}:testIamPermissions"
  97. body: "*"
  98. }
  99. };
  100. option (google.api.method_signature) = "resource,permissions";
  101. }
  102. // Gets a summary of the number and severity of occurrences.
  103. rpc GetVulnerabilityOccurrencesSummary(GetVulnerabilityOccurrencesSummaryRequest) returns (VulnerabilityOccurrencesSummary) {
  104. option (google.api.http) = {
  105. get: "/v1/{parent=projects/*}/occurrences:vulnerabilitySummary"
  106. };
  107. option (google.api.method_signature) = "parent,filter";
  108. }
  109. }
  110. // Request to get a vulnerability summary for some set of occurrences.
  111. message GetVulnerabilityOccurrencesSummaryRequest {
  112. // Required. The name of the project to get a vulnerability summary for in the form of
  113. // `projects/[PROJECT_ID]`.
  114. string parent = 1 [
  115. (google.api.field_behavior) = REQUIRED,
  116. (google.api.resource_reference) = {
  117. type: "cloudresourcemanager.googleapis.com/Project"
  118. }
  119. ];
  120. // The filter expression.
  121. string filter = 2;
  122. }
  123. // A summary of how many vulnerability occurrences there are per resource and
  124. // severity type.
  125. message VulnerabilityOccurrencesSummary {
  126. // Per resource and severity counts of fixable and total vulnerabilities.
  127. message FixableTotalByDigest {
  128. // The affected resource.
  129. string resource_uri = 1;
  130. // The severity for this count. SEVERITY_UNSPECIFIED indicates total across
  131. // all severities.
  132. grafeas.v1.Severity severity = 2;
  133. // The number of fixable vulnerabilities associated with this resource.
  134. int64 fixable_count = 3;
  135. // The total number of vulnerabilities associated with this resource.
  136. int64 total_count = 4;
  137. }
  138. // A listing by resource of the number of fixable and total vulnerabilities.
  139. repeated FixableTotalByDigest counts = 1;
  140. }