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