diff --git a/packages/google-privacy-dlp/.gitignore b/packages/google-privacy-dlp/.gitignore index 6b002b948bd..7320a52910d 100644 --- a/packages/google-privacy-dlp/.gitignore +++ b/packages/google-privacy-dlp/.gitignore @@ -8,3 +8,4 @@ system-test/secrets.js system-test/*key.json *.lock package-lock.json +__pycache__/ diff --git a/packages/google-privacy-dlp/.readme-partials.yml b/packages/google-privacy-dlp/.readme-partials.yml new file mode 100644 index 00000000000..99f55366452 --- /dev/null +++ b/packages/google-privacy-dlp/.readme-partials.yml @@ -0,0 +1,4 @@ +introduction: |- + The [Data Loss Prevention API](https://cloud.google.com/dlp/docs/) provides programmatic access to a + powerful detection engine for personally identifiable information and other privacy-sensitive + data in unstructured data streams. diff --git a/packages/google-privacy-dlp/.repo-metadata.json b/packages/google-privacy-dlp/.repo-metadata.json new file mode 100644 index 00000000000..69d476b92c4 --- /dev/null +++ b/packages/google-privacy-dlp/.repo-metadata.json @@ -0,0 +1,13 @@ +{ + "name": "dlp", + "name_pretty": "Cloud Data Loss Prevention", + "product_documentation": "https://cloud.google.com/dlp/docs/", + "client_documentation": "https://cloud.google.com/nodejs/docs/reference/dlp/latest/", + "issue_tracker": "", + "release_level": "beta", + "language": "nodejs", + "repo": "googleapis/nodejs-dlp", + "distribution_name": "@google-cloud/dlp", + "api_id": "dlp.googleapis.com", + "requires_billing": true +} diff --git a/packages/google-privacy-dlp/README.md b/packages/google-privacy-dlp/README.md index d770a63f0db..e159e48cab7 100644 --- a/packages/google-privacy-dlp/README.md +++ b/packages/google-privacy-dlp/README.md @@ -1,19 +1,24 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# [Google Cloud Data Loss Prevention (DLP) API: Node.js Client](https://github.com/googleapis/nodejs-dlp) +# [Cloud Data Loss Prevention: Node.js Client](https://github.com/googleapis/nodejs-dlp) -[![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages) +[![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/dlp.svg)](https://www.npmjs.org/package/@google-cloud/dlp) [![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-dlp/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-dlp) -> Node.js idiomatic client for [Data Loss Prevention (DLP) API][product-docs]. -The [Data Loss Prevention API](https://cloud.google.com/dlp/docs/) provides programmatic access to a powerful detection engine for personally identifiable information and other privacy-sensitive data in unstructured data streams. -* [Data Loss Prevention (DLP) API Node.js Client API Reference][client-docs] +The [Data Loss Prevention API](https://cloud.google.com/dlp/docs/) provides programmatic access to a +powerful detection engine for personally identifiable information and other privacy-sensitive +data in unstructured data streams. + + +* [Cloud Data Loss Prevention Node.js Client API Reference][client-docs] +* [Cloud Data Loss Prevention Documentation][product-docs] * [github.com/googleapis/nodejs-dlp](https://github.com/googleapis/nodejs-dlp) -* [Data Loss Prevention (DLP) API Documentation][product-docs] Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in [Client Libraries Explained][explained]. @@ -22,6 +27,7 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. **Table of contents:** + * [Quickstart](#quickstart) * [Before you begin](#before-you-begin) * [Installing the client library](#installing-the-client-library) @@ -35,97 +41,81 @@ Google APIs Client Libraries, in [Client Libraries Explained][explained]. ### Before you begin -1. Select or create a Cloud Platform project. - - [Go to the projects page][projects] - -1. Enable billing for your project. - - [Enable billing][billing] - -1. Enable the Google Cloud Data Loss Prevention (DLP) API API. - - [Enable the API][enable_api] - +1. [Select or create a Cloud Platform project][projects]. +1. [Enable billing for your project][billing]. +1. [Enable the Cloud Data Loss Prevention API][enable_api]. 1. [Set up authentication with a service account][auth] so you can access the API from your local workstation. -[projects]: https://console.cloud.google.com/project -[billing]: https://support.google.com/cloud/answer/6293499#enable-billing -[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=dlp.googleapis.com -[auth]: https://cloud.google.com/docs/authentication/getting-started - ### Installing the client library - npm install --save @google-cloud/dlp +```bash +npm install @google-cloud/dlp +``` + ### Using the client library ```javascript -// Imports the Google Cloud Data Loss Prevention library -const DLP = require('@google-cloud/dlp'); -// 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, + // Construct request + const request = { + parent: dlp.projectPath(projectId), + inspectConfig: { + infoTypes: infoTypes, + minLikelihood: minLikelihood, + limits: { + maxFindingsPerRequest: maxFindings, + }, + includeQuote: includeQuote, }, - includeQuote: includeQuote, - }, - item: item, -}; - -// Run request -dlp - .inspectContent(request) - .then(response => { - const findings = response[0].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.`); - } - }) - .catch(err => { - console.error(`Error in inspectString: ${err.message || err}`); - }); + 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.`); + } + ``` + + ## Samples Samples are in the [`samples/`](https://github.com/googleapis/nodejs-dlp/tree/master/samples) directory. The samples' `README.md` @@ -133,27 +123,35 @@ has instructions for running the samples. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | +| 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) | | Inspect | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/inspect.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/inspect.js,samples/README.md) | -| Redact | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/redact.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/redact.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) | | 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) | +| Quickstart | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/quickstart.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/quickstart.js,samples/README.md) | +| Redact | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/redact.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/redact.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 + + +The [Cloud Data Loss Prevention Node.js Client API Reference][client-docs] documentation also contains samples. ## Versioning This library follows [Semantic Versioning](http://semver.org/). + + This library is considered to be in **beta**. This means it is expected to be mostly stable while we work toward a general availability release; however, complete stability is not guaranteed. We will address issues and requests against beta libraries with a high priority. + + + More Information: [Google Cloud Platform Launch Stages][launch_stages] [launch_stages]: https://cloud.google.com/terms/launch-stages @@ -170,5 +168,8 @@ 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]: //gstatic.com/cloudssh/images/open-btn.png - +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png +[projects]: https://console.cloud.google.com/project +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing +[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=dlp.googleapis.com +[auth]: https://cloud.google.com/docs/authentication/getting-started \ No newline at end of file diff --git a/packages/google-privacy-dlp/samples/README.md b/packages/google-privacy-dlp/samples/README.md index 9b01bb8b224..1bf5b49d7ce 100644 --- a/packages/google-privacy-dlp/samples/README.md +++ b/packages/google-privacy-dlp/samples/README.md @@ -1,325 +1,190 @@ +[//]: # "This README.md file is auto-generated, all changes to this file will be lost." +[//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# Google Cloud Data Loss Prevention (DLP) API: Node.js Samples +# [Cloud Data Loss Prevention: Node.js Samples](https://github.com/googleapis/nodejs-dlp) [![Open in Cloud Shell][shell_img]][shell_link] -The [Data Loss Prevention API](https://cloud.google.com/dlp/docs/) provides programmatic access to a powerful detection engine for personally identifiable information and other privacy-sensitive data in unstructured data streams. +The [Data Loss Prevention API](https://cloud.google.com/dlp/docs/) provides programmatic access to a +powerful detection engine for personally identifiable information and other privacy-sensitive +data in unstructured data streams. ## Table of Contents * [Before you begin](#before-you-begin) * [Samples](#samples) + * [Deid](#deid) * [Inspect](#inspect) - * [Redact](#redact) + * [Job Management](#job-management) * [Metadata](#metadata) - * [DeID](#deid) + * [Quickstart](#quickstart) + * [Redact](#redact) * [Risk Analysis](#risk-analysis) * [Inspect Templates](#inspect-templates) - * [Job Management](#job-management) * [Job Triggers](#job-triggers) ## Before you begin -Before running the samples, make sure you've followed the steps in the -[Before you begin section](../README.md#before-you-begin) of the client -library's README. +Before running the samples, make sure you've followed the steps outlined in +[Using the client library](https://github.com/googleapis/nodejs-dlp#using-the-client-library). ## Samples + + +### Deid + +View the [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) + +__Usage:__ + + +`node deid.js` + + +----- + + + + ### Inspect -View the [source code][inspect_0_code]. +View the [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/inspect.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/inspect.js,samples/README.md) -__Usage:__ `node inspect.js --help` - -``` -inspect.js - -Commands: - inspect.js string Inspect a string using the Data Loss Prevention API. - inspect.js file Inspects a local text, PNG, or JPEG file using the Data - Loss Prevention API. - inspect.js gcsFile Inspects a text file stored on Google Cloud Storage with - the Data Loss Prevention API, using Pub/Sub for job - notifications. - inspect.js bigquery Inspects a BigQuery table using the Data Loss Prevention - API using Pub/Sub for job notifications. - inspect.js datastore Inspect a Datastore instance using the Data Loss - Prevention API using Pub/Sub for job notifications. - -Options: - --version Show version number [boolean] - -m, --minLikelihood - [string] [choices: "LIKELIHOOD_UNSPECIFIED", "VERY_UNLIKELY", "UNLIKELY", "POSSIBLE", "LIKELY", "VERY_LIKELY"] - [default: "LIKELIHOOD_UNSPECIFIED"] - -c, --callingProjectId [string] [default: ""] - -p, --dataProjectId [string] [default: ""] - -f, --maxFindings [number] [default: 0] - -q, --includeQuote [boolean] [default: true] - -t, --infoTypes [array] [default: ["PHONE_NUMBER","EMAIL_ADDRESS","CREDIT_CARD_NUMBER"]] - -n, --notificationTopic [string] - --help Show help [boolean] - -Examples: - node inspect.js string "My email address is me@somedomain.com" - node inspect.js file resources/test.txt - node inspect.js gcsFile my-bucket my-file.txt my-topic my-subscription - node inspect.js bigquery my-dataset my-table my-topic my-subscription - node inspect.js datastore my-datastore-kind my-topic my-subscription - -For more information, see https://cloud.google.com/dlp/docs. Optional flags are explained at -https://cloud.google.com/dlp/docs/reference/rest/v2/InspectConfig -``` - -[inspect_0_docs]: https://cloud.google.com/dlp/docs -[inspect_0_code]: inspect.js +__Usage:__ -### Redact -View the [source code][redact_1_code]. +`node inspect.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/redact.js,samples/README.md) -__Usage:__ `node redact.js --help` +----- -``` -redact.js -Commands: - redact.js image Redact sensitive data from an image using the Data Loss Prevention API. -Options: - --version Show version number [boolean] - -m, --minLikelihood - [string] [choices: "LIKELIHOOD_UNSPECIFIED", "VERY_UNLIKELY", "UNLIKELY", "POSSIBLE", "LIKELY", "VERY_LIKELY"] - [default: "LIKELIHOOD_UNSPECIFIED"] - -t, --infoTypes [array] [required] - -c, --callingProject [string] [default: ""] - --help Show help [boolean] -Examples: - node redact.js image resources/test.png result.png -t MALE_NAME +### Job Management + +View the [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) + +__Usage:__ + + +`node jobs.js` + + +----- + -For more information, see https://cloud.google.com/dlp/docs. Optional flags are explained at -https://cloud.google.com/dlp/docs/reference/rest/v2/projects.image/redact#ImageRedactionConfig -``` -[redact_1_docs]: https://cloud.google.com/dlp/docs -[redact_1_code]: redact.js ### Metadata -View the [source code][metadata_2_code]. +View the [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) -__Usage:__ `node metadata.js --help` +__Usage:__ -``` -metadata.js -Commands: - metadata.js infoTypes [filter] List the types of sensitive information the DLP API supports. +`node metadata.js` -Options: - --version Show version number [boolean] - -l, --languageCode [string] [default: "en-US"] - --help Show help [boolean] -Examples: - node metadata.js infoTypes "supported_by=INSPECT" +----- -For more information, see https://cloud.google.com/dlp/docs -``` -[metadata_2_docs]: https://cloud.google.com/dlp/docs -[metadata_2_code]: metadata.js -### DeID -View the [source code][deid_3_code]. +### Quickstart -[![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) +View the [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/quickstart.js). -__Usage:__ `node deid.js --help` - -``` -deid.js - -Commands: - deid.js deidMask Deidentify sensitive data in a string by masking it with - a character. - deid.js deidFpe Deidentify sensitive data in a string using Format - Preserving Encryption (FPE). - deid.js reidFpe Reidentify sensitive data in a string using Format - Preserving Encryption (FPE). - deid.js deidDateShift Deidentify dates in a CSV file by pseudorandomly - [dateFields...] shifting them. - -Options: - --version Show version number [boolean] - -c, --callingProjectId [string] [default: ""] - --help Show help [boolean] - -Examples: - node deid.js deidMask "My SSN is 372819127" - node deid.js deidFpe "My SSN is 372819127" - projects/my-project/locations/global/keyrings/my-keyring -s SSN_TOKEN - node deid.js reidFpe "My SSN is SSN_TOKEN(9):#########" - projects/my-project/locations/global/keyrings/my-keyring SSN_TOKEN -a NUMERIC - node deid.js deidDateShift dates.csv dates-shifted.csv 30 30 birth_date register_date [-w - -n projects/my-project/locations/global/keyrings/my-keyring] - -For more information, see https://cloud.google.com/dlp/docs. -``` - -[deid_3_docs]: https://cloud.google.com/dlp/docs -[deid_3_code]: 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/quickstart.js,samples/README.md) -### Risk Analysis +__Usage:__ -View the [source code][risk_4_code]. -[![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) +`node quickstart.js` -__Usage:__ `node risk.js --help` - -``` -risk.js - -Commands: - risk.js numerical Computes risk metrics of a column of numbers in a Google - BigQuery table. - risk.js categorical Computes risk metrics of a column of data in a Google - BigQuery table. - risk.js kAnonymity Computes the k-anonymity of a column set in a Google - [quasiIdColumnNames..] BigQuery table. - risk.js lDiversity Computes the l-diversity of a column set in a Google - BigQuery table. - [quasiIdColumnNames..] - risk.js kMap Computes the k-map risk estimation of a column set in a - [quasiIdColumnNames..] Google BigQuery table. - -Options: - --version Show version number [boolean] - -c, --callingProjectId [string] [default: ""] - -p, --tableProjectId [string] [default: ""] - --help Show help [boolean] - -Examples: - node risk.js numerical nhtsa_traffic_fatalities accident_2015 state_number my-topic my-subscription -p - bigquery-public-data - node risk.js categorical nhtsa_traffic_fatalities accident_2015 state_name my-topic my-subscription -p - bigquery-public-data - node risk.js kAnonymity nhtsa_traffic_fatalities accident_2015 my-topic my-subscription state_number county -p - bigquery-public-data - node risk.js lDiversity nhtsa_traffic_fatalities accident_2015 my-topic my-subscription city state_number county -p - bigquery-public-data - node risk kMap san_francisco bikeshare_trips my-topic my-subscription zip_code -t US_ZIP_5 -p bigquery-public-data - -For more information, see https://cloud.google.com/dlp/docs. -``` - -[risk_4_docs]: https://cloud.google.com/dlp/docs -[risk_4_code]: risk.js -### Inspect Templates +----- -View the [source code][templates_5_code]. -[![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) -__Usage:__ `node templates.js --help` -``` -templates.js +### Redact -Commands: - templates.js create Create a new DLP inspection configuration template. - templates.js list List DLP inspection configuration templates. - templates.js delete Delete the DLP inspection configuration template with the specified name. +View the [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/redact.js). -Options: - --version Show version number [boolean] - -c, --callingProjectId [string] [default: ""] - -p, --tableProjectId [string] [default: ""] - --help Show help [boolean] +[![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/redact.js,samples/README.md) -Examples: - node templates.js create -m VERY_LIKELY -t PERSON_NAME -f 5 -q false -i my-template-id - node templates.js list - node templates.js delete projects/my-project/inspectTemplates/##### +__Usage:__ -For more information, see https://cloud.google.com/dlp/docs. -``` -[templates_5_docs]: https://cloud.google.com/dlp/docs -[templates_5_code]: templates.js +`node redact.js` -### Job Management -View the [source code][jobs_6_code]. +----- -[![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) -__Usage:__ `node jobs.js --help` -``` -jobs.js -Commands: - jobs.js list List Data Loss Prevention API jobs corresponding to a given filter. - jobs.js delete Delete results of a Data Loss Prevention API job. +### Risk Analysis + +View the [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) + +__Usage:__ + + +`node risk.js` -Options: - --version Show version number [boolean] - -c, --callingProject [string] [default: ""] - --help Show help [boolean] -Examples: - node jobs.js list "state=DONE" -t RISK_ANALYSIS_JOB - node jobs.js delete projects/YOUR_GCLOUD_PROJECT/dlpJobs/X-##### +----- + + + + +### Inspect Templates + +View the [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) + +__Usage:__ + + +`node templates.js` + + +----- + -For more information, see https://cloud.google.com/dlp/docs. -``` -[jobs_6_docs]: https://cloud.google.com/dlp/docs -[jobs_6_code]: jobs.js ### Job Triggers -View the [source code][triggers_7_code]. +View the [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) -__Usage:__ `node triggers.js --help` +__Usage:__ + -``` -triggers.js +`node triggers.js` -Commands: - triggers.js create Create a Data Loss Prevention API job trigger. - triggers.js list List Data Loss Prevention API job triggers. - triggers.js delete Delete a Data Loss Prevention API job trigger. -Options: - --version Show version number [boolean] - -c, --callingProjectId [string] [default: ""] - --help Show help [boolean] -Examples: - node triggers.js create my-bucket 1 - node triggers.js list - node triggers.js delete projects/my-project/jobTriggers/my-trigger -For more information, see https://cloud.google.com/dlp/docs. -``` -[triggers_7_docs]: https://cloud.google.com/dlp/docs -[triggers_7_code]: triggers.js -[shell_img]: //gstatic.com/cloudssh/images/open-btn.png +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png [shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/README.md +[product-docs]: https://cloud.google.com/dlp/docs/ \ No newline at end of file diff --git a/packages/google-privacy-dlp/samples/quickstart.js b/packages/google-privacy-dlp/samples/quickstart.js index 70acd37ab7a..d5f2e9c86d3 100644 --- a/packages/google-privacy-dlp/samples/quickstart.js +++ b/packages/google-privacy-dlp/samples/quickstart.js @@ -15,11 +15,12 @@ 'use strict'; -// [START dlp_quickstart] // Imports the Google Cloud Data Loss Prevention library const DLP = require('@google-cloud/dlp'); async function quickStart() { + // [START dlp_quickstart] + // Instantiates a client const dlp = new DLP.DlpServiceClient(); @@ -73,8 +74,8 @@ async function quickStart() { } else { console.log(`No findings.`); } + // [END dlp_quickstart] } quickStart().catch(err => { console.error(`Error in inspectString: ${err.message || err}`); }); -// [END dlp_quickstart] diff --git a/packages/google-privacy-dlp/synth.metadata b/packages/google-privacy-dlp/synth.metadata index 370e5a07f9a..cb040f895de 100644 --- a/packages/google-privacy-dlp/synth.metadata +++ b/packages/google-privacy-dlp/synth.metadata @@ -1,26 +1,26 @@ { - "updateTime": "2019-05-21T11:14:26.708474Z", + "updateTime": "2019-05-28T14:39:35.317121Z", "sources": [ { "generator": { "name": "artman", - "version": "0.20.0", - "dockerImage": "googleapis/artman@sha256:3246adac900f4bdbd62920e80de2e5877380e44036b3feae13667ec255ebf5ec" + "version": "0.21.0", + "dockerImage": "googleapis/artman@sha256:28d4271586772b275cd3bc95cb46bd227a24d3c9048de45dccdb7f3afb0bfba9" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "32a10f69e2c9ce15bba13ab1ff928bacebb25160", - "internalRef": "249058354" + "sha": "7ca19138ccebe219a67be2245200e821b3e32123", + "internalRef": "249916728" } }, { "template": { "name": "node_library", "origin": "synthtool.gcp", - "version": "2019.5.2" + "version": "2019.4.10" } } ],