Search in sources :

Example 1 with DeleteOccurrenceRequest

use of io.grafeas.v1beta1.DeleteOccurrenceRequest in project java-containeranalysis by googleapis.

the class GrafeasV1Beta1ClientTest method deleteOccurrenceTest.

@Test
@SuppressWarnings("all")
public void deleteOccurrenceTest() {
    Empty expectedResponse = Empty.newBuilder().build();
    mockGrafeasV1Beta1.addResponse(expectedResponse);
    OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
    client.deleteOccurrence(name);
    List<AbstractMessage> actualRequests = mockGrafeasV1Beta1.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    DeleteOccurrenceRequest actualRequest = (DeleteOccurrenceRequest) actualRequests.get(0);
    Assert.assertEquals(name, OccurrenceName.parse(actualRequest.getName()));
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : Empty(com.google.protobuf.Empty) DeleteOccurrenceRequest(io.grafeas.v1beta1.DeleteOccurrenceRequest) AbstractMessage(com.google.protobuf.AbstractMessage) OccurrenceName(com.google.containeranalysis.v1beta1.OccurrenceName) Test(org.junit.Test)

Example 2 with DeleteOccurrenceRequest

use of io.grafeas.v1beta1.DeleteOccurrenceRequest in project java-containeranalysis by googleapis.

the class GrafeasV1Beta1Client method deleteOccurrence.

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
 * Deletes the specified occurrence. For example, use this method to delete an occurrence when the
 * occurrence is no longer applicable for the given resource.
 *
 * <p>Sample code:
 *
 * <pre><code>
 * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
 *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
 *   grafeasV1Beta1Client.deleteOccurrence(name);
 * }
 * </code></pre>
 *
 * @param name The name of the occurrence in the form of
 *     `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteOccurrence(OccurrenceName name) {
    DeleteOccurrenceRequest request = DeleteOccurrenceRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    deleteOccurrence(request);
}
Also used : DeleteOccurrenceRequest(io.grafeas.v1beta1.DeleteOccurrenceRequest)

Example 3 with DeleteOccurrenceRequest

use of io.grafeas.v1beta1.DeleteOccurrenceRequest in project java-containeranalysis by googleapis.

the class GrafeasV1Beta1Client method deleteOccurrence.

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
 * Deletes the specified occurrence. For example, use this method to delete an occurrence when the
 * occurrence is no longer applicable for the given resource.
 *
 * <p>Sample code:
 *
 * <pre><code>
 * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
 *   OccurrenceName name = OccurrenceName.of("[PROJECT]", "[OCCURRENCE]");
 *   grafeasV1Beta1Client.deleteOccurrence(name.toString());
 * }
 * </code></pre>
 *
 * @param name The name of the occurrence in the form of
 *     `projects/[PROJECT_ID]/occurrences/[OCCURRENCE_ID]`.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteOccurrence(String name) {
    DeleteOccurrenceRequest request = DeleteOccurrenceRequest.newBuilder().setName(name).build();
    deleteOccurrence(request);
}
Also used : DeleteOccurrenceRequest(io.grafeas.v1beta1.DeleteOccurrenceRequest)

Aggregations

DeleteOccurrenceRequest (io.grafeas.v1beta1.DeleteOccurrenceRequest)3 OccurrenceName (com.google.containeranalysis.v1beta1.OccurrenceName)1 AbstractMessage (com.google.protobuf.AbstractMessage)1 Empty (com.google.protobuf.Empty)1 Test (org.junit.Test)1