diff --git a/google/devtools/containeranalysis/v1/BUILD.bazel b/google/devtools/containeranalysis/v1/BUILD.bazel index 757afd4db5..46b975733a 100644 --- a/google/devtools/containeranalysis/v1/BUILD.bazel +++ b/google/devtools/containeranalysis/v1/BUILD.bazel @@ -17,8 +17,11 @@ proto_library( deps = [ "//google/api:annotations_proto", "//google/api:client_proto", + "//google/api:field_behavior_proto", "//google/iam/v1:iam_policy_proto", "//google/iam/v1:policy_proto", + "//google/api:resource_proto", + "//grafeas/v1:grafeas_proto", "@com_google_protobuf//:timestamp_proto", ], ) @@ -109,6 +112,7 @@ go_proto_library( deps = [ "//google/api:annotations_go_proto", "//google/iam/v1:iam_go_proto", + "//grafeas/v1:grafeas_go_proto", ], ) # Fix compilation error diff --git a/google/devtools/containeranalysis/v1/containeranalysis.proto b/google/devtools/containeranalysis/v1/containeranalysis.proto index 55b842a00b..f1f1e2730c 100644 --- a/google/devtools/containeranalysis/v1/containeranalysis.proto +++ b/google/devtools/containeranalysis/v1/containeranalysis.proto @@ -1,4 +1,4 @@ -// Copyright 2019 Google LLC. +// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -11,7 +11,6 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. -// syntax = "proto3"; @@ -19,9 +18,12 @@ package google.devtools.containeranalysis.v1; import "google/api/annotations.proto"; import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; import "google/iam/v1/iam_policy.proto"; import "google/iam/v1/policy.proto"; import "google/protobuf/timestamp.proto"; +import "grafeas/v1/vulnerability.proto"; option csharp_namespace = "Google.Cloud.DevTools.ContainerAnalysis.V1"; option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis"; @@ -105,4 +107,48 @@ service ContainerAnalysis { }; option (google.api.method_signature) = "resource,permissions"; } + + // Gets a summary of the number and severity of occurrences. + rpc GetVulnerabilityOccurrencesSummary(GetVulnerabilityOccurrencesSummaryRequest) returns (VulnerabilityOccurrencesSummary) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/occurrences:vulnerabilitySummary" + }; + option (google.api.method_signature) = "parent,filter"; + } +} + +// Request to get a vulnerability summary for some set of occurrences. +message GetVulnerabilityOccurrencesSummaryRequest { + // The name of the project to get a vulnerability summary for in the form of + // `projects/[PROJECT_ID]`. + string parent = 1 [ + (google.api.resource_reference).type = "cloudresourcemanager.googleapis.com/Project", + (google.api.field_behavior) = REQUIRED + ]; + + // The filter expression. + string filter = 2; +} + +// A summary of how many vulnerability occurrences there are per resource and +// severity type. +message VulnerabilityOccurrencesSummary { + // Per resource and severity counts of fixable and total vulnerabilities. + message FixableTotalByDigest { + // The affected resource. + string resource_uri = 1; + + // The severity for this count. SEVERITY_UNSPECIFIED indicates total across + // all severities. + grafeas.v1.Severity severity = 2; + + // The number of fixable vulnerabilities associated with this resource. + int64 fixable_count = 3; + + // The total number of vulnerabilities associated with this resource. + int64 total_count = 4; + } + + // A listing by resource of the number of fixable and total vulnerabilities. + repeated FixableTotalByDigest counts = 1; }