use of com.google.privacy.dlp.v2.InfoTypeDescription in project java-docs-samples by GoogleCloudPlatform.
the class Metadata method listInfoTypes.
// [START dlp_list_info_types]
/*
* List the types of sensitive information the DLP API supports.
*
* @param filter The filter to use, e.g. "supported_by=INSPECT"
* @param languageCode The BCP-47 language code to use, e.g. 'en-US'
*/
private static void listInfoTypes(String filter, String languageCode) throws Exception {
// Instantiate a DLP client
try (DlpServiceClient dlpClient = DlpServiceClient.create()) {
ListInfoTypesRequest listInfoTypesRequest = ListInfoTypesRequest.newBuilder().setFilter(filter).setLanguageCode(languageCode).build();
ListInfoTypesResponse infoTypesResponse = dlpClient.listInfoTypes(listInfoTypesRequest);
List<InfoTypeDescription> infoTypeDescriptions = infoTypesResponse.getInfoTypesList();
for (InfoTypeDescription infoTypeDescription : infoTypeDescriptions) {
System.out.println("Name : " + infoTypeDescription.getName());
System.out.println("Display name : " + infoTypeDescription.getDisplayName());
}
}
}
Aggregations