Skip to content

Commit 9bf84a6

Browse files
yoshi-automationbusunkim96dinagraves
authored
feat: add GetVulnerabilityOccurrencesSummary (#42)
* changes without context autosynth cannot find the source of changes triggered by earlier changes in this repository, or by version upgrades to tools such as linters. * chore: manual regen * Fixing the grafeas import Co-authored-by: Bu Sun Kim <[email protected]> Co-authored-by: Bu Sun Kim <[email protected]> Co-authored-by: Dina Graves Portman <[email protected]>
1 parent 30cb890 commit 9bf84a6

File tree

16 files changed

+1406
-424
lines changed

16 files changed

+1406
-424
lines changed

packages/google-cloud-containeranalysis/devtools-containeranalysis-v1-py.tar.gz

Whitespace-only changes.

packages/google-cloud-containeranalysis/docs/containeranalysis_v1/types.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ Types for Google Cloud Devtools Containeranalysis v1 API
33

44
.. automodule:: google.cloud.devtools.containeranalysis_v1.types
55
:members:
6+
:show-inheritance:

packages/google-cloud-containeranalysis/google/cloud/devtools/containeranalysis/__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,16 @@
2121
from google.cloud.devtools.containeranalysis_v1.services.container_analysis.client import (
2222
ContainerAnalysisClient,
2323
)
24+
from google.cloud.devtools.containeranalysis_v1.types.containeranalysis import (
25+
GetVulnerabilityOccurrencesSummaryRequest,
26+
)
27+
from google.cloud.devtools.containeranalysis_v1.types.containeranalysis import (
28+
VulnerabilityOccurrencesSummary,
29+
)
2430

2531
__all__ = (
2632
"ContainerAnalysisAsyncClient",
2733
"ContainerAnalysisClient",
34+
"GetVulnerabilityOccurrencesSummaryRequest",
35+
"VulnerabilityOccurrencesSummary",
2836
)

packages/google-cloud-containeranalysis/google/cloud/devtools/containeranalysis_v1/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
#
1717

1818
from .services.container_analysis import ContainerAnalysisClient
19+
from .types.containeranalysis import GetVulnerabilityOccurrencesSummaryRequest
20+
from .types.containeranalysis import VulnerabilityOccurrencesSummary
1921

2022

21-
__all__ = ("ContainerAnalysisClient",)
23+
__all__ = (
24+
"GetVulnerabilityOccurrencesSummaryRequest",
25+
"VulnerabilityOccurrencesSummary",
26+
"ContainerAnalysisClient",
27+
)

packages/google-cloud-containeranalysis/google/cloud/devtools/containeranalysis_v1/proto/containeranalysis.proto

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2019 Google LLC.
1+
// Copyright 2019 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -11,17 +11,19 @@
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
14-
//
1514

1615
syntax = "proto3";
1716

1817
package google.devtools.containeranalysis.v1;
1918

2019
import "google/api/annotations.proto";
2120
import "google/api/client.proto";
21+
import "google/api/field_behavior.proto";
22+
import "google/api/resource.proto";
2223
import "google/iam/v1/iam_policy.proto";
2324
import "google/iam/v1/policy.proto";
2425
import "google/protobuf/timestamp.proto";
26+
import "grafeas/v1/vulnerability.proto";
2527

2628
option csharp_namespace = "Google.Cloud.DevTools.ContainerAnalysis.V1";
2729
option go_package = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1;containeranalysis";
@@ -105,4 +107,48 @@ service ContainerAnalysis {
105107
};
106108
option (google.api.method_signature) = "resource,permissions";
107109
}
110+
111+
// Gets a summary of the number and severity of occurrences.
112+
rpc GetVulnerabilityOccurrencesSummary(GetVulnerabilityOccurrencesSummaryRequest) returns (VulnerabilityOccurrencesSummary) {
113+
option (google.api.http) = {
114+
get: "/v1/{parent=projects/*}/occurrences:vulnerabilitySummary"
115+
};
116+
option (google.api.method_signature) = "parent,filter";
117+
}
118+
}
119+
120+
// Request to get a vulnerability summary for some set of occurrences.
121+
message GetVulnerabilityOccurrencesSummaryRequest {
122+
// The name of the project to get a vulnerability summary for in the form of
123+
// `projects/[PROJECT_ID]`.
124+
string parent = 1 [
125+
(google.api.resource_reference).type = "cloudresourcemanager.googleapis.com/Project",
126+
(google.api.field_behavior) = REQUIRED
127+
];
128+
129+
// The filter expression.
130+
string filter = 2;
131+
}
132+
133+
// A summary of how many vulnerability occurrences there are per resource and
134+
// severity type.
135+
message VulnerabilityOccurrencesSummary {
136+
// Per resource and severity counts of fixable and total vulnerabilities.
137+
message FixableTotalByDigest {
138+
// The affected resource.
139+
string resource_uri = 1;
140+
141+
// The severity for this count. SEVERITY_UNSPECIFIED indicates total across
142+
// all severities.
143+
grafeas.v1.Severity severity = 2;
144+
145+
// The number of fixable vulnerabilities associated with this resource.
146+
int64 fixable_count = 3;
147+
148+
// The total number of vulnerabilities associated with this resource.
149+
int64 total_count = 4;
150+
}
151+
152+
// A listing by resource of the number of fixable and total vulnerabilities.
153+
repeated FixableTotalByDigest counts = 1;
108154
}

0 commit comments

Comments
 (0)