| 52 | }); |
| 53 | // Helper function for creating test jobs |
| 54 | const createTestJob = async () => { |
| 55 | // Initialize client library |
| 56 | const DLP = require('@google-cloud/dlp').v2; |
| 57 | const dlp = new DLP.DlpServiceClient(); |
| 58 | |
| 59 | // Construct job request |
| 60 | const request = { |
| 61 | parent: `projects/${projectId}/locations/global`, |
| 62 | riskJob: { |
| 63 | privacyMetric: { |
| 64 | categoricalStatsConfig: { |
| 65 | field: { |
| 66 | name: testColumnName, |
| 67 | }, |
| 68 | }, |
| 69 | }, |
| 70 | sourceTable: { |
| 71 | projectId: testTableProjectId, |
| 72 | datasetId: testDatasetId, |
| 73 | tableId: testTableId, |
| 74 | }, |
| 75 | }, |
| 76 | }; |
| 77 | |
| 78 | // Create job |
| 79 | const [response] = await dlp.createDlpJob(request); |
| 80 | return response.name; |
| 81 | }; |
| 82 | |
| 83 | // Create a test job |
| 84 | let testJobName; |