Skip to content

Commit 7940741

Browse files
jmdobrylukesneeringer
authored andcommitted
Fix docs and regenerate scaffolding. (#7)
1 parent 852188c commit 7940741

File tree

5 files changed

+100
-63
lines changed

5 files changed

+100
-63
lines changed

packages/google-privacy-dlp/README.md

+23-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
22

3-
# Google Cloud Data Loss Prevention (DLP) API: Node.js Client
3+
# [Google Cloud Data Loss Prevention (DLP) API: Node.js Client](https://github.com/googleapis/nodejs-dlp)
44

55
[![release level](https://img.shields.io/badge/release%20level-beta-yellow.svg?style&#x3D;flat)](https://cloud.google.com/terms/launch-stages)
66
[![CircleCI](https://img.shields.io/circleci/project/github/googleapis/nodejs-dlp.svg?style=flat)](https://circleci.com/gh/googleapis/nodejs-dlp)
@@ -11,7 +11,9 @@
1111
1212
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.
1313

14+
1415
* [Data Loss Prevention (DLP) API Node.js Client API Reference][client-docs]
16+
* [github.com/googleapis/nodejs-dlp](https://github.com/googleapis/nodejs-dlp)
1517
* [Data Loss Prevention (DLP) API Documentation][product-docs]
1618

1719
Read more about the client libraries for Cloud APIs, including the older
@@ -77,35 +79,33 @@ const minLikelihood = 'LIKELIHOOD_UNSPECIFIED';
7779
const maxFindings = 0;
7880

7981
// The infoTypes of information to match
80-
const infoTypes = [
81-
{ name: 'US_MALE_NAME' },
82-
{ name: 'US_FEMALE_NAME' }
83-
];
82+
const infoTypes = [{name: 'US_MALE_NAME'}, {name: 'US_FEMALE_NAME'}];
8483

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

8887
// Construct items to inspect
89-
const items = [{ type: 'text/plain', value: string }];
88+
const items = [{type: 'text/plain', value: string}];
9089

9190
// Construct request
9291
const request = {
9392
inspectConfig: {
9493
infoTypes: infoTypes,
9594
minLikelihood: minLikelihood,
9695
maxFindings: maxFindings,
97-
includeQuote: includeQuote
96+
includeQuote: includeQuote,
9897
},
99-
items: items
98+
items: items,
10099
};
101100

102101
// Run request
103-
dlp.inspectContent(request)
104-
.then((response) => {
102+
dlp
103+
.inspectContent(request)
104+
.then(response => {
105105
const findings = response[0].results[0].findings;
106106
if (findings.length > 0) {
107107
console.log(`Findings:`);
108-
findings.forEach((finding) => {
108+
findings.forEach(finding => {
109109
if (includeQuote) {
110110
console.log(`\tQuote: ${finding.quote}`);
111111
}
@@ -116,23 +116,23 @@ dlp.inspectContent(request)
116116
console.log(`No findings.`);
117117
}
118118
})
119-
.catch((err) => {
119+
.catch(err => {
120120
console.error(`Error in inspectString: ${err.message || err}`);
121121
});
122122
```
123123

124124
## Samples
125125

126-
Samples are in the [`samples/`](https://github.com/googleapis/nodejs-dlp/blob/master/samples) directory. The samples' `README.md`
126+
Samples are in the [`samples/`](https://github.com/googleapis/nodejs-dlp/tree/master/samples) directory. The samples' `README.md`
127127
has instructions for running the samples.
128128

129-
| Sample | Source Code |
130-
| --------------------------- | --------------------------------- |
131-
| Inspect | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/inspect.js) |
132-
| Redact | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/redact.js) |
133-
| Metadata | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/metadata.js) |
134-
| DeID | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/deid.js) |
135-
| Risk Analysis | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/risk.js) |
129+
| Sample | Source Code | Try it |
130+
| --------------------------- | --------------------------------- | ------ |
131+
| 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) |
132+
| 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) |
133+
| 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) |
134+
| 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) |
135+
| 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) |
136136

137137
The [Data Loss Prevention (DLP) API Node.js Client API Reference][client-docs] documentation
138138
also contains samples.
@@ -152,13 +152,14 @@ More Information: [Google Cloud Platform Launch Stages][launch_stages]
152152

153153
## Contributing
154154

155-
Contributions welcome! See the [Contributing Guide](.github/CONTRIBUTING.md).
155+
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-dlp/blob/master/.github/CONTRIBUTING.md).
156156

157157
## License
158158

159159
Apache Version 2.0
160160

161-
See [LICENSE](LICENSE)
161+
See [LICENSE](https://github.com/googleapis/nodejs-dlp/blob/master/LICENSE)
162162

163163
[client-docs]: https://cloud.google.com/nodejs/docs/reference/dlp/latest/
164164
[product-docs]: https://cloud.google.com/dlp/docs/
165+
[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png

packages/google-privacy-dlp/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"protobufjs": "^6.8.0"
5656
},
5757
"devDependencies": {
58-
"@google-cloud/nodejs-repo-tools": "^2.0.11",
58+
"@google-cloud/nodejs-repo-tools": "^2.1.0",
5959
"async": "^2.5.0",
6060
"codecov": "^3.0.0",
6161
"eslint": "^4.9.0",

packages/google-privacy-dlp/samples/README.md

+49-25
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Google Cloud Data Loss Prevention (DLP) API: Node.js Samples
44

5-
[![Build](https://storage.googleapis.com/.svg)]()
5+
[![Open in Cloud Shell][shell_img]][shell_link]
66

77
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.
88

@@ -28,28 +28,33 @@ library's README.
2828

2929
View the [source code][inspect_0_code].
3030

31+
[![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)
32+
3133
__Usage:__ `node inspect.js --help`
3234

3335
```
36+
inspect.js <command>
37+
3438
Commands:
35-
string <string> Inspect a string using the Data Loss Prevention API.
36-
file <filepath> Inspects a local text, PNG, or JPEG file using the Data Loss Prevention API.
37-
gcsFilePromise <bucketName> <fileName> Inspects a text file stored on Google Cloud Storage using the Data Loss
38-
Prevention API and the promise pattern.
39-
gcsFileEvent <bucketName> <fileName> Inspects a text file stored on Google Cloud Storage using the Data Loss
40-
Prevention API and the event-handler pattern.
41-
bigquery <datasetName> <tableName> Inspects a BigQuery table using the Data Loss Prevention API.
42-
datastore <kind> Inspect a Datastore instance using the Data Loss Prevention API.
39+
inspect.js string <string> Inspect a string using the Data Loss Prevention API.
40+
inspect.js file <filepath> Inspects a local text, PNG, or JPEG file using the Data Loss
41+
Prevention API.
42+
inspect.js gcsFilePromise <bucketName> <fileName> Inspects a text file stored on Google Cloud Storage using the Data
43+
Loss Prevention API and the promise pattern.
44+
inspect.js gcsFileEvent <bucketName> <fileName> Inspects a text file stored on Google Cloud Storage using the Data
45+
Loss Prevention API and the event-handler pattern.
46+
inspect.js bigquery <datasetName> <tableName> Inspects a BigQuery table using the Data Loss Prevention API.
47+
inspect.js datastore <kind> Inspect a Datastore instance using the Data Loss Prevention API.
4348
4449
Options:
4550
--version Show version number [boolean]
46-
--help Show help [boolean]
4751
-m, --minLikelihood
4852
[string] [choices: "LIKELIHOOD_UNSPECIFIED", "VERY_UNLIKELY", "UNLIKELY", "POSSIBLE", "LIKELY", "VERY_LIKELY"]
4953
[default: "LIKELIHOOD_UNSPECIFIED"]
5054
-f, --maxFindings [number] [default: 0]
5155
-q, --includeQuote [boolean] [default: true]
5256
-t, --infoTypes [array] [default: ["PHONE_NUMBER","EMAIL_ADDRESS","CREDIT_CARD_NUMBER"]]
57+
--help Show help [boolean]
5358
5459
Examples:
5560
node inspect.js string "My phone number is (123) 456-7890 and my email address is [email protected]"
@@ -70,20 +75,24 @@ https://cloud.google.com/dlp/docs/reference/rest/v2beta1/content/inspect#Inspect
7075

7176
View the [source code][redact_1_code].
7277

78+
[![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)
79+
7380
__Usage:__ `node redact.js --help`
7481

7582
```
83+
redact.js <command>
84+
7685
Commands:
77-
string <string> <replaceString> Redact sensitive data from a string using the Data Loss Prevention API.
78-
image <filepath> <outputPath> Redact sensitive data from an image using the Data Loss Prevention API.
86+
redact.js string <string> <replaceString> Redact sensitive data from a string using the Data Loss Prevention API.
87+
redact.js image <filepath> <outputPath> Redact sensitive data from an image using the Data Loss Prevention API.
7988
8089
Options:
8190
--version Show version number [boolean]
82-
--help Show help [boolean]
83-
-t, --infoTypes [array] [required]
8491
-m, --minLikelihood
8592
[string] [choices: "LIKELIHOOD_UNSPECIFIED", "VERY_UNLIKELY", "UNLIKELY", "POSSIBLE", "LIKELY", "VERY_LIKELY"]
8693
[default: "LIKELIHOOD_UNSPECIFIED"]
94+
-t, --infoTypes [array] [required]
95+
--help Show help [boolean]
8796
8897
Examples:
8998
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
100109

101110
View the [source code][metadata_2_code].
102111

112+
[![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)
113+
103114
__Usage:__ `node metadata.js --help`
104115

105116
```
117+
metadata.js <command>
118+
106119
Commands:
107-
infoTypes <category> List types of sensitive information within a category.
108-
categories List root categories of sensitive information.
120+
metadata.js infoTypes <category> List types of sensitive information within a category.
121+
metadata.js categories List root categories of sensitive information.
109122
110123
Options:
111124
--version Show version number [boolean]
112-
--help Show help [boolean]
113125
-l, --languageCode [string] [default: "en-US"]
126+
--help Show help [boolean]
114127
115128
Examples:
116129
node metadata.js infoTypes GOVERNMENT
@@ -126,12 +139,16 @@ For more information, see https://cloud.google.com/dlp/docs
126139

127140
View the [source code][deid_3_code].
128141

142+
[![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)
143+
129144
__Usage:__ `node deid.js --help`
130145

131146
```
147+
deid.js <command>
148+
132149
Commands:
133-
mask <string> Deidentify sensitive data by masking it with a character.
134-
fpe <string> <wrappedKey> <keyName> Deidentify sensitive data using Format Preserving Encryption (FPE).
150+
deid.js mask <string> Deidentify sensitive data by masking it with a character.
151+
deid.js fpe <string> <wrappedKey> <keyName> Deidentify sensitive data using Format Preserving Encryption (FPE).
135152
136153
Options:
137154
--version Show version number [boolean]
@@ -151,23 +168,27 @@ For more information, see https://cloud.google.com/dlp/docs.
151168

152169
View the [source code][risk_4_code].
153170

171+
[![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)
172+
154173
__Usage:__ `node risk.js --help`
155174

156175
```
176+
risk.js <command>
177+
157178
Commands:
158-
numerical <datasetId> <tableId> <columnName> Computes risk metrics of a column of numbers in a Google
159-
BigQuery table.
160-
categorical <datasetId> <tableId> <columnName> Computes risk metrics of a column of data in a Google
179+
risk.js numerical <datasetId> <tableId> <columnName> Computes risk metrics of a column of numbers in a Google
161180
BigQuery table.
162-
kAnonymity <datasetId> <tableId> [quasiIdColumnNames..] Computes the k-anonymity of a column set in a Google
181+
risk.js categorical <datasetId> <tableId> <columnName> Computes risk metrics of a column of data in a Google
163182
BigQuery table.
164-
lDiversity <datasetId> <tableId> <sensitiveAttribute> Computes the l-diversity of a column set in a Google
183+
risk.js kAnonymity <datasetId> <tableId> Computes the k-anonymity of a column set in a Google
165184
[quasiIdColumnNames..] BigQuery table.
185+
risk.js lDiversity <datasetId> <tableId> Computes the l-diversity of a column set in a Google
186+
<sensitiveAttribute> [quasiIdColumnNames..] BigQuery table.
166187
167188
Options:
168189
--version Show version number [boolean]
169-
--help Show help [boolean]
170190
-p, --projectId [string]
191+
--help Show help [boolean]
171192
172193
Examples:
173194
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.
180201

181202
[risk_4_docs]: https://cloud.google.com/dlp/docs
182203
[risk_4_code]: risk.js
204+
205+
[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png
206+
[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

packages/google-privacy-dlp/samples/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
"author": "Google Inc.",
88
"repository": "googleapis/nodejs-dlp",
99
"engines": {
10-
"node": ">=4.3.2"
10+
"node": ">=4.0.0"
1111
},
1212
"scripts": {
13-
"test": "samples test run --cmd ava -- -T 1m --verbose system-test/*.test.js"
13+
"test": "repo-tools test run --cmd ava -- -T 1m --verbose system-test/*.test.js"
1414
},
1515
"dependencies": {
1616
"@google-cloud/bigquery": "^0.10.0",

packages/google-privacy-dlp/src/index.js

+25-13
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,29 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
/*!
16+
* DO NOT DELETE THE FOLLOWING NAMESPACE DEFINITIONS
17+
*/
1518
/**
1619
* @namespace google
1720
*/
1821
/**
19-
* @namespace google.cloud
22+
* @namespace google.privacy
23+
*/
24+
/**
25+
* @namespace google.privacy.dlp
26+
*/
27+
/**
28+
* @namespace google.privacy.dlp.v2beta1
29+
*/
30+
/**
31+
* @namespace google.protobuf
2032
*/
2133
/**
22-
* @namespace google.cloud.dlp
34+
* @namespace google.rpc
2335
*/
2436
/**
25-
* @namespace google.cloud.dlp.v2beta1
37+
* @namespace google.type
2638
*/
2739

2840
'use strict';
@@ -45,24 +57,24 @@ const gapic = Object.freeze({
4557
* @module {object} @google-cloud/dlp
4658
* @alias nodejs-dlp
4759
*
48-
* @example <caption>Install the client library with
49-
* <a href="https://www.npmjs.com/">npm</a>:</caption>
60+
* @example <caption>Install the client library with <a href="https://www.npmjs.com/">npm</a>:</caption>
5061
* npm install --save @google-cloud/dlp
5162
*
5263
* @example <caption>Import the client library:</caption>
53-
* const dlp = require('@google-cloud/dlp');
64+
* const DLP = require('@google-cloud/dlp');
5465
*
55-
* @example <caption>Create a client that uses
56-
* <a href="https://goo.gl/64dyYX">Application Default Credentials
57-
* (ADC)</a>:</caption>
58-
* let client = new dlp.DlpServiceClient();
66+
* @example <caption>Create a client that uses <a href="https://goo.gl/64dyYX">Application Default Credentials (ADC)</a>:</caption>
67+
* const client = new DLP.DlpServiceClient();
5968
*
60-
* @example <caption>Create a client with
61-
* <a href="https://goo.gl/RXp6VL">explicit credentials</a>:</caption>
62-
* let client = new dlp.DlpServiceClient({
69+
* @example <caption>Create a client with <a href="https://goo.gl/RXp6VL">explicit credentials</a>:</caption>
70+
* const client = new DLP.DlpServiceClient({
6371
* projectId: 'your-project-id',
6472
* keyFilename: '/path/to/keyfile.json',
6573
* });
74+
*
75+
* @example <caption>include:samples/quickstart.js</caption>
76+
* region_tag:quickstart
77+
* Full quickstart example:
6678
*/
6779

6880
/**

0 commit comments

Comments
 (0)