Skip to content

Commit

Permalink
feat: [grafeas] A new field version is added to message `.grafeas.v…
Browse files Browse the repository at this point in the history
…1.ComplianceOccurrence` (#12960)

- [ ] Regenerate this pull request now.

BEGIN_COMMIT_OVERRIDE
feat: A new message `VulnerabilityAttestation` is added
feat: A new field `vulnerability_attestation` is added to message
`.grafeas.v1.DiscoveryOccurrence`
feat: A new field `version` is added to message
`.grafeas.v1.ComplianceOccurrence`
END_COMMIT_OVERRIDE


PiperOrigin-RevId: 657298794

Source-Link:
googleapis/googleapis@ad5c477

Source-Link:
googleapis/googleapis-gen@882414c
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ3JhZmVhcy8uT3dsQm90LnlhbWwiLCJoIjoiODgyNDE0YzNmNjQyMzdlMTgwMDE0ZjFmNWQ3OTU0MTcwMjA5NjIzMCJ9

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people authored Jul 30, 2024
1 parent 895cbec commit 5feea7e
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,11 @@ def __call__(
"uri": "/v1/{parent=projects/*}/notes:batchCreate",
"body": "*",
},
{
"method": "post",
"uri": "/v1/{parent=projects/*/locations/*}/notes:batchCreate",
"body": "*",
},
]
request, metadata = self._interceptor.pre_batch_create_notes(
request, metadata
Expand Down Expand Up @@ -706,6 +711,11 @@ def __call__(
"uri": "/v1/{parent=projects/*}/occurrences:batchCreate",
"body": "*",
},
{
"method": "post",
"uri": "/v1/{parent=projects/*/locations/*}/occurrences:batchCreate",
"body": "*",
},
]
request, metadata = self._interceptor.pre_batch_create_occurrences(
request, metadata
Expand Down Expand Up @@ -804,6 +814,11 @@ def __call__(
"uri": "/v1/{parent=projects/*}/notes",
"body": "note",
},
{
"method": "post",
"uri": "/v1/{parent=projects/*/locations/*}/notes",
"body": "note",
},
]
request, metadata = self._interceptor.pre_create_note(request, metadata)
pb_request = grafeas.CreateNoteRequest.pb(request)
Expand Down Expand Up @@ -898,6 +913,11 @@ def __call__(
"uri": "/v1/{parent=projects/*}/occurrences",
"body": "occurrence",
},
{
"method": "post",
"uri": "/v1/{parent=projects/*/locations/*}/occurrences",
"body": "occurrence",
},
]
request, metadata = self._interceptor.pre_create_occurrence(
request, metadata
Expand Down Expand Up @@ -987,6 +1007,10 @@ def __call__(
"method": "delete",
"uri": "/v1/{name=projects/*/notes/*}",
},
{
"method": "delete",
"uri": "/v1/{name=projects/*/locations/*/notes/*}",
},
]
request, metadata = self._interceptor.pre_delete_note(request, metadata)
pb_request = grafeas.DeleteNoteRequest.pb(request)
Expand Down Expand Up @@ -1060,6 +1084,10 @@ def __call__(
"method": "delete",
"uri": "/v1/{name=projects/*/occurrences/*}",
},
{
"method": "delete",
"uri": "/v1/{name=projects/*/locations/*/occurrences/*}",
},
]
request, metadata = self._interceptor.pre_delete_occurrence(
request, metadata
Expand Down Expand Up @@ -1692,6 +1720,11 @@ def __call__(
"uri": "/v1/{name=projects/*/notes/*}",
"body": "note",
},
{
"method": "patch",
"uri": "/v1/{name=projects/*/locations/*/notes/*}",
"body": "note",
},
]
request, metadata = self._interceptor.pre_update_note(request, metadata)
pb_request = grafeas.UpdateNoteRequest.pb(request)
Expand Down Expand Up @@ -1786,6 +1819,11 @@ def __call__(
"uri": "/v1/{name=projects/*/occurrences/*}",
"body": "occurrence",
},
{
"method": "patch",
"uri": "/v1/{name=projects/*/locations/*/occurrences/*}",
"body": "occurrence",
},
]
request, metadata = self._interceptor.pre_update_occurrence(
request, metadata
Expand Down
8 changes: 8 additions & 0 deletions packages/grafeas/grafeas/grafeas_v1/types/compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ class ComplianceOccurrence(proto.Message):
non_compliance_reason (str):
version (grafeas.grafeas_v1.types.ComplianceVersion):
The OS and config version the benchmark was
run on.
"""

non_compliant_files: MutableSequence["NonCompliantFile"] = proto.RepeatedField(
Expand All @@ -174,6 +177,11 @@ class ComplianceOccurrence(proto.Message):
proto.STRING,
number=3,
)
version: "ComplianceVersion" = proto.Field(
proto.MESSAGE,
number=4,
message="ComplianceVersion",
)


class NonCompliantFile(proto.Message):
Expand Down
55 changes: 55 additions & 0 deletions packages/grafeas/grafeas/grafeas_v1/types/discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class DiscoveryOccurrence(proto.Message):
discovery occurrence were archived.
sbom_status (grafeas.grafeas_v1.types.DiscoveryOccurrence.SBOMStatus):
The status of an SBOM generation.
vulnerability_attestation (grafeas.grafeas_v1.types.DiscoveryOccurrence.VulnerabilityAttestation):
The status of an vulnerability attestation
generation.
"""

class ContinuousAnalysis(proto.Enum):
Expand Down Expand Up @@ -179,6 +182,53 @@ class SBOMState(proto.Enum):
number=2,
)

class VulnerabilityAttestation(proto.Message):
r"""The status of an vulnerability attestation generation.
Attributes:
last_attempt_time (google.protobuf.timestamp_pb2.Timestamp):
The last time we attempted to generate an
attestation.
state (grafeas.grafeas_v1.types.DiscoveryOccurrence.VulnerabilityAttestation.VulnerabilityAttestationState):
The success/failure state of the latest
attestation attempt.
error (str):
If failure, the error reason for why the
attestation generation failed.
"""

class VulnerabilityAttestationState(proto.Enum):
r"""An enum indicating the state of the attestation generation.
Values:
VULNERABILITY_ATTESTATION_STATE_UNSPECIFIED (0):
Default unknown state.
SUCCESS (1):
Attestation was successfully generated and
stored.
FAILURE (2):
Attestation was unsuccessfully generated and
stored.
"""
VULNERABILITY_ATTESTATION_STATE_UNSPECIFIED = 0
SUCCESS = 1
FAILURE = 2

last_attempt_time: timestamp_pb2.Timestamp = proto.Field(
proto.MESSAGE,
number=1,
message=timestamp_pb2.Timestamp,
)
state: "DiscoveryOccurrence.VulnerabilityAttestation.VulnerabilityAttestationState" = proto.Field(
proto.ENUM,
number=2,
enum="DiscoveryOccurrence.VulnerabilityAttestation.VulnerabilityAttestationState",
)
error: str = proto.Field(
proto.STRING,
number=3,
)

continuous_analysis: ContinuousAnalysis = proto.Field(
proto.ENUM,
number=1,
Expand Down Expand Up @@ -223,6 +273,11 @@ class SBOMState(proto.Enum):
number=9,
message=SBOMStatus,
)
vulnerability_attestation: VulnerabilityAttestation = proto.Field(
proto.MESSAGE,
number=10,
message=VulnerabilityAttestation,
)


__all__ = tuple(sorted(__protobuf__.manifest))
20 changes: 20 additions & 0 deletions packages/grafeas/tests/unit/gapic/grafeas_v1/test_grafeas.py
Original file line number Diff line number Diff line change
Expand Up @@ -7383,6 +7383,11 @@ def test_create_occurrence_rest(request_type):
"last_scan_time": {},
"archive_time": {},
"sbom_status": {"sbom_state": 1, "error": "error_value"},
"vulnerability_attestation": {
"last_attempt_time": {},
"state": 1,
"error": "error_value",
},
},
"attestation": {
"serialized_payload": b"serialized_payload_blob",
Expand Down Expand Up @@ -7421,6 +7426,11 @@ def test_create_occurrence_rest(request_type):
}
],
"non_compliance_reason": "non_compliance_reason_value",
"version": {
"cpe_uri": "cpe_uri_value",
"benchmark_document": "benchmark_document_value",
"version": "version_value",
},
},
"dsse_attestation": {
"envelope": {
Expand Down Expand Up @@ -8442,6 +8452,11 @@ def test_update_occurrence_rest(request_type):
"last_scan_time": {},
"archive_time": {},
"sbom_status": {"sbom_state": 1, "error": "error_value"},
"vulnerability_attestation": {
"last_attempt_time": {},
"state": 1,
"error": "error_value",
},
},
"attestation": {
"serialized_payload": b"serialized_payload_blob",
Expand Down Expand Up @@ -8480,6 +8495,11 @@ def test_update_occurrence_rest(request_type):
}
],
"non_compliance_reason": "non_compliance_reason_value",
"version": {
"cpe_uri": "cpe_uri_value",
"benchmark_document": "benchmark_document_value",
"version": "version_value",
},
},
"dsse_attestation": {
"envelope": {
Expand Down

0 comments on commit 5feea7e

Please sign in to comment.