Search in sources :

Example 1 with DeleteNoteRequest

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

the class GrafeasV1Beta1ClientTest method deleteNoteTest.

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

Example 2 with DeleteNoteRequest

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

the class GrafeasV1Beta1Client method deleteNote.

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
 * Deletes the specified note.
 *
 * <p>Sample code:
 *
 * <pre><code>
 * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
 *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
 *   grafeasV1Beta1Client.deleteNote(name.toString());
 * }
 * </code></pre>
 *
 * @param name The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteNote(String name) {
    DeleteNoteRequest request = DeleteNoteRequest.newBuilder().setName(name).build();
    deleteNote(request);
}
Also used : DeleteNoteRequest(io.grafeas.v1beta1.DeleteNoteRequest)

Example 3 with DeleteNoteRequest

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

the class GrafeasV1Beta1Client method deleteNote.

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
 * Deletes the specified note.
 *
 * <p>Sample code:
 *
 * <pre><code>
 * try (GrafeasV1Beta1Client grafeasV1Beta1Client = GrafeasV1Beta1Client.create()) {
 *   NoteName name = NoteName.of("[PROJECT]", "[NOTE]");
 *   grafeasV1Beta1Client.deleteNote(name);
 * }
 * </code></pre>
 *
 * @param name The name of the note in the form of `projects/[PROVIDER_ID]/notes/[NOTE_ID]`.
 * @throws com.google.api.gax.rpc.ApiException if the remote call fails
 */
public final void deleteNote(NoteName name) {
    DeleteNoteRequest request = DeleteNoteRequest.newBuilder().setName(name == null ? null : name.toString()).build();
    deleteNote(request);
}
Also used : DeleteNoteRequest(io.grafeas.v1beta1.DeleteNoteRequest)

Aggregations

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