MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / jobsCreate

Function jobsCreate

dlp/createJob.js:29–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27 const dlp = new DLP.DlpServiceClient();
28
29 async function jobsCreate() {
30 // Construct cloud storage configuration
31 const cloudStorageConfig = {
32 cloudStorageOptions: {
33 fileSet: {
34 url: cloudFileUrl,
35 },
36 },
37 timespanConfig: {
38 enableAutoPopulationOfTimespanConfig: true,
39 },
40 };
41
42 // Construct inspect job configuration
43 const inspectJob = {
44 storageConfig: cloudStorageConfig,
45 };
46
47 // Construct inspect configuration
48 const inspectConfig = {
49 infoTypes: [
50 {name: 'EMAIL_ADDRESS'},
51 {name: 'PERSON_NAME'},
52 {name: 'LOCATION'},
53 {name: 'PHONE_NUMBER'},
54 ],
55 includeQuote: true,
56 minLikelihood: DLP.protos.google.privacy.dlp.v2.Likelihood.LIKELY,
57 excludeInfoTypes: false,
58 };
59
60 // Combine configurations into a request for the service.
61 const request = {
62 parent: `projects/${projectId}/locations/global`,
63 inspectJob: inspectJob,
64 inspectConfig: inspectConfig,
65 };
66
67 // Send the request and receive response from the service
68 const [response] = await dlp.createDlpJob(request);
69 // Print the results
70 console.log(`Job created successfully: ${response.name}`);
71 }
72
73 jobsCreate();
74 // [END dlp_create_job]

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected