Skip to content

Commit 613c469

Browse files
feat: add synth script and regenerate (#70)
1 parent 1a382cd commit 613c469

File tree

9 files changed

+1140
-304
lines changed

9 files changed

+1140
-304
lines changed

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

+330-159
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/google-privacy-dlp/package.json

+2-4
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@
5353
"test": "npm run cover"
5454
},
5555
"dependencies": {
56-
"google-gax": "^0.16.0",
56+
"google-gax": "^0.17.1",
5757
"lodash.merge": "^4.6.0",
5858
"protobufjs": "^6.8.0"
5959
},
6060
"devDependencies": {
6161
"@google-cloud/nodejs-repo-tools": "^2.3.0",
62-
"async": "^2.5.0",
6362
"codecov": "^3.0.0",
6463
"eslint": "^5.0.0",
6564
"eslint-config-prettier": "^2.6.0",
@@ -71,7 +70,6 @@
7170
"mocha": "^5.0.0",
7271
"nyc": "^12.0.2",
7372
"power-assert": "^1.4.4",
74-
"prettier": "^1.7.4",
75-
"through2": "^2.0.3"
73+
"prettier": "^1.7.4"
7674
}
7775
}

packages/google-privacy-dlp/protos/google/privacy/dlp/v2/dlp.proto

+270-45
Large diffs are not rendered by default.

packages/google-privacy-dlp/protos/google/privacy/dlp/v2/storage.proto

+55-15
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ option php_namespace = "Google\\Cloud\\Dlp\\V2";
2929

3030
// Type of information detected by the API.
3131
message InfoType {
32-
// Name of the information type.
32+
// Name of the information type. Either a name of your choosing when
33+
// creating a CustomInfoType, or one of the names listed
34+
// at https://cloud.google.com/dlp/docs/infotypes-reference when specifying
35+
// a built-in type.
3336
string name = 1;
3437
}
3538

@@ -86,13 +89,13 @@ message CustomInfoType {
8689
// These types of transformations are
8790
// those that perform pseudonymization, thereby producing a "surrogate" as
8891
// output. This should be used in conjunction with a field on the
89-
// transformation such as `surrogate_info_type`. This custom info type does
92+
// transformation such as `surrogate_info_type`. This CustomInfoType does
9093
// not support the use of `detection_rules`.
9194
message SurrogateType {
9295

9396
}
9497

95-
// Rule for modifying a custom info type to alter behavior under certain
98+
// Rule for modifying a CustomInfoType to alter behavior under certain
9699
// circumstances, depending on the specific details of the rule. Not supported
97100
// for the `surrogate_type` custom info type.
98101
message DetectionRule {
@@ -125,10 +128,10 @@ message CustomInfoType {
125128
}
126129
}
127130

128-
// Detection rule that adjusts the likelihood of findings within a certain
131+
// The rule that adjusts the likelihood of findings within a certain
129132
// proximity of hotwords.
130133
message HotwordRule {
131-
// Regex pattern defining what qualifies as a hotword.
134+
// Regular expression pattern defining what qualifies as a hotword.
132135
Regex hotword_regex = 1;
133136

134137
// Proximity of the finding within which the entire hotword must reside.
@@ -151,29 +154,30 @@ message CustomInfoType {
151154
}
152155
}
153156

154-
// Info type configuration. All custom info types must have configurations
155-
// that do not conflict with built-in info types or other custom info types.
157+
// All CustomInfoTypes must have a name
158+
// that does not conflict with built-in InfoTypes or other CustomInfoTypes.
156159
InfoType info_type = 1;
157160

158-
// Likelihood to return for this custom info type. This base value can be
161+
// Likelihood to return for this CustomInfoType. This base value can be
159162
// altered by a detection rule if the finding meets the criteria specified by
160163
// the rule. Defaults to `VERY_LIKELY` if not specified.
161164
Likelihood likelihood = 6;
162165

163166
oneof type {
164-
// Dictionary-based custom info type.
167+
// A list of phrases to detect as a CustomInfoType.
165168
Dictionary dictionary = 2;
166169

167-
// Regex-based custom info type.
170+
// Regular expression based CustomInfoType.
168171
Regex regex = 3;
169172

170-
// Surrogate info type.
173+
// Message for detecting output from deidentification transformations that
174+
// support reversing.
171175
SurrogateType surrogate_type = 4;
172176
}
173177

174-
// Set of detection rules to apply to all findings of this custom info type.
178+
// Set of detection rules to apply to all findings of this CustomInfoType.
175179
// Rules are applied in order that they are specified. Not supported for the
176-
// `surrogate_type` custom info type.
180+
// `surrogate_type` CustomInfoType.
177181
repeated DetectionRule detection_rules = 7;
178182
}
179183

@@ -223,6 +227,20 @@ message CloudStorageOptions {
223227
string url = 1;
224228
}
225229

230+
// How to sample bytes if not all bytes are scanned. Meaningful only when used
231+
// in conjunction with bytes_limit_per_file. If not specified, scanning would
232+
// start from the top.
233+
enum SampleMethod {
234+
SAMPLE_METHOD_UNSPECIFIED = 0;
235+
236+
// Scan from the top (default).
237+
TOP = 1;
238+
239+
// For each file larger than bytes_limit_per_file, randomly pick the offset
240+
// to start scanning. The scanned bytes are contiguous.
241+
RANDOM_START = 2;
242+
}
243+
226244
FileSet file_set = 1;
227245

228246
// Max number of bytes to scan from a file. If a scanned file's size is bigger
@@ -233,9 +251,16 @@ message CloudStorageOptions {
233251
// If empty, all files are scanned and available data format processors
234252
// are applied.
235253
repeated FileType file_types = 5;
254+
255+
SampleMethod sample_method = 6;
256+
257+
// Limits the number of files to scan to this percentage of the input FileSet.
258+
// Number of files scanned is rounded down. Must be between 0 and 100,
259+
// inclusively. Both 0 and 100 means no limit. Defaults to 0.
260+
int32 files_limit_percent = 7;
236261
}
237262

238-
// Message representing a path in Cloud Storage.
263+
// Message representing a single file or path in Cloud Storage.
239264
message CloudStoragePath {
240265
// A url representing a file or path (no wildcards) in Cloud Storage.
241266
// Example: gs://[BUCKET_NAME]/dictionary.txt
@@ -244,6 +269,19 @@ message CloudStoragePath {
244269

245270
// Options defining BigQuery table and row identifiers.
246271
message BigQueryOptions {
272+
// How to sample rows if not all rows are scanned. Meaningful only when used
273+
// in conjunction with rows_limit. If not specified, scanning would start
274+
// from the top.
275+
enum SampleMethod {
276+
SAMPLE_METHOD_UNSPECIFIED = 0;
277+
278+
// Scan from the top (default).
279+
TOP = 1;
280+
281+
// Randomly pick the row to start scanning. The scanned rows are contiguous.
282+
RANDOM_START = 2;
283+
}
284+
247285
// Complete BigQuery table reference.
248286
BigQueryTable table_reference = 1;
249287

@@ -255,6 +293,8 @@ message BigQueryOptions {
255293
// rest of the rows are omitted. If not set, or if set to 0, all rows will be
256294
// scanned. Cannot be used in conjunction with TimespanConfig.
257295
int64 rows_limit = 3;
296+
297+
SampleMethod sample_method = 4;
258298
}
259299

260300
// Shared message indicating Cloud storage type.
@@ -402,7 +442,7 @@ message EntityId {
402442
// Categorization of results based on how likely they are to represent a match,
403443
// based on the number of elements they contain which imply a match.
404444
enum Likelihood {
405-
// Default value; information with all likelihoods is included.
445+
// Default value; same as POSSIBLE.
406446
LIKELIHOOD_UNSPECIFIED = 0;
407447

408448
// Few matching elements.

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// Copyright 2017, Google LLC All rights reserved.
1+
// Copyright 2018 Google LLC
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
66
//
7-
// http://www.apache.org/licenses/LICENSE-2.0
7+
// https://www.apache.org/licenses/LICENSE-2.0
88
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,

0 commit comments

Comments
 (0)