diff --git a/packages/google-privacy-dlp/README.md b/packages/google-privacy-dlp/README.md
index 88cd2ddb636..d5a139c881e 100644
--- a/packages/google-privacy-dlp/README.md
+++ b/packages/google-privacy-dlp/README.md
@@ -1,6 +1,6 @@
-# Google Cloud Data Loss Prevention (DLP) API: Node.js Client
+# [Google Cloud Data Loss Prevention (DLP) API: Node.js Client](https://github.com/googleapis/nodejs-dlp)
[](https://cloud.google.com/terms/launch-stages)
[](https://circleci.com/gh/googleapis/nodejs-dlp)
@@ -11,7 +11,9 @@
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]
+* [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
@@ -77,16 +79,13 @@ const minLikelihood = 'LIKELIHOOD_UNSPECIFIED';
const maxFindings = 0;
// The infoTypes of information to match
-const infoTypes = [
- { name: 'US_MALE_NAME' },
- { name: 'US_FEMALE_NAME' }
-];
+const infoTypes = [{name: 'US_MALE_NAME'}, {name: 'US_FEMALE_NAME'}];
// Whether to include the matching string
const includeQuote = true;
// Construct items to inspect
-const items = [{ type: 'text/plain', value: string }];
+const items = [{type: 'text/plain', value: string}];
// Construct request
const request = {
@@ -94,18 +93,19 @@ const request = {
infoTypes: infoTypes,
minLikelihood: minLikelihood,
maxFindings: maxFindings,
- includeQuote: includeQuote
+ includeQuote: includeQuote,
},
- items: items
+ items: items,
};
// Run request
-dlp.inspectContent(request)
- .then((response) => {
+dlp
+ .inspectContent(request)
+ .then(response => {
const findings = response[0].results[0].findings;
if (findings.length > 0) {
console.log(`Findings:`);
- findings.forEach((finding) => {
+ findings.forEach(finding => {
if (includeQuote) {
console.log(`\tQuote: ${finding.quote}`);
}
@@ -116,23 +116,23 @@ dlp.inspectContent(request)
console.log(`No findings.`);
}
})
- .catch((err) => {
+ .catch(err => {
console.error(`Error in inspectString: ${err.message || err}`);
});
```
## Samples
-Samples are in the [`samples/`](https://github.com/googleapis/nodejs-dlp/blob/master/samples) directory. The samples' `README.md`
+Samples are in the [`samples/`](https://github.com/googleapis/nodejs-dlp/tree/master/samples) directory. The samples' `README.md`
has instructions for running the samples.
-| Sample | Source Code |
-| --------------------------- | --------------------------------- |
-| Inspect | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/inspect.js) |
-| Redact | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/redact.js) |
-| Metadata | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/metadata.js) |
-| DeID | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/deid.js) |
-| Risk Analysis | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/risk.js) |
+| Sample | Source Code | Try it |
+| --------------------------- | --------------------------------- | ------ |
+| 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) |
+| 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) |
The [Data Loss Prevention (DLP) API Node.js Client API Reference][client-docs] documentation
also contains samples.
@@ -152,13 +152,14 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages]
## Contributing
-Contributions welcome! See the [Contributing Guide](.github/CONTRIBUTING.md).
+Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-dlp/blob/master/.github/CONTRIBUTING.md).
## License
Apache Version 2.0
-See [LICENSE](LICENSE)
+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
diff --git a/packages/google-privacy-dlp/package.json b/packages/google-privacy-dlp/package.json
index 68b7beb048f..20e5a73a0f0 100644
--- a/packages/google-privacy-dlp/package.json
+++ b/packages/google-privacy-dlp/package.json
@@ -55,7 +55,7 @@
"protobufjs": "^6.8.0"
},
"devDependencies": {
- "@google-cloud/nodejs-repo-tools": "^2.0.11",
+ "@google-cloud/nodejs-repo-tools": "^2.1.0",
"async": "^2.5.0",
"codecov": "^3.0.0",
"eslint": "^4.9.0",
diff --git a/packages/google-privacy-dlp/samples/README.md b/packages/google-privacy-dlp/samples/README.md
index 191fea0851b..b302767e0b7 100644
--- a/packages/google-privacy-dlp/samples/README.md
+++ b/packages/google-privacy-dlp/samples/README.md
@@ -2,7 +2,7 @@
# Google Cloud Data Loss Prevention (DLP) API: Node.js Samples
-[]()
+[![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.
@@ -28,28 +28,33 @@ library's README.
View the [source code][inspect_0_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/inspect.js,samples/README.md)
+
__Usage:__ `node inspect.js --help`
```
+inspect.js
+
Commands:
- string Inspect a string using the Data Loss Prevention API.
- file Inspects a local text, PNG, or JPEG file using the Data Loss Prevention API.
- gcsFilePromise Inspects a text file stored on Google Cloud Storage using the Data Loss
- Prevention API and the promise pattern.
- gcsFileEvent Inspects a text file stored on Google Cloud Storage using the Data Loss
- Prevention API and the event-handler pattern.
- bigquery Inspects a BigQuery table using the Data Loss Prevention API.
- datastore Inspect a Datastore instance using the Data Loss Prevention API.
+ 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 gcsFilePromise Inspects a text file stored on Google Cloud Storage using the Data
+ Loss Prevention API and the promise pattern.
+ inspect.js gcsFileEvent Inspects a text file stored on Google Cloud Storage using the Data
+ Loss Prevention API and the event-handler pattern.
+ inspect.js bigquery Inspects a BigQuery table using the Data Loss Prevention API.
+ inspect.js datastore Inspect a Datastore instance using the Data Loss Prevention API.
Options:
--version Show version number [boolean]
- --help Show help [boolean]
-m, --minLikelihood
[string] [choices: "LIKELIHOOD_UNSPECIFIED", "VERY_UNLIKELY", "UNLIKELY", "POSSIBLE", "LIKELY", "VERY_LIKELY"]
[default: "LIKELIHOOD_UNSPECIFIED"]
-f, --maxFindings [number] [default: 0]
-q, --includeQuote [boolean] [default: true]
-t, --infoTypes [array] [default: ["PHONE_NUMBER","EMAIL_ADDRESS","CREDIT_CARD_NUMBER"]]
+ --help Show help [boolean]
Examples:
node inspect.js string "My phone number is (123) 456-7890 and my email address is me@somedomain.com"
@@ -70,20 +75,24 @@ https://cloud.google.com/dlp/docs/reference/rest/v2beta1/content/inspect#Inspect
View the [source code][redact_1_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/redact.js,samples/README.md)
+
__Usage:__ `node redact.js --help`
```
+redact.js
+
Commands:
- string Redact sensitive data from a string using the Data Loss Prevention API.
- image Redact sensitive data from an image using the Data Loss Prevention API.
+ redact.js string Redact sensitive data from a string using the Data Loss Prevention API.
+ redact.js image Redact sensitive data from an image using the Data Loss Prevention API.
Options:
--version Show version number [boolean]
- --help Show help [boolean]
- -t, --infoTypes [array] [required]
-m, --minLikelihood
[string] [choices: "LIKELIHOOD_UNSPECIFIED", "VERY_UNLIKELY", "UNLIKELY", "POSSIBLE", "LIKELY", "VERY_LIKELY"]
[default: "LIKELIHOOD_UNSPECIFIED"]
+ -t, --infoTypes [array] [required]
+ --help Show help [boolean]
Examples:
node redact.js string "My name is Gary" "REDACTED" -t US_MALE_NAME
@@ -100,17 +109,21 @@ https://cloud.google.com/dlp/docs/reference/rest/v2beta1/content/inspect#Inspect
View the [source code][metadata_2_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/metadata.js,samples/README.md)
+
__Usage:__ `node metadata.js --help`
```
+metadata.js
+
Commands:
- infoTypes List types of sensitive information within a category.
- categories List root categories of sensitive information.
+ metadata.js infoTypes List types of sensitive information within a category.
+ metadata.js categories List root categories of sensitive information.
Options:
--version Show version number [boolean]
- --help Show help [boolean]
-l, --languageCode [string] [default: "en-US"]
+ --help Show help [boolean]
Examples:
node metadata.js infoTypes GOVERNMENT
@@ -126,12 +139,16 @@ For more information, see https://cloud.google.com/dlp/docs
View the [source code][deid_3_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/deid.js,samples/README.md)
+
__Usage:__ `node deid.js --help`
```
+deid.js
+
Commands:
- mask Deidentify sensitive data by masking it with a character.
- fpe Deidentify sensitive data using Format Preserving Encryption (FPE).
+ deid.js mask Deidentify sensitive data by masking it with a character.
+ deid.js fpe Deidentify sensitive data using Format Preserving Encryption (FPE).
Options:
--version Show version number [boolean]
@@ -151,23 +168,27 @@ For more information, see https://cloud.google.com/dlp/docs.
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)
+
__Usage:__ `node risk.js --help`
```
+risk.js
+
Commands:
- numerical Computes risk metrics of a column of numbers in a Google
- BigQuery table.
- categorical Computes risk metrics of a column of data in a Google
+ risk.js numerical Computes risk metrics of a column of numbers in a Google
BigQuery table.
- kAnonymity [quasiIdColumnNames..] Computes the k-anonymity of a column set in a Google
+ risk.js categorical Computes risk metrics of a column of data in a Google
BigQuery table.
- lDiversity Computes the l-diversity of a column set in a Google
+ 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
+ [quasiIdColumnNames..] BigQuery table.
Options:
--version Show version number [boolean]
- --help Show help [boolean]
-p, --projectId [string]
+ --help Show help [boolean]
Examples:
node risk.js numerical nhtsa_traffic_fatalities accident_2015 state_number -p bigquery-public-data
@@ -180,3 +201,6 @@ For more information, see https://cloud.google.com/dlp/docs.
[risk_4_docs]: https://cloud.google.com/dlp/docs
[risk_4_code]: risk.js
+
+[shell_img]: http://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
diff --git a/packages/google-privacy-dlp/samples/package.json b/packages/google-privacy-dlp/samples/package.json
index c466aa4e4c3..f80208af63f 100644
--- a/packages/google-privacy-dlp/samples/package.json
+++ b/packages/google-privacy-dlp/samples/package.json
@@ -7,10 +7,10 @@
"author": "Google Inc.",
"repository": "googleapis/nodejs-dlp",
"engines": {
- "node": ">=4.3.2"
+ "node": ">=4.0.0"
},
"scripts": {
- "test": "samples test run --cmd ava -- -T 1m --verbose system-test/*.test.js"
+ "test": "repo-tools test run --cmd ava -- -T 1m --verbose system-test/*.test.js"
},
"dependencies": {
"@google-cloud/bigquery": "^0.10.0",
diff --git a/packages/google-privacy-dlp/src/index.js b/packages/google-privacy-dlp/src/index.js
index f40030d9769..b8fbe737be9 100644
--- a/packages/google-privacy-dlp/src/index.js
+++ b/packages/google-privacy-dlp/src/index.js
@@ -12,17 +12,29 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+/*!
+ * DO NOT DELETE THE FOLLOWING NAMESPACE DEFINITIONS
+ */
/**
* @namespace google
*/
/**
- * @namespace google.cloud
+ * @namespace google.privacy
+ */
+/**
+ * @namespace google.privacy.dlp
+ */
+/**
+ * @namespace google.privacy.dlp.v2beta1
+ */
+/**
+ * @namespace google.protobuf
*/
/**
- * @namespace google.cloud.dlp
+ * @namespace google.rpc
*/
/**
- * @namespace google.cloud.dlp.v2beta1
+ * @namespace google.type
*/
'use strict';
@@ -45,24 +57,24 @@ const gapic = Object.freeze({
* @module {object} @google-cloud/dlp
* @alias nodejs-dlp
*
- * @example Install the client library with
- * npm:
+ * @example Install the client library with npm:
* npm install --save @google-cloud/dlp
*
* @example Import the client library:
- * const dlp = require('@google-cloud/dlp');
+ * const DLP = require('@google-cloud/dlp');
*
- * @example Create a client that uses
- * Application Default Credentials
- * (ADC):
- * let client = new dlp.DlpServiceClient();
+ * @example Create a client that uses Application Default Credentials (ADC):
+ * const client = new DLP.DlpServiceClient();
*
- * @example Create a client with
- * explicit credentials:
- * let client = new dlp.DlpServiceClient({
+ * @example Create a client with explicit credentials:
+ * const client = new DLP.DlpServiceClient({
* projectId: 'your-project-id',
* keyFilename: '/path/to/keyfile.json',
* });
+ *
+ * @example include:samples/quickstart.js
+ * region_tag:quickstart
+ * Full quickstart example:
*/
/**