public static Map generateTableLabelsFromDlpFindings()

in services/library/src/main/java/com/google/cloud/pso/bq_pii_classifier/functions/tagger/Tagger.java [415:428]


    public static Map<String, String> generateTableLabelsFromDlpFindings(TablePolicyTags tablePolicyTags,
                                                                         Map<String, InfoTypeInfo> infoTypeMap) {
        Map<String, String> tableLabels = new HashMap<>();
        // loop on all InfoTyps found in that table
        for (PolicyTagInfo policyTagInfo : tablePolicyTags.getFieldsPolicyTags().values()) {
            String infoType = policyTagInfo.getInfoType();
            // lookup the labels associated with that info type based on the classification taxonomy (in Terraform)
            // add each label to the map. Duplicate labels across InfoTypes will be overwritten.
            for (ResourceLabel infoTypeLabel : infoTypeMap.get(infoType).getLabels()) {
                tableLabels.put(infoTypeLabel.getKey().toLowerCase(), infoTypeLabel.getValue().toLowerCase());
            }
        }
        return tableLabels;
    }