Search in sources :

Example 1 with ListInfoTypesResponse

use of com.google.privacy.dlp.v2.ListInfoTypesResponse 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());
        }
    }
}
Also used : ListInfoTypesResponse(com.google.privacy.dlp.v2.ListInfoTypesResponse) DlpServiceClient(com.google.cloud.dlp.v2.DlpServiceClient) InfoTypeDescription(com.google.privacy.dlp.v2.InfoTypeDescription) ListInfoTypesRequest(com.google.privacy.dlp.v2.ListInfoTypesRequest)

Aggregations

DlpServiceClient (com.google.cloud.dlp.v2.DlpServiceClient)1 InfoTypeDescription (com.google.privacy.dlp.v2.InfoTypeDescription)1 ListInfoTypesRequest (com.google.privacy.dlp.v2.ListInfoTypesRequest)1 ListInfoTypesResponse (com.google.privacy.dlp.v2.ListInfoTypesResponse)1