/** * * * <pre> * Output only. The name of the occurrence in the form of * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); if (hasResource()) { hash = (37 * hash) + RESOURCE_FIELD_NUMBER;
public Builder mergeFrom(io.grafeas.v1beta1.Occurrence other) { if (other == io.grafeas.v1beta1.Occurrence.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged();
/** * Retrieves all the Occurrences associated with a specified image * Here, all Occurrences are simply printed and counted * @param client The Grafeas client used to perform the API requests. * @param imageUrl the Container Registry URL associated with the image * example: "https://gcr.io/project/image@sha256:foo" * @param projectId the GCP project to search for Occurrences in * @return number of Occurrences found */ public static int getOccurrencesForImage(GrafeasV1Beta1Client client, String imageUrl, String projectId) { final String filterStr = "resourceUrl=\"" + imageUrl + "\""; final String projectName = ProjectName.format(projectId); int i = 0; for (Occurrence o : client.listOccurrences(projectName, filterStr).iterateAll()) { // Write custom code to process each Occurrence here System.out.println(o.getName()); i = i + 1; } return i; } // [END occurrences_for_image]
/** * Retrieves all the Occurrences associated with a specified Note * Here, all Occurrences are printed and counted * @param client The Grafeas client used to perform the API requests. * @param noteId the Note's unique identifier * @param projectId the GCP project the Note belongs to * @return number of Occurrences found */ public static int getOccurrencesForNote(GrafeasV1Beta1Client client, String noteId, String projectId) { final NoteName noteName = NoteName.of(projectId, noteId); int i = 0; ListNoteOccurrencesRequest request = ListNoteOccurrencesRequest.newBuilder() .setName(noteName.toString()) .build(); for (Occurrence o : client.listNoteOccurrences(request).iterateAll()) { // Write custom code to process each Occurrence here System.out.println(o.getName()); i = i + 1; } return i; } // [END occurrences_for_note]
/** * * * <pre> * Output only. The name of the occurrence in the form of * `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); if (hasResource()) { hash = (37 * hash) + RESOURCE_FIELD_NUMBER;
public Builder mergeFrom(io.grafeas.v1beta1.Occurrence other) { if (other == io.grafeas.v1beta1.Occurrence.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged();