use of com.google.privacy.dlp.v2.ProjectJobTriggerName in project java-docs-samples by GoogleCloudPlatform.
the class Triggers method deleteTrigger.
// [END dlp_list_triggers]
// [START dlp_delete_trigger]
/**
* Delete a DLP trigger in a project.
*
* @param projectId The project ID to run the API call under.
* @param triggerId Trigger ID
*/
private static void deleteTrigger(String projectId, String triggerId) {
ProjectJobTriggerName triggerName = ProjectJobTriggerName.of(projectId, triggerId);
try (DlpServiceClient dlpServiceClient = DlpServiceClient.create()) {
DeleteJobTriggerRequest deleteJobTriggerRequest = DeleteJobTriggerRequest.newBuilder().setName(triggerName.toString()).build();
dlpServiceClient.deleteJobTrigger(deleteJobTriggerRequest);
System.out.println("Trigger deleted: " + triggerName.toString());
} catch (Exception e) {
System.out.println("Error deleting trigger :" + e.getMessage());
}
}
Aggregations