From 62da0d2f895693e96d4e1f7f2a3d09c6d203025f Mon Sep 17 00:00:00 2001 From: Luke Voelz Date: Wed, 8 Oct 2025 12:05:45 -0500 Subject: [PATCH] Update CreateNote.java Update custom note creation code samples (as seen in https://cloud.google.com/artifact-analysis/docs/create-notes-occurrences#artifact-analysis-create-note-java) to use attestations instead of vulnerabilities, to align with the changes needed for go/aa-deprecate-3p-metadata. --- .../com/example/containeranalysis/CreateNote.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/container-registry/container-analysis/src/main/java/com/example/containeranalysis/CreateNote.java b/container-registry/container-analysis/src/main/java/com/example/containeranalysis/CreateNote.java index d5b4502e351..4a52e879745 100644 --- a/container-registry/container-analysis/src/main/java/com/example/containeranalysis/CreateNote.java +++ b/container-registry/container-analysis/src/main/java/com/example/containeranalysis/CreateNote.java @@ -41,14 +41,9 @@ public static Note createNote(String noteId, String projectId) // Associate the Note with the metadata type // https://cloud.google.com/container-registry/docs/container-analysis#supported_metadata_types // Here, we use the type "vulnerability" - .setVulnerability(VulnerabilityNote.newBuilder() - .addDetails(VulnerabilityNote.Detail.newBuilder() - .setAffectedCpeUri("your-uri-here") - .setAffectedPackage("your-package-here") - .setAffectedVersionStart(Version.newBuilder() - .setKind(Version.VersionKind.MINIMUM)) - .setAffectedVersionEnd(Version.newBuilder() - .setKind(Version.VersionKind.MAXIMUM)))) + .setAttestation(AttestationNote.newBuilder() + .setHint(AttestationNote.Hint.newBuilder() + .setHumanReadableName("my-attestation-authority"))) .build(); // Initialize client that will be used to send requests. After completing all of your requests,