Skip to content

Commit

Permalink
GAPIC v2 code, release 0.3.0 (#23)
Browse files Browse the repository at this point in the history
* generated GAPIC v2 code

* lint and prettier

* WIP: update samples

* Upgrade samples + tests

* Fix lint errors + add dateshiftconfig sample

* Remove extraneous triggers field

* Add descriptions to triggers + add missing result file

* s/projectId/callingProject/ + remove project id from deleteJob

* Add templateId + displayName to templates.js

* Remove includeQuote + use dataProjectId

* IMPORTANT: properly process multiple buckets

* IMPORTANT: properly process multiple buckets, pt 2

* Minor tweaks to deid

* Remove inspectconfig-specific print statements

* (Almost-)final draft of Node.js DLP samples

* Regenerate README

* Fix nits

* Move require statements to the top of functions

* Nit: fix comment

* Fix incorrect limit syntax in quickstart

* Clarify that filter parameter is not entirely optional

* Add missing README sections

* Only ack pubsub messages with the desired contents

* Update redact images

* Missed a spot :(

* regenerated v2 GAPIC code, fixed samples and system tests

* get rid of unused response variables

* unskipping some samples test that actually work

* fixing bigquery tests

* Finishing touches - add delay to DlpJob retrieval + make DlpJob tests parallel

* prettier
  • Loading branch information
alexander-fenster committed Mar 15, 2018
1 parent e31474f commit 33a3852
Show file tree
Hide file tree
Showing 29 changed files with 12,171 additions and 133 deletions.
25 changes: 21 additions & 4 deletions packages/google-privacy-dlp/.cloud-repo-tools.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"requiresKeyFile": true,
"requiresProjectId": true,
"requiredEnvVars": [
"DLP_DEID_WRAPPED_KEY",
"DLP_DEID_KEY_NAME"
],
"product": "dlp",
"client_reference_url": "https://cloud.google.com/nodejs/docs/reference/dlp/latest/",
"release_quality": "beta",
Expand Down Expand Up @@ -43,6 +39,27 @@
"file": "risk.js",
"docs_link": "https://cloud.google.com/dlp/docs",
"usage": "node risk.js --help"
},
{
"id": "templates",
"name": "Inspect Templates",
"file": "templates.js",
"docs_link": "https://cloud.google.com/dlp/docs",
"usage": "node templates.js --help"
},
{
"id": "jobs",
"name": "Job Management",
"file": "jobs.js",
"docs_link": "https://cloud.google.com/dlp/docs",
"usage": "node jobs.js --help"
},
{
"id": "triggers",
"name": "Job Triggers",
"file": "triggers.js",
"docs_link": "https://cloud.google.com/dlp/docs",
"usage": "node triggers.js --help"
}
]
}
1 change: 0 additions & 1 deletion packages/google-privacy-dlp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ out/
system-test/secrets.js
system-test/*key.json
*.lock
*-lock.js*
1 change: 1 addition & 0 deletions packages/google-privacy-dlp/.mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Jason Dobry <jdobry@google.com> Jason Dobry <jmdobry@users.noreply.github.com>
Luke Sneeringer <lukesneeringer@google.com> Luke Sneeringer <luke@sneeringer.com>
Stephen Sawchuk <sawchuk@gmail.com> Stephen Sawchuk <stephenplusplus@users.noreply.github.com>
Stephen Sawchuk <sawchuk@gmail.com> Stephen Sawchuk <stephenplusplusplus@gmail.com>
Alexander Fenster <fenster@google.com> Alexander Fenster <github@fenster.name>
2 changes: 1 addition & 1 deletion packages/google-privacy-dlp/CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Ace Nassri <anassri@google.com>
Alexander Fenster <fenster@google.com>
Ernest Landrito <landrito@google.com>
Evawere Ogbe <eoogbe@gmail.com>
Google API Publisher <googleapis-publisher@google.com>
Jason Dobry <jdobry@google.com>
Luke Sneeringer <lukesneeringer@google.com>
Song Wang <songwang@google.com>
Stephen <stephenplusplus@users.noreply.github.com>
Stephen Sawchuk <sawchuk@gmail.com>
Tim Swast <swast@google.com>
greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>
23 changes: 16 additions & 7 deletions packages/google-privacy-dlp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,37 +72,43 @@ const dlp = new DLP.DlpServiceClient();
// The string to inspect
const string = 'Robert Frost';

// 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 maximum number of findings to report (0 = server maximum)
const maxFindings = 0;

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

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

// Construct items to inspect
const items = [{type: 'text/plain', value: string}];
// Construct item to inspect
const item = {value: string};

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

// Run request
dlp
.inspectContent(request)
.then(response => {
const findings = response[0].results[0].findings;
const findings = response[0].result.findings;
if (findings.length > 0) {
console.log(`Findings:`);
findings.forEach(finding => {
Expand Down Expand Up @@ -133,6 +139,9 @@ has instructions for running the samples.
| Metadata | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/metadata.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/metadata.js,samples/README.md) |
| DeID | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/deid.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/deid.js,samples/README.md) |
| Risk Analysis | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/risk.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/risk.js,samples/README.md) |
| Inspect Templates | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/templates.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/templates.js,samples/README.md) |
| Job Management | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/jobs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/jobs.js,samples/README.md) |
| Job Triggers | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/triggers.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/triggers.js,samples/README.md) |

The [Data Loss Prevention (DLP) API Node.js Client API Reference][client-docs] documentation
also contains samples.
Expand Down Expand Up @@ -162,4 +171,4 @@ See [LICENSE](https://github.com/googleapis/nodejs-dlp/blob/master/LICENSE)

[client-docs]: https://cloud.google.com/nodejs/docs/reference/dlp/latest/
[product-docs]: https://cloud.google.com/dlp/docs/
[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
[shell_img]: //gstatic.com/cloudssh/images/open-btn.png
6 changes: 3 additions & 3 deletions packages/google-privacy-dlp/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@google-cloud/dlp",
"description": "DLP API client for Node.js",
"version": "0.2.0",
"version": "0.3.0",
"license": "Apache-2.0",
"author": "Google Inc",
"engines": {
Expand Down Expand Up @@ -33,13 +33,13 @@
"Alexander Fenster <fenster@google.com>",
"Ernest Landrito <landrito@google.com>",
"Evawere Ogbe <eoogbe@gmail.com>",
"Google API Publisher <googleapis-publisher@google.com>",
"Jason Dobry <jdobry@google.com>",
"Luke Sneeringer <lukesneeringer@google.com>",
"Song Wang <songwang@google.com>",
"Stephen <stephenplusplus@users.noreply.github.com>",
"Stephen Sawchuk <sawchuk@gmail.com>",
"Tim Swast <swast@google.com>"
"Tim Swast <swast@google.com>",
"greenkeeper[bot] <greenkeeper[bot]@users.noreply.github.com>"
],
"scripts": {
"cover": "nyc --reporter=lcov mocha --require intelli-espower-loader test/*.js && nyc report",
Expand Down
Loading

0 comments on commit 33a3852

Please sign in to comment.