use of com.google.privacy.dlp.v2.Error in project dodo by devhawala.
the class DodoTest method testBfsChsService.
private static void testBfsChsService() throws XnsException {
ChsDatabase chsDatabase = new ChsDatabase(0x1122_3344, "organization", "domain", null, true);
Clearinghouse3Impl.init(0x1122_3344, 0xAABB_CCDD_EEFFL, chsDatabase);
localSite.pexListen(IDP.KnownSocket.CLEARINGHOUSE.getSocket(), new BfsClearinghouseResponder());
byte[] requestData = { 0x00, 0x03, 0x00, 0x03, 0x00, 0x00, 0x56, 0x78, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x00 };
Payload response = localSite.pexRequest(IDP.BROADCAST_ADDR, IDP.KnownSocket.CLEARINGHOUSE.getSocket(), PEX.ClientType.CLEARINGHOUSE.getTypeValue(), requestData, 0, requestData.length);
if (response == null) {
System.out.println("bfs response: null (timeout)\n");
} else if (response instanceof PEX) {
System.out.println("bfs response is of type: PEX\n");
PEX pex = (PEX) response;
System.out.printf("=> PEX: %s\n", pex.toString());
System.out.printf("=> PEX.payload: %s\n", pex.payloadToString());
} else if (response instanceof Error) {
System.out.println("bfs response is of type: Error\n");
} else {
System.out.printf("bfs response is of unexpected type: %s\n", response.getClass().getName());
}
}
use of com.google.privacy.dlp.v2.Error in project dodo by devhawala.
the class XnsTestRequestor method doTimeServiceRequest.
private static void doTimeServiceRequest() throws XnsException {
System.out.println("\n## sending Time service request");
byte[] requestData = { // time serice version 2
0x00, // time serice version 2
0x02, // request
0x00, // request
0x01 };
Payload response = localSite.pexRequest(IDP.BROADCAST_ADDR, IDP.KnownSocket.TIME.getSocket(), PEX.ClientType.TIME.getTypeValue(), requestData, 0, requestData.length);
if (response == null) {
System.out.println("=> time response: null (timeout)\n");
} else if (response instanceof PEX) {
System.out.println("=> time response:");
PEX pex = (PEX) response;
System.out.println(pex.toString());
System.out.printf("=> PEX.payload: %s\n", pex.payloadToString());
} else if (response instanceof Error) {
System.out.println("=> time response is of type: Error\n");
} else {
System.out.printf("=> time response is of unexpected type: %s\n", response.getClass().getName());
}
}
use of com.google.privacy.dlp.v2.Error in project auto-data-tokenize by GoogleCloudPlatform.
the class DlpInspectionPipeline method makePipeline.
/**
* Creates the pipeline and applies the transforms.
*/
@VisibleForTesting
Pipeline makePipeline() {
TupleTag<FlatRecord> recordsTag = new TupleTag<>();
TupleTag<String> avroSchemaTag = new TupleTag<>();
PCollectionTuple recordSchemaTuple = pipeline.apply("Read" + SourceNames.forType(options.getSourceType()).asCamelCase(), TransformingReader.forSourceType(options.getSourceType()).from(options.getInputPattern()).withJdbcConfiguration(JdbcConfigurationExtractor.using(options).jdbcConfiguration()).withSecretsClient(secretsClient).withRecordsTag(recordsTag).withAvroSchemaTag(avroSchemaTag));
// Sample and Identify columns
var columnInfoTag = new TupleTag<ColumnInformation>();
var errorTag = new TupleTag<KV<ShardedKey<String>, Table>>();
var dlpInspectResults = recordSchemaTuple.get(recordsTag).apply("RandomColumnarSample", RandomColumnarSampler.any(options.getSampleSize())).apply("BatchForDlp", new BatchColumnsForDlp()).apply("DlpIdentify", DlpIdentify.builder().batchIdentifierFactory(makeDlpBatchIdentifierFactory()).columnInfoTag(columnInfoTag).errorTag(errorTag).build());
dlpInspectResults.get(errorTag).setCoder(KvCoder.of(ShardedKey.Coder.of(StringUtf8Coder.of()), ProtoCoder.of(Table.class))).apply("MakeErrorTableJson", ParDo.of(new ConvertTableToJsonFn())).setCoder(KvCoder.of(StringUtf8Coder.of(), StringUtf8Coder.of())).apply("WriteErrorElements", FileIO.<String, KV<String, String>>writeDynamic().via(Contextful.fn(KV::getValue), Contextful.fn(col -> TextIO.sink())).by(KV::getKey).withDestinationCoder(StringUtf8Coder.of()).withNaming(Contextful.fn(colName -> defaultNaming(/*prefix=*/
String.format("col-%s", colName.replaceAll("[\\.\\$\\[\\]]+", "-")).replaceAll("[-]+", "-"), /*suffix=*/
".json"))).to(options.getReportLocation() + "/error"));
var inspectionReport = dlpInspectResults.get(columnInfoTag).apply("ExtractReport", MakeInspectionReport.builder().setAvroSchema(recordSchemaTuple.get(avroSchemaTag).apply(View.asSingleton())).setSourceType(options.getSourceType()).setClock(clock).setInputPattern(options.getInputPattern()).setJdbcConfiguration(JdbcConfigurationExtractor.using(options).jdbcConfiguration()).build());
recordSchemaTuple.get(avroSchemaTag).apply("WriteSchema", TextIO.write().to(options.getReportLocation() + "/schema").withSuffix(".json").withoutSharding());
writeReportToGcs(inspectionReport);
writeReportToBigQuery(inspectionReport);
writeReportToDataCatalog(inspectionReport);
return pipeline;
}
use of com.google.privacy.dlp.v2.Error in project vnfsdk-validation by onap.
the class VTPValidateCSARR130206 method validateCSAR.
@Override
protected void validateCSAR(CSARArchive csar) throws OnapCommandException {
try {
final Optional<Path> pathToCsarFolder = getPathToCsar(csar);
if (pathToCsarFolder.isPresent()) {
final CsarSecurityValidator csarSecurityValidator = new CsarSecurityValidator(csar, pathToCsarFolder.get());
this.errors.addAll(csarSecurityValidator.validate());
} else {
this.errors.add(new Error.CSARErrorUnableToFindCsarContent());
}
} catch (Exception e) {
LOG.error("Internal VTPValidateCSARR130206 command error", e);
throw new OnapCommandException("0x3000", "Internal VTPValidateCSARR130206 command error. See logs.");
}
}
Aggregations