public static List<String> toStringList(List<ProjectName> values) { List<String> list = new ArrayList<String>(values.size()); for (ProjectName value : values) { if (value == null) { list.add(""); } else { list.add(value.toString()); } } return list; }
public static String format(String project) { return newBuilder().setProject(project).build().toString(); }
/** * Creates new occurrences in batch. * * <p>Sample code: * * <pre><code> * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * List<Occurrence> occurrences = new ArrayList<>(); * BatchCreateOccurrencesResponse response = grafeasV1Beta1Client.batchCreateOccurrences(parent, occurrences); * } * </code></pre> * * @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the * occurrences are to be created. * @param occurrences The occurrences to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final BatchCreateOccurrencesResponse batchCreateOccurrences( ProjectName parent, List<Occurrence> occurrences) { BatchCreateOccurrencesRequest request = BatchCreateOccurrencesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .addAllOccurrences(occurrences) .build(); return batchCreateOccurrences(request); }
/** * Lists notes for the specified project. * * <p>Sample code: * * <pre><code> * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * String filter = ""; * for (Note element : grafeasV1Beta1Client.listNotes(parent, filter).iterateAll()) { * // doThingsWith(element); * } * } * </code></pre> * * @param parent The name of the project to list notes for in the form of `projects/[PROJECT_ID]`. * @param filter The filter expression. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListNotesPagedResponse listNotes(ProjectName parent, String filter) { ListNotesRequest request = ListNotesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFilter(filter) .build(); return listNotes(request); }
/** * Gets a summary of the number and severity of occurrences. * * <p>Sample code: * * <pre><code> * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * String filter = ""; * VulnerabilityOccurrencesSummary response = grafeasV1Beta1Client.getVulnerabilityOccurrencesSummary(parent, filter); * } * </code></pre> * * @param parent The name of the project to get a vulnerability summary for in the form of * `projects/[PROJECT_ID]`. * @param filter The filter expression. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final VulnerabilityOccurrencesSummary getVulnerabilityOccurrencesSummary( ProjectName parent, String filter) { GetVulnerabilityOccurrencesSummaryRequest request = GetVulnerabilityOccurrencesSummaryRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFilter(filter) .build(); return getVulnerabilityOccurrencesSummary(request); }
/** * Creates a new occurrence. * * <p>Sample code: * * <pre><code> * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * Occurrence occurrence = Occurrence.newBuilder().build(); * Occurrence response = grafeasV1Beta1Client.createOccurrence(parent, occurrence); * } * </code></pre> * * @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the * occurrence is to be created. * @param occurrence The occurrence to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Occurrence createOccurrence(ProjectName parent, Occurrence occurrence) { CreateOccurrenceRequest request = CreateOccurrenceRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setOccurrence(occurrence) .build(); return createOccurrence(request); }
/** * Creates new notes in batch. * * <p>Sample code: * * <pre><code> * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * Map<String, Note> notes = new HashMap<>(); * BatchCreateNotesResponse response = grafeasV1Beta1Client.batchCreateNotes(parent, notes); * } * </code></pre> * * @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the * notes are to be created. * @param notes The notes to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final BatchCreateNotesResponse batchCreateNotes( ProjectName parent, Map<String, Note> notes) { BatchCreateNotesRequest request = BatchCreateNotesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .putAllNotes(notes) .build(); return batchCreateNotes(request); }
/** * Lists scan configurations for the specified project. * * <p>Sample code: * * <pre><code> * try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * String filter = ""; * for (ScanConfig element : containerAnalysisV1Beta1Client.listScanConfigs(parent, filter).iterateAll()) { * // doThingsWith(element); * } * } * </code></pre> * * @param parent The name of the project to list scan configurations for in the form of * `projects/[PROJECT_ID]`. * @param filter The filter expression. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListScanConfigsPagedResponse listScanConfigs(ProjectName parent, String filter) { ListScanConfigsRequest request = ListScanConfigsRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFilter(filter) .build(); return listScanConfigs(request); }
/** * Lists occurrences for the specified project. * * <p>Sample code: * * <pre><code> * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * String filter = ""; * for (Occurrence element : grafeasV1Beta1Client.listOccurrences(parent, filter).iterateAll()) { * // doThingsWith(element); * } * } * </code></pre> * * @param parent The name of the project to list occurrences for in the form of * `projects/[PROJECT_ID]`. * @param filter The filter expression. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final ListOccurrencesPagedResponse listOccurrences(ProjectName parent, String filter) { ListOccurrencesRequest request = ListOccurrencesRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFilter(filter) .build(); return listOccurrences(request); }
/** * Creates a new note. * * <p>Sample code: * * <pre><code> * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) { * ProjectName parent = ProjectName.of("[PROJECT]"); * String noteId = ""; * Note note = Note.newBuilder().build(); * Note response = grafeasV1Beta1Client.createNote(parent, noteId, note); * } * </code></pre> * * @param parent The name of the project in the form of `projects/[PROJECT_ID]`, under which the * note is to be created. * @param noteId The ID to use for this note. * @param note The note to create. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Note createNote(ProjectName parent, String noteId, Note note) { CreateNoteRequest request = CreateNoteRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setNoteId(noteId) .setNote(note) .build(); return createNote(request); }
public static List<String> toStringList(List<ProjectName> values) { List<String> list = new ArrayList<String>(values.size()); for (ProjectName value : values) { if (value == null) { list.add(""); } else { list.add(value.toString()); } } return list; }
public static String format(String project) { return newBuilder().setProject(project).build().toString(); }