| 43 | }; |
| 44 | |
| 45 | async function inspectTable() { |
| 46 | // Specify the table to be inspected. |
| 47 | const item = { |
| 48 | table: tableData, |
| 49 | }; |
| 50 | |
| 51 | // Construct the configuration for the Inspect request. |
| 52 | const inspectConfig = { |
| 53 | infoTypes: infoTypes, |
| 54 | includeQuote: true, |
| 55 | }; |
| 56 | |
| 57 | // Construct the Inspect request to be sent by the client. |
| 58 | const request = { |
| 59 | parent: `projects/${projectId}/locations/global`, |
| 60 | inspectConfig: inspectConfig, |
| 61 | item: item, |
| 62 | }; |
| 63 | |
| 64 | // Use the client to send the API request. |
| 65 | const [response] = await dlp.inspectContent(request); |
| 66 | |
| 67 | // Print findings. |
| 68 | const findings = response.result.findings; |
| 69 | if (findings.length > 0) { |
| 70 | console.log(`Findings: ${findings.length}\n`); |
| 71 | findings.forEach(finding => { |
| 72 | console.log(`InfoType: ${finding.infoType.name}`); |
| 73 | console.log(`\tQuote: ${finding.quote}`); |
| 74 | console.log(`\tLikelihood: ${finding.likelihood} \n`); |
| 75 | }); |
| 76 | } else { |
| 77 | console.log('No findings.'); |
| 78 | } |
| 79 | } |
| 80 | inspectTable(); |
| 81 | // [END dlp_inspect_table] |
| 82 | } |