Skip to content

Commit e8feca7

Browse files
feat: [google-cloud-os-config] Add highest_upgradable_cve_severity field to Vulnerability report (#14209)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: Add highest_upgradable_cve_severity field to Vulnerability report docs: A comment for field `update_time` in message `.google.cloud.osconfig.v1.VulnerabilityReport` is changed docs: A comment for field `filter` in message `.google.cloud.osconfig.v1.ListVulnerabilityReportsRequest` is changed END_COMMIT_OVERRIDE PiperOrigin-RevId: 792763000 Source-Link: googleapis/googleapis@eef0d65 Source-Link: googleapis/googleapis-gen@8a589ca Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW9zLWNvbmZpZy8uT3dsQm90LnlhbWwiLCJoIjoiOGE1ODljYWM2MWRhMGI2ZGZkNGJkMGRhOThlYjQwYzM3NjlmOWRhZCJ9 --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent c86a9cd commit e8feca7

File tree

7 files changed

+80
-8
lines changed

7 files changed

+80
-8
lines changed

packages/google-cloud-os-config/google/cloud/osconfig/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.20.2" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-os-config/google/cloud/osconfig_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.20.2" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-os-config/google/cloud/osconfig_v1/types/vulnerability.py

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,44 @@ class VulnerabilityReport(proto.Message):
5252
update_time (google.protobuf.timestamp_pb2.Timestamp):
5353
Output only. The timestamp for when the last
5454
vulnerability report was generated for the VM.
55+
highest_upgradable_cve_severity (google.cloud.osconfig_v1.types.VulnerabilityReport.VulnerabilitySeverityLevel):
56+
Output only. Highest level of severity among
57+
all the upgradable vulnerabilities with CVEs
58+
attached.
5559
"""
5660

61+
class VulnerabilitySeverityLevel(proto.Enum):
62+
r"""Severity levels for vulnerabilities.
63+
64+
Values:
65+
VULNERABILITY_SEVERITY_LEVEL_UNSPECIFIED (0):
66+
Default SeverityLevel. This value is unused.
67+
NONE (1):
68+
Vulnerability has no severity level.
69+
MINIMAL (2):
70+
Vulnerability severity level is minimal. This
71+
is level below the low severity level.
72+
LOW (3):
73+
Vulnerability severity level is low. This is
74+
level below the medium severity level.
75+
MEDIUM (4):
76+
Vulnerability severity level is medium. This
77+
is level below the high severity level.
78+
HIGH (5):
79+
Vulnerability severity level is high. This is
80+
level below the critical severity level.
81+
CRITICAL (6):
82+
Vulnerability severity level is critical.
83+
This is the highest severity level.
84+
"""
85+
VULNERABILITY_SEVERITY_LEVEL_UNSPECIFIED = 0
86+
NONE = 1
87+
MINIMAL = 2
88+
LOW = 3
89+
MEDIUM = 4
90+
HIGH = 5
91+
CRITICAL = 6
92+
5793
class Vulnerability(proto.Message):
5894
r"""A vulnerability affecting the VM instance.
5995
@@ -255,6 +291,11 @@ class Item(proto.Message):
255291
number=3,
256292
message=timestamp_pb2.Timestamp,
257293
)
294+
highest_upgradable_cve_severity: VulnerabilitySeverityLevel = proto.Field(
295+
proto.ENUM,
296+
number=4,
297+
enum=VulnerabilitySeverityLevel,
298+
)
258299

259300

260301
class GetVulnerabilityReportRequest(proto.Message):
@@ -300,9 +341,24 @@ class ListVulnerabilityReportsRequest(proto.Message):
300341
``ListVulnerabilityReports`` that indicates where this
301342
listing should continue from.
302343
filter (str):
303-
If provided, this field specifies the criteria that must be
304-
met by a ``vulnerabilityReport`` API resource to be included
305-
in the response.
344+
This field supports filtering by the severity level for the
345+
vulnerability. For a list of severity levels, see `Severity
346+
levels for
347+
vulnerabilities <https://cloud.google.com/container-analysis/docs/container-scanning-overview#severity_levels_for_vulnerabilities>`__.
348+
349+
The filter field follows the rules described in the
350+
`AIP-160 <https://google.aip.dev/160>`__ guidelines as
351+
follows:
352+
353+
- **Filter for a specific severity type**: you can list
354+
reports that contain vulnerabilities that are classified
355+
as medium by specifying
356+
``vulnerabilities.details.severity:MEDIUM``.
357+
358+
- **Filter for a range of severities** : you can list
359+
reports that have vulnerabilities that are classified as
360+
critical or high by specifying
361+
``vulnerabilities.details.severity:HIGH OR vulnerabilities.details.severity:CRITICAL``
306362
"""
307363

308364
parent: str = proto.Field(

packages/google-cloud-os-config/google/cloud/osconfig_v1alpha/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.20.2" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-os-config/samples/generated_samples/snippet_metadata_google.cloud.osconfig.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-os-config",
11-
"version": "1.20.2"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-os-config/samples/generated_samples/snippet_metadata_google.cloud.osconfig.v1alpha.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-os-config",
11-
"version": "1.20.2"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

packages/google-cloud-os-config/tests/unit/gapic/osconfig_v1/test_os_config_zonal_service.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5561,6 +5561,7 @@ def test_get_vulnerability_report(request_type, transport: str = "grpc"):
55615561
# Designate an appropriate return value for the call.
55625562
call.return_value = vulnerability.VulnerabilityReport(
55635563
name="name_value",
5564+
highest_upgradable_cve_severity=vulnerability.VulnerabilityReport.VulnerabilitySeverityLevel.NONE,
55645565
)
55655566
response = client.get_vulnerability_report(request)
55665567

@@ -5573,6 +5574,10 @@ def test_get_vulnerability_report(request_type, transport: str = "grpc"):
55735574
# Establish that the response is the type that we expect.
55745575
assert isinstance(response, vulnerability.VulnerabilityReport)
55755576
assert response.name == "name_value"
5577+
assert (
5578+
response.highest_upgradable_cve_severity
5579+
== vulnerability.VulnerabilityReport.VulnerabilitySeverityLevel.NONE
5580+
)
55765581

55775582

55785583
def test_get_vulnerability_report_non_empty_request_with_auto_populated_field():
@@ -5709,6 +5714,7 @@ async def test_get_vulnerability_report_async(
57095714
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
57105715
vulnerability.VulnerabilityReport(
57115716
name="name_value",
5717+
highest_upgradable_cve_severity=vulnerability.VulnerabilityReport.VulnerabilitySeverityLevel.NONE,
57125718
)
57135719
)
57145720
response = await client.get_vulnerability_report(request)
@@ -5722,6 +5728,10 @@ async def test_get_vulnerability_report_async(
57225728
# Establish that the response is the type that we expect.
57235729
assert isinstance(response, vulnerability.VulnerabilityReport)
57245730
assert response.name == "name_value"
5731+
assert (
5732+
response.highest_upgradable_cve_severity
5733+
== vulnerability.VulnerabilityReport.VulnerabilitySeverityLevel.NONE
5734+
)
57255735

57265736

57275737
@pytest.mark.asyncio
@@ -9842,6 +9852,7 @@ async def test_get_vulnerability_report_empty_call_grpc_asyncio():
98429852
call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(
98439853
vulnerability.VulnerabilityReport(
98449854
name="name_value",
9855+
highest_upgradable_cve_severity=vulnerability.VulnerabilityReport.VulnerabilitySeverityLevel.NONE,
98459856
)
98469857
)
98479858
await client.get_vulnerability_report(request=None)
@@ -11723,6 +11734,7 @@ def test_get_vulnerability_report_rest_call_success(request_type):
1172311734
# Designate an appropriate value for the returned response.
1172411735
return_value = vulnerability.VulnerabilityReport(
1172511736
name="name_value",
11737+
highest_upgradable_cve_severity=vulnerability.VulnerabilityReport.VulnerabilitySeverityLevel.NONE,
1172611738
)
1172711739

1172811740
# Wrap the value into a proper Response obj
@@ -11740,6 +11752,10 @@ def test_get_vulnerability_report_rest_call_success(request_type):
1174011752
# Establish that the response is the type that we expect.
1174111753
assert isinstance(response, vulnerability.VulnerabilityReport)
1174211754
assert response.name == "name_value"
11755+
assert (
11756+
response.highest_upgradable_cve_severity
11757+
== vulnerability.VulnerabilityReport.VulnerabilitySeverityLevel.NONE
11758+
)
1174311759

1174411760

1174511761
@pytest.mark.parametrize("null_interceptor", [True, False])

0 commit comments

Comments
 (0)