use of com.google.privacy.dlp.v2.JobTriggerName in project java-dlp by googleapis.
the class DlpServiceClientTest method hybridInspectJobTriggerTest.
@Test
public void hybridInspectJobTriggerTest() throws Exception {
HybridInspectResponse expectedResponse = HybridInspectResponse.newBuilder().build();
mockDlpService.addResponse(expectedResponse);
JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
HybridInspectResponse actualResponse = client.hybridInspectJobTrigger(name);
Assert.assertEquals(expectedResponse, actualResponse);
List<AbstractMessage> actualRequests = mockDlpService.getRequests();
Assert.assertEquals(1, actualRequests.size());
HybridInspectJobTriggerRequest actualRequest = ((HybridInspectJobTriggerRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.privacy.dlp.v2.JobTriggerName in project java-dlp by googleapis.
the class DlpServiceClientTest method hybridInspectJobTriggerExceptionTest.
@Test
public void hybridInspectJobTriggerExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
client.hybridInspectJobTrigger(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
use of com.google.privacy.dlp.v2.JobTriggerName in project java-dlp by googleapis.
the class DlpServiceClient method deleteJobTrigger.
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn
* more.
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated for illustrative purposes only.
* // It may require modifications to work in your environment.
* try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
* JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
* dlpServiceClient.deleteJobTrigger(name);
* }
* }</pre>
*
* @param name Required. Resource name of the project and the triggeredJob, for example
* `projects/dlp-test-project/jobTriggers/53234423`.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteJobTrigger(JobTriggerName name) {
DeleteJobTriggerRequest request = DeleteJobTriggerRequest.newBuilder().setName(name == null ? null : name.toString()).build();
deleteJobTrigger(request);
}
use of com.google.privacy.dlp.v2.JobTriggerName in project java-dlp by googleapis.
the class DlpServiceClientTest method deleteJobTriggerExceptionTest.
@Test
public void deleteJobTriggerExceptionTest() throws Exception {
StatusRuntimeException exception = new StatusRuntimeException(io.grpc.Status.INVALID_ARGUMENT);
mockDlpService.addException(exception);
try {
JobTriggerName name = JobTriggerName.ofProjectJobTriggerName("[PROJECT]", "[JOB_TRIGGER]");
client.deleteJobTrigger(name);
Assert.fail("No exception raised");
} catch (InvalidArgumentException e) {
// Expected exception.
}
}
Aggregations