Skip to content

Commit

Permalink
chore: remove snippet leading whitespace (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
chingor13 authored Mar 19, 2020
1 parent 0eabab3 commit 4167810
Showing 1 changed file with 44 additions and 44 deletions.
88 changes: 44 additions & 44 deletions packages/google-privacy-dlp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,59 +58,59 @@ npm install @google-cloud/dlp

```javascript

// Instantiates a client
const dlp = new DLP.DlpServiceClient();
// Instantiates a client
const dlp = new DLP.DlpServiceClient();

// The string to inspect
const string = 'Robert Frost';
// The string to inspect
const string = 'Robert Frost';

// The project ID to run the API call under
const projectId = process.env.GCLOUD_PROJECT;
// The project ID to run the API call under
const projectId = process.env.GCLOUD_PROJECT;

// The minimum likelihood required before returning a match
const minLikelihood = 'LIKELIHOOD_UNSPECIFIED';
// The minimum likelihood required before returning a match
const minLikelihood = 'LIKELIHOOD_UNSPECIFIED';

// The maximum number of findings to report (0 = server maximum)
const maxFindings = 0;
// The maximum number of findings to report (0 = server maximum)
const maxFindings = 0;

// The infoTypes of information to match
const infoTypes = [{name: 'PERSON_NAME'}, {name: 'US_STATE'}];
// The infoTypes of information to match
const infoTypes = [{name: 'PERSON_NAME'}, {name: 'US_STATE'}];

// Whether to include the matching string
const includeQuote = true;
// Whether to include the matching string
const includeQuote = true;

// Construct item to inspect
const item = {value: string};
// Construct item to inspect
const item = {value: string};

// Construct request
const request = {
parent: dlp.projectPath(projectId),
inspectConfig: {
infoTypes: infoTypes,
minLikelihood: minLikelihood,
limits: {
maxFindingsPerRequest: maxFindings,
},
includeQuote: includeQuote,
// Construct request
const request = {
parent: dlp.projectPath(projectId),
inspectConfig: {
infoTypes: infoTypes,
minLikelihood: minLikelihood,
limits: {
maxFindingsPerRequest: maxFindings,
},
item: item,
};

// Run request
const [response] = await dlp.inspectContent(request);
const findings = response.result.findings;
if (findings.length > 0) {
console.log(`Findings:`);
findings.forEach(finding => {
if (includeQuote) {
console.log(`\tQuote: ${finding.quote}`);
}
console.log(`\tInfo type: ${finding.infoType.name}`);
console.log(`\tLikelihood: ${finding.likelihood}`);
});
} else {
console.log(`No findings.`);
}
includeQuote: includeQuote,
},
item: item,
};

// Run request
const [response] = await dlp.inspectContent(request);
const findings = response.result.findings;
if (findings.length > 0) {
console.log(`Findings:`);
findings.forEach(finding => {
if (includeQuote) {
console.log(`\tQuote: ${finding.quote}`);
}
console.log(`\tInfo type: ${finding.infoType.name}`);
console.log(`\tLikelihood: ${finding.likelihood}`);
});
} else {
console.log(`No findings.`);
}

```

Expand Down

0 comments on commit 4167810

Please sign in to comment.