| 61 | // const includeQuote = true; |
| 62 | |
| 63 | async function inspectPhoneNumber() { |
| 64 | // Construct item to inspect |
| 65 | const item = {value: string}; |
| 66 | |
| 67 | // Construct request |
| 68 | const request = { |
| 69 | parent: `projects/${projectId}/locations/global`, |
| 70 | inspectConfig: { |
| 71 | infoTypes: infoTypes, |
| 72 | customInfoTypes: customInfoTypes, |
| 73 | minLikelihood: minLikelihood, |
| 74 | includeQuote: includeQuote, |
| 75 | limits: { |
| 76 | maxFindingsPerRequest: maxFindings, |
| 77 | }, |
| 78 | }, |
| 79 | item: item, |
| 80 | }; |
| 81 | |
| 82 | // Run request |
| 83 | const [response] = await dlp.inspectContent(request); |
| 84 | const findings = response.result.findings; |
| 85 | if (findings.length > 0) { |
| 86 | console.log('Findings:'); |
| 87 | findings.forEach(finding => { |
| 88 | if (includeQuote) { |
| 89 | console.log(`\tQuote: ${finding.quote}`); |
| 90 | } |
| 91 | console.log(`\tInfo type: ${finding.infoType.name}`); |
| 92 | console.log(`\tLikelihood: ${finding.likelihood}`); |
| 93 | }); |
| 94 | } else { |
| 95 | console.log('No findings.'); |
| 96 | } |
| 97 | } |
| 98 | inspectPhoneNumber(); |
| 99 | // [END dlp_inspect_phone_number] |
| 100 | } |