use of com.google.cloud.solutions.autotokenize.dlp.DlpClientFactory in project auto-data-tokenize by GoogleCloudPlatform.
the class EncryptionPipelineTest method makeDlpStub.
public void makeDlpStub() {
if (pipelineOptions.getDlpEncryptConfigJson() == null) {
return;
}
var dlpEncryptConfig = TestResourceLoader.classPath().forProto(DlpEncryptConfig.class).loadJson(configParameters.get("dlpEncryptConfigFile"));
var encryptSchemaColumns = DeidentifyColumns.columnNamesIn(dlpEncryptConfig);
expectedSchema = makeExpectedSchema(inputSchema.toString(), encryptSchemaColumns);
var encryptColumns = encryptSchemaColumns.stream().map(name -> Pattern.compile("^(\\$\\.)?([^\\.]+\\.)(.*)$").matcher(name).replaceAll("$1$3")).collect(toImmutableList());
dlpClientFactory = new StubbingDlpClientFactory(new Base64EncodingDlpStub(PartialBatchAccumulator.RECORD_ID_COLUMN_NAME, encryptColumns, PROJECT_ID, pipelineOptions.getDlpRegion()));
}
Aggregations