storage.proto 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. package google.privacy.dlp.v2;
  16. import "google/api/resource.proto";
  17. import "google/protobuf/timestamp.proto";
  18. option csharp_namespace = "Google.Cloud.Dlp.V2";
  19. option go_package = "google.golang.org/genproto/googleapis/privacy/dlp/v2;dlp";
  20. option java_multiple_files = true;
  21. option java_outer_classname = "DlpStorage";
  22. option java_package = "com.google.privacy.dlp.v2";
  23. option php_namespace = "Google\\Cloud\\Dlp\\V2";
  24. option ruby_package = "Google::Cloud::Dlp::V2";
  25. // Type of information detected by the API.
  26. message InfoType {
  27. // Name of the information type. Either a name of your choosing when
  28. // creating a CustomInfoType, or one of the names listed
  29. // at https://cloud.google.com/dlp/docs/infotypes-reference when specifying
  30. // a built-in type. When sending Cloud DLP results to Data Catalog, infoType
  31. // names should conform to the pattern `[A-Za-z0-9$_-]{1,64}`.
  32. string name = 1;
  33. // Optional version name for this InfoType.
  34. string version = 2;
  35. }
  36. // Score is a summary of all elements in the data profile.
  37. // A higher number means more sensitive.
  38. message SensitivityScore {
  39. // Various score levels for resources.
  40. enum SensitivityScoreLevel {
  41. // Unused.
  42. SENSITIVITY_SCORE_UNSPECIFIED = 0;
  43. // No sensitive information detected. Limited access.
  44. SENSITIVITY_LOW = 10;
  45. // Medium risk - PII, potentially sensitive data, or fields with free-text
  46. // data that are at higher risk of having intermittent sensitive data.
  47. // Consider limiting access.
  48. SENSITIVITY_MODERATE = 20;
  49. // High risk – SPII may be present. Exfiltration of data may lead to user
  50. // data loss. Re-identification of users may be possible. Consider limiting
  51. // usage and or removing SPII.
  52. SENSITIVITY_HIGH = 30;
  53. }
  54. // The score applied to the resource.
  55. SensitivityScoreLevel score = 1;
  56. }
  57. // Categorization of results based on how likely they are to represent a match,
  58. // based on the number of elements they contain which imply a match.
  59. enum Likelihood {
  60. // Default value; same as POSSIBLE.
  61. LIKELIHOOD_UNSPECIFIED = 0;
  62. // Few matching elements.
  63. VERY_UNLIKELY = 1;
  64. UNLIKELY = 2;
  65. // Some matching elements.
  66. POSSIBLE = 3;
  67. LIKELY = 4;
  68. // Many matching elements.
  69. VERY_LIKELY = 5;
  70. }
  71. // A reference to a StoredInfoType to use with scanning.
  72. message StoredType {
  73. // Resource name of the requested `StoredInfoType`, for example
  74. // `organizations/433245324/storedInfoTypes/432452342` or
  75. // `projects/project-id/storedInfoTypes/432452342`.
  76. string name = 1;
  77. // Timestamp indicating when the version of the `StoredInfoType` used for
  78. // inspection was created. Output-only field, populated by the system.
  79. google.protobuf.Timestamp create_time = 2;
  80. }
  81. // Custom information type provided by the user. Used to find domain-specific
  82. // sensitive information configurable to the data in question.
  83. message CustomInfoType {
  84. // Custom information type based on a dictionary of words or phrases. This can
  85. // be used to match sensitive information specific to the data, such as a list
  86. // of employee IDs or job titles.
  87. //
  88. // Dictionary words are case-insensitive and all characters other than letters
  89. // and digits in the unicode [Basic Multilingual
  90. // Plane](https://en.wikipedia.org/wiki/Plane_%28Unicode%29#Basic_Multilingual_Plane)
  91. // will be replaced with whitespace when scanning for matches, so the
  92. // dictionary phrase "Sam Johnson" will match all three phrases "sam johnson",
  93. // "Sam, Johnson", and "Sam (Johnson)". Additionally, the characters
  94. // surrounding any match must be of a different type than the adjacent
  95. // characters within the word, so letters must be next to non-letters and
  96. // digits next to non-digits. For example, the dictionary word "jen" will
  97. // match the first three letters of the text "jen123" but will return no
  98. // matches for "jennifer".
  99. //
  100. // Dictionary words containing a large number of characters that are not
  101. // letters or digits may result in unexpected findings because such characters
  102. // are treated as whitespace. The
  103. // [limits](https://cloud.google.com/dlp/limits) page contains details about
  104. // the size limits of dictionaries. For dictionaries that do not fit within
  105. // these constraints, consider using `LargeCustomDictionaryConfig` in the
  106. // `StoredInfoType` API.
  107. message Dictionary {
  108. // Message defining a list of words or phrases to search for in the data.
  109. message WordList {
  110. // Words or phrases defining the dictionary. The dictionary must contain
  111. // at least one phrase and every phrase must contain at least 2 characters
  112. // that are letters or digits. [required]
  113. repeated string words = 1;
  114. }
  115. oneof source {
  116. // List of words or phrases to search for.
  117. WordList word_list = 1;
  118. // Newline-delimited file of words in Cloud Storage. Only a single file
  119. // is accepted.
  120. CloudStoragePath cloud_storage_path = 3;
  121. }
  122. }
  123. // Message defining a custom regular expression.
  124. message Regex {
  125. // Pattern defining the regular expression. Its syntax
  126. // (https://github.com/google/re2/wiki/Syntax) can be found under the
  127. // google/re2 repository on GitHub.
  128. string pattern = 1;
  129. // The index of the submatch to extract as findings. When not
  130. // specified, the entire match is returned. No more than 3 may be included.
  131. repeated int32 group_indexes = 2;
  132. }
  133. // Message for detecting output from deidentification transformations
  134. // such as
  135. // [`CryptoReplaceFfxFpeConfig`](https://cloud.google.com/dlp/docs/reference/rest/v2/organizations.deidentifyTemplates#cryptoreplaceffxfpeconfig).
  136. // These types of transformations are
  137. // those that perform pseudonymization, thereby producing a "surrogate" as
  138. // output. This should be used in conjunction with a field on the
  139. // transformation such as `surrogate_info_type`. This CustomInfoType does
  140. // not support the use of `detection_rules`.
  141. message SurrogateType {
  142. }
  143. // Deprecated; use `InspectionRuleSet` instead. Rule for modifying a
  144. // `CustomInfoType` to alter behavior under certain circumstances, depending
  145. // on the specific details of the rule. Not supported for the `surrogate_type`
  146. // custom infoType.
  147. message DetectionRule {
  148. // Message for specifying a window around a finding to apply a detection
  149. // rule.
  150. message Proximity {
  151. // Number of characters before the finding to consider. For tabular data,
  152. // if you want to modify the likelihood of an entire column of findngs,
  153. // set this to 1. For more information, see
  154. // [Hotword example: Set the match likelihood of a table column]
  155. // (https://cloud.google.com/dlp/docs/creating-custom-infotypes-likelihood#match-column-values).
  156. int32 window_before = 1;
  157. // Number of characters after the finding to consider.
  158. int32 window_after = 2;
  159. }
  160. // Message for specifying an adjustment to the likelihood of a finding as
  161. // part of a detection rule.
  162. message LikelihoodAdjustment {
  163. oneof adjustment {
  164. // Set the likelihood of a finding to a fixed value.
  165. Likelihood fixed_likelihood = 1;
  166. // Increase or decrease the likelihood by the specified number of
  167. // levels. For example, if a finding would be `POSSIBLE` without the
  168. // detection rule and `relative_likelihood` is 1, then it is upgraded to
  169. // `LIKELY`, while a value of -1 would downgrade it to `UNLIKELY`.
  170. // Likelihood may never drop below `VERY_UNLIKELY` or exceed
  171. // `VERY_LIKELY`, so applying an adjustment of 1 followed by an
  172. // adjustment of -1 when base likelihood is `VERY_LIKELY` will result in
  173. // a final likelihood of `LIKELY`.
  174. int32 relative_likelihood = 2;
  175. }
  176. }
  177. // The rule that adjusts the likelihood of findings within a certain
  178. // proximity of hotwords.
  179. message HotwordRule {
  180. // Regular expression pattern defining what qualifies as a hotword.
  181. Regex hotword_regex = 1;
  182. // Range of characters within which the entire hotword must reside.
  183. // The total length of the window cannot exceed 1000 characters.
  184. // The finding itself will be included in the window, so that hotwords can
  185. // be used to match substrings of the finding itself. Suppose you
  186. // want Cloud DLP to promote the likelihood of the phone number
  187. // regex "\(\d{3}\) \d{3}-\d{4}" if the area code is known to be the
  188. // area code of a company's office. In this case, use the hotword regex
  189. // "\(xxx\)", where "xxx" is the area code in question.
  190. //
  191. // For tabular data, if you want to modify the likelihood of an entire
  192. // column of findngs, see
  193. // [Hotword example: Set the match likelihood of a table column]
  194. // (https://cloud.google.com/dlp/docs/creating-custom-infotypes-likelihood#match-column-values).
  195. Proximity proximity = 2;
  196. // Likelihood adjustment to apply to all matching findings.
  197. LikelihoodAdjustment likelihood_adjustment = 3;
  198. }
  199. oneof type {
  200. // Hotword-based detection rule.
  201. HotwordRule hotword_rule = 1;
  202. }
  203. }
  204. enum ExclusionType {
  205. // A finding of this custom info type will not be excluded from results.
  206. EXCLUSION_TYPE_UNSPECIFIED = 0;
  207. // A finding of this custom info type will be excluded from final results,
  208. // but can still affect rule execution.
  209. EXCLUSION_TYPE_EXCLUDE = 1;
  210. }
  211. // CustomInfoType can either be a new infoType, or an extension of built-in
  212. // infoType, when the name matches one of existing infoTypes and that infoType
  213. // is specified in `InspectContent.info_types` field. Specifying the latter
  214. // adds findings to the one detected by the system. If built-in info type is
  215. // not specified in `InspectContent.info_types` list then the name is treated
  216. // as a custom info type.
  217. InfoType info_type = 1;
  218. // Likelihood to return for this CustomInfoType. This base value can be
  219. // altered by a detection rule if the finding meets the criteria specified by
  220. // the rule. Defaults to `VERY_LIKELY` if not specified.
  221. Likelihood likelihood = 6;
  222. oneof type {
  223. // A list of phrases to detect as a CustomInfoType.
  224. Dictionary dictionary = 2;
  225. // Regular expression based CustomInfoType.
  226. Regex regex = 3;
  227. // Message for detecting output from deidentification transformations that
  228. // support reversing.
  229. SurrogateType surrogate_type = 4;
  230. // Load an existing `StoredInfoType` resource for use in
  231. // `InspectDataSource`. Not currently supported in `InspectContent`.
  232. StoredType stored_type = 5;
  233. }
  234. // Set of detection rules to apply to all findings of this CustomInfoType.
  235. // Rules are applied in order that they are specified. Not supported for the
  236. // `surrogate_type` CustomInfoType.
  237. repeated DetectionRule detection_rules = 7;
  238. // If set to EXCLUSION_TYPE_EXCLUDE this infoType will not cause a finding
  239. // to be returned. It still can be used for rules matching.
  240. ExclusionType exclusion_type = 8;
  241. }
  242. // General identifier of a data field in a storage service.
  243. message FieldId {
  244. // Name describing the field.
  245. string name = 1;
  246. }
  247. // Datastore partition ID.
  248. // A partition ID identifies a grouping of entities. The grouping is always
  249. // by project and namespace, however the namespace ID may be empty.
  250. //
  251. // A partition ID contains several dimensions:
  252. // project ID and namespace ID.
  253. message PartitionId {
  254. // The ID of the project to which the entities belong.
  255. string project_id = 2;
  256. // If not empty, the ID of the namespace to which the entities belong.
  257. string namespace_id = 4;
  258. }
  259. // A representation of a Datastore kind.
  260. message KindExpression {
  261. // The name of the kind.
  262. string name = 1;
  263. }
  264. // Options defining a data set within Google Cloud Datastore.
  265. message DatastoreOptions {
  266. // A partition ID identifies a grouping of entities. The grouping is always
  267. // by project and namespace, however the namespace ID may be empty.
  268. PartitionId partition_id = 1;
  269. // The kind to process.
  270. KindExpression kind = 2;
  271. }
  272. // Definitions of file type groups to scan. New types will be added to this
  273. // list.
  274. enum FileType {
  275. // Includes all files.
  276. FILE_TYPE_UNSPECIFIED = 0;
  277. // Includes all file extensions not covered by another entry. Binary
  278. // scanning attempts to convert the content of the file to utf_8 to scan
  279. // the file.
  280. // If you wish to avoid this fall back, specify one or more of the other
  281. // FileType's in your storage scan.
  282. BINARY_FILE = 1;
  283. // Included file extensions:
  284. // asc,asp, aspx, brf, c, cc,cfm, cgi, cpp, csv, cxx, c++, cs, css, dart,
  285. // dat, dot, eml,, epbub, ged, go, h, hh, hpp, hxx, h++, hs, html, htm,
  286. // mkd, markdown, m, ml, mli, perl, pl, plist, pm, php, phtml, pht,
  287. // properties, py, pyw, rb, rbw, rs, rss, rc, scala, sh, sql, swift, tex,
  288. // shtml, shtm, xhtml, lhs, ics, ini, java, js, json, kix, kml, ocaml, md,
  289. // txt, text, tsv, vb, vcard, vcs, wml, xcodeproj, xml, xsl, xsd, yml, yaml.
  290. TEXT_FILE = 2;
  291. // Included file extensions:
  292. // bmp, gif, jpg, jpeg, jpe, png.
  293. // bytes_limit_per_file has no effect on image files.
  294. // Image inspection is restricted to 'global', 'us', 'asia', and 'europe'.
  295. IMAGE = 3;
  296. // Word files >30 MB will be scanned as binary files.
  297. // Included file extensions:
  298. // docx, dotx, docm, dotm
  299. WORD = 5;
  300. // PDF files >30 MB will be scanned as binary files.
  301. // Included file extensions:
  302. // pdf
  303. PDF = 6;
  304. // Included file extensions:
  305. // avro
  306. AVRO = 7;
  307. // Included file extensions:
  308. // csv
  309. CSV = 8;
  310. // Included file extensions:
  311. // tsv
  312. TSV = 9;
  313. // Powerpoint files >30 MB will be scanned as binary files.
  314. // Included file extensions:
  315. // pptx, pptm, potx, potm, pot
  316. POWERPOINT = 11;
  317. // Excel files >30 MB will be scanned as binary files.
  318. // Included file extensions:
  319. // xlsx, xlsm, xltx, xltm
  320. EXCEL = 12;
  321. }
  322. // Message representing a set of files in a Cloud Storage bucket. Regular
  323. // expressions are used to allow fine-grained control over which files in the
  324. // bucket to include.
  325. //
  326. // Included files are those that match at least one item in `include_regex` and
  327. // do not match any items in `exclude_regex`. Note that a file that matches
  328. // items from both lists will _not_ be included. For a match to occur, the
  329. // entire file path (i.e., everything in the url after the bucket name) must
  330. // match the regular expression.
  331. //
  332. // For example, given the input `{bucket_name: "mybucket", include_regex:
  333. // ["directory1/.*"], exclude_regex:
  334. // ["directory1/excluded.*"]}`:
  335. //
  336. // * `gs://mybucket/directory1/myfile` will be included
  337. // * `gs://mybucket/directory1/directory2/myfile` will be included (`.*` matches
  338. // across `/`)
  339. // * `gs://mybucket/directory0/directory1/myfile` will _not_ be included (the
  340. // full path doesn't match any items in `include_regex`)
  341. // * `gs://mybucket/directory1/excludedfile` will _not_ be included (the path
  342. // matches an item in `exclude_regex`)
  343. //
  344. // If `include_regex` is left empty, it will match all files by default
  345. // (this is equivalent to setting `include_regex: [".*"]`).
  346. //
  347. // Some other common use cases:
  348. //
  349. // * `{bucket_name: "mybucket", exclude_regex: [".*\.pdf"]}` will include all
  350. // files in `mybucket` except for .pdf files
  351. // * `{bucket_name: "mybucket", include_regex: ["directory/[^/]+"]}` will
  352. // include all files directly under `gs://mybucket/directory/`, without matching
  353. // across `/`
  354. message CloudStorageRegexFileSet {
  355. // The name of a Cloud Storage bucket. Required.
  356. string bucket_name = 1;
  357. // A list of regular expressions matching file paths to include. All files in
  358. // the bucket that match at least one of these regular expressions will be
  359. // included in the set of files, except for those that also match an item in
  360. // `exclude_regex`. Leaving this field empty will match all files by default
  361. // (this is equivalent to including `.*` in the list).
  362. //
  363. // Regular expressions use RE2
  364. // [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found
  365. // under the google/re2 repository on GitHub.
  366. repeated string include_regex = 2;
  367. // A list of regular expressions matching file paths to exclude. All files in
  368. // the bucket that match at least one of these regular expressions will be
  369. // excluded from the scan.
  370. //
  371. // Regular expressions use RE2
  372. // [syntax](https://github.com/google/re2/wiki/Syntax); a guide can be found
  373. // under the google/re2 repository on GitHub.
  374. repeated string exclude_regex = 3;
  375. }
  376. // Options defining a file or a set of files within a Cloud Storage
  377. // bucket.
  378. message CloudStorageOptions {
  379. // Set of files to scan.
  380. message FileSet {
  381. // The Cloud Storage url of the file(s) to scan, in the format
  382. // `gs://<bucket>/<path>`. Trailing wildcard in the path is allowed.
  383. //
  384. // If the url ends in a trailing slash, the bucket or directory represented
  385. // by the url will be scanned non-recursively (content in sub-directories
  386. // will not be scanned). This means that `gs://mybucket/` is equivalent to
  387. // `gs://mybucket/*`, and `gs://mybucket/directory/` is equivalent to
  388. // `gs://mybucket/directory/*`.
  389. //
  390. // Exactly one of `url` or `regex_file_set` must be set.
  391. string url = 1;
  392. // The regex-filtered set of files to scan. Exactly one of `url` or
  393. // `regex_file_set` must be set.
  394. CloudStorageRegexFileSet regex_file_set = 2;
  395. }
  396. // How to sample bytes if not all bytes are scanned. Meaningful only when used
  397. // in conjunction with bytes_limit_per_file. If not specified, scanning would
  398. // start from the top.
  399. enum SampleMethod {
  400. SAMPLE_METHOD_UNSPECIFIED = 0;
  401. // Scan from the top (default).
  402. TOP = 1;
  403. // For each file larger than bytes_limit_per_file, randomly pick the offset
  404. // to start scanning. The scanned bytes are contiguous.
  405. RANDOM_START = 2;
  406. }
  407. // The set of one or more files to scan.
  408. FileSet file_set = 1;
  409. // Max number of bytes to scan from a file. If a scanned file's size is bigger
  410. // than this value then the rest of the bytes are omitted. Only one
  411. // of bytes_limit_per_file and bytes_limit_per_file_percent can be specified.
  412. // Cannot be set if de-identification is requested.
  413. int64 bytes_limit_per_file = 4;
  414. // Max percentage of bytes to scan from a file. The rest are omitted. The
  415. // number of bytes scanned is rounded down. Must be between 0 and 100,
  416. // inclusively. Both 0 and 100 means no limit. Defaults to 0. Only one
  417. // of bytes_limit_per_file and bytes_limit_per_file_percent can be specified.
  418. // Cannot be set if de-identification is requested.
  419. int32 bytes_limit_per_file_percent = 8;
  420. // List of file type groups to include in the scan.
  421. // If empty, all files are scanned and available data format processors
  422. // are applied. In addition, the binary content of the selected files
  423. // is always scanned as well.
  424. // Images are scanned only as binary if the specified region
  425. // does not support image inspection and no file_types were specified.
  426. // Image inspection is restricted to 'global', 'us', 'asia', and 'europe'.
  427. repeated FileType file_types = 5;
  428. SampleMethod sample_method = 6;
  429. // Limits the number of files to scan to this percentage of the input FileSet.
  430. // Number of files scanned is rounded down. Must be between 0 and 100,
  431. // inclusively. Both 0 and 100 means no limit. Defaults to 0.
  432. int32 files_limit_percent = 7;
  433. }
  434. // Message representing a set of files in Cloud Storage.
  435. message CloudStorageFileSet {
  436. // The url, in the format `gs://<bucket>/<path>`. Trailing wildcard in the
  437. // path is allowed.
  438. string url = 1;
  439. }
  440. // Message representing a single file or path in Cloud Storage.
  441. message CloudStoragePath {
  442. // A url representing a file or path (no wildcards) in Cloud Storage.
  443. // Example: gs://[BUCKET_NAME]/dictionary.txt
  444. string path = 1;
  445. }
  446. // Options defining BigQuery table and row identifiers.
  447. message BigQueryOptions {
  448. // How to sample rows if not all rows are scanned. Meaningful only when used
  449. // in conjunction with either rows_limit or rows_limit_percent. If not
  450. // specified, rows are scanned in the order BigQuery reads them.
  451. enum SampleMethod {
  452. SAMPLE_METHOD_UNSPECIFIED = 0;
  453. // Scan groups of rows in the order BigQuery provides (default). Multiple
  454. // groups of rows may be scanned in parallel, so results may not appear in
  455. // the same order the rows are read.
  456. TOP = 1;
  457. // Randomly pick groups of rows to scan.
  458. RANDOM_START = 2;
  459. }
  460. // Complete BigQuery table reference.
  461. BigQueryTable table_reference = 1;
  462. // Table fields that may uniquely identify a row within the table. When
  463. // `actions.saveFindings.outputConfig.table` is specified, the values of
  464. // columns specified here are available in the output table under
  465. // `location.content_locations.record_location.record_key.id_values`. Nested
  466. // fields such as `person.birthdate.year` are allowed.
  467. repeated FieldId identifying_fields = 2;
  468. // Max number of rows to scan. If the table has more rows than this value, the
  469. // rest of the rows are omitted. If not set, or if set to 0, all rows will be
  470. // scanned. Only one of rows_limit and rows_limit_percent can be specified.
  471. // Cannot be used in conjunction with TimespanConfig.
  472. int64 rows_limit = 3;
  473. // Max percentage of rows to scan. The rest are omitted. The number of rows
  474. // scanned is rounded down. Must be between 0 and 100, inclusively. Both 0 and
  475. // 100 means no limit. Defaults to 0. Only one of rows_limit and
  476. // rows_limit_percent can be specified. Cannot be used in conjunction with
  477. // TimespanConfig.
  478. int32 rows_limit_percent = 6;
  479. SampleMethod sample_method = 4;
  480. // References to fields excluded from scanning. This allows you to skip
  481. // inspection of entire columns which you know have no findings.
  482. repeated FieldId excluded_fields = 5;
  483. // Limit scanning only to these fields.
  484. repeated FieldId included_fields = 7;
  485. }
  486. // Shared message indicating Cloud storage type.
  487. message StorageConfig {
  488. // Configuration of the timespan of the items to include in scanning.
  489. // Currently only supported when inspecting Cloud Storage and BigQuery.
  490. message TimespanConfig {
  491. // Exclude files, tables, or rows older than this value.
  492. // If not set, no lower time limit is applied.
  493. google.protobuf.Timestamp start_time = 1;
  494. // Exclude files, tables, or rows newer than this value.
  495. // If not set, no upper time limit is applied.
  496. google.protobuf.Timestamp end_time = 2;
  497. // Specification of the field containing the timestamp of scanned items.
  498. // Used for data sources like Datastore and BigQuery.
  499. //
  500. // <b>For BigQuery</b>
  501. //
  502. // If this value is not specified and the table was modified between the
  503. // given start and end times, the entire table will be scanned. If this
  504. // value is specified, then rows are filtered based on the given start and
  505. // end times. Rows with a `NULL` value in the provided BigQuery column are
  506. // skipped.
  507. // Valid data types of the provided BigQuery column are: `INTEGER`, `DATE`,
  508. // `TIMESTAMP`, and `DATETIME`.
  509. //
  510. // If your BigQuery table is [partitioned at ingestion
  511. // time](https://cloud.google.com/bigquery/docs/partitioned-tables#ingestion_time),
  512. // you can use any of the following pseudo-columns as your timestamp field.
  513. // When used with Cloud DLP, these pseudo-column names are case sensitive.
  514. //
  515. // <ul>
  516. // <li><code>_PARTITIONTIME</code></li>
  517. // <li><code>_PARTITIONDATE</code></li>
  518. // <li><code>_PARTITION_LOAD_TIME</code></li>
  519. // </ul>
  520. //
  521. // <b>For Datastore</b>
  522. //
  523. // If this value is specified, then entities are filtered based on the given
  524. // start and end times. If an entity does not contain the provided timestamp
  525. // property or contains empty or invalid values, then it is included.
  526. // Valid data types of the provided timestamp property are: `TIMESTAMP`.
  527. //
  528. // See the
  529. // [known issue](https://cloud.google.com/dlp/docs/known-issues#bq-timespan)
  530. // related to this operation.
  531. FieldId timestamp_field = 3;
  532. // When the job is started by a JobTrigger we will automatically figure out
  533. // a valid start_time to avoid scanning files that have not been modified
  534. // since the last time the JobTrigger executed. This will be based on the
  535. // time of the execution of the last run of the JobTrigger or the timespan
  536. // end_time used in the last run of the JobTrigger.
  537. bool enable_auto_population_of_timespan_config = 4;
  538. }
  539. oneof type {
  540. // Google Cloud Datastore options.
  541. DatastoreOptions datastore_options = 2;
  542. // Cloud Storage options.
  543. CloudStorageOptions cloud_storage_options = 3;
  544. // BigQuery options.
  545. BigQueryOptions big_query_options = 4;
  546. // Hybrid inspection options.
  547. HybridOptions hybrid_options = 9;
  548. }
  549. TimespanConfig timespan_config = 6;
  550. }
  551. // Configuration to control jobs where the content being inspected is outside
  552. // of Google Cloud Platform.
  553. message HybridOptions {
  554. // A short description of where the data is coming from. Will be stored once
  555. // in the job. 256 max length.
  556. string description = 1;
  557. // These are labels that each inspection request must include within their
  558. // 'finding_labels' map. Request may contain others, but any missing one of
  559. // these will be rejected.
  560. //
  561. // Label keys must be between 1 and 63 characters long and must conform
  562. // to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
  563. //
  564. // No more than 10 keys can be required.
  565. repeated string required_finding_label_keys = 2;
  566. // To organize findings, these labels will be added to each finding.
  567. //
  568. // Label keys must be between 1 and 63 characters long and must conform
  569. // to the following regular expression: `[a-z]([-a-z0-9]*[a-z0-9])?`.
  570. //
  571. // Label values must be between 0 and 63 characters long and must conform
  572. // to the regular expression `([a-z]([-a-z0-9]*[a-z0-9])?)?`.
  573. //
  574. // No more than 10 labels can be associated with a given finding.
  575. //
  576. // Examples:
  577. // * `"environment" : "production"`
  578. // * `"pipeline" : "etl"`
  579. map<string, string> labels = 3;
  580. // If the container is a table, additional information to make findings
  581. // meaningful such as the columns that are primary keys.
  582. TableOptions table_options = 4;
  583. }
  584. // Row key for identifying a record in BigQuery table.
  585. message BigQueryKey {
  586. // Complete BigQuery table reference.
  587. BigQueryTable table_reference = 1;
  588. // Row number inferred at the time the table was scanned. This value is
  589. // nondeterministic, cannot be queried, and may be null for inspection
  590. // jobs. To locate findings within a table, specify
  591. // `inspect_job.storage_config.big_query_options.identifying_fields` in
  592. // `CreateDlpJobRequest`.
  593. int64 row_number = 2;
  594. }
  595. // Record key for a finding in Cloud Datastore.
  596. message DatastoreKey {
  597. // Datastore entity key.
  598. Key entity_key = 1;
  599. }
  600. // A unique identifier for a Datastore entity.
  601. // If a key's partition ID or any of its path kinds or names are
  602. // reserved/read-only, the key is reserved/read-only.
  603. // A reserved/read-only key is forbidden in certain documented contexts.
  604. message Key {
  605. // A (kind, ID/name) pair used to construct a key path.
  606. //
  607. // If either name or ID is set, the element is complete.
  608. // If neither is set, the element is incomplete.
  609. message PathElement {
  610. // The kind of the entity.
  611. // A kind matching regex `__.*__` is reserved/read-only.
  612. // A kind must not contain more than 1500 bytes when UTF-8 encoded.
  613. // Cannot be `""`.
  614. string kind = 1;
  615. // The type of ID.
  616. oneof id_type {
  617. // The auto-allocated ID of the entity.
  618. // Never equal to zero. Values less than zero are discouraged and may not
  619. // be supported in the future.
  620. int64 id = 2;
  621. // The name of the entity.
  622. // A name matching regex `__.*__` is reserved/read-only.
  623. // A name must not be more than 1500 bytes when UTF-8 encoded.
  624. // Cannot be `""`.
  625. string name = 3;
  626. }
  627. }
  628. // Entities are partitioned into subsets, currently identified by a project
  629. // ID and namespace ID.
  630. // Queries are scoped to a single partition.
  631. PartitionId partition_id = 1;
  632. // The entity path.
  633. // An entity path consists of one or more elements composed of a kind and a
  634. // string or numerical identifier, which identify entities. The first
  635. // element identifies a _root entity_, the second element identifies
  636. // a _child_ of the root entity, the third element identifies a child of the
  637. // second entity, and so forth. The entities identified by all prefixes of
  638. // the path are called the element's _ancestors_.
  639. //
  640. // A path can never be empty, and a path can have at most 100 elements.
  641. repeated PathElement path = 2;
  642. }
  643. // Message for a unique key indicating a record that contains a finding.
  644. message RecordKey {
  645. oneof type {
  646. DatastoreKey datastore_key = 2;
  647. BigQueryKey big_query_key = 3;
  648. }
  649. // Values of identifying columns in the given row. Order of values matches
  650. // the order of `identifying_fields` specified in the scanning request.
  651. repeated string id_values = 5;
  652. }
  653. // Message defining the location of a BigQuery table. A table is uniquely
  654. // identified by its project_id, dataset_id, and table_name. Within a query
  655. // a table is often referenced with a string in the format of:
  656. // `<project_id>:<dataset_id>.<table_id>` or
  657. // `<project_id>.<dataset_id>.<table_id>`.
  658. message BigQueryTable {
  659. // The Google Cloud Platform project ID of the project containing the table.
  660. // If omitted, project ID is inferred from the API call.
  661. string project_id = 1;
  662. // Dataset ID of the table.
  663. string dataset_id = 2;
  664. // Name of the table.
  665. string table_id = 3;
  666. }
  667. // Message defining a field of a BigQuery table.
  668. message BigQueryField {
  669. // Source table of the field.
  670. BigQueryTable table = 1;
  671. // Designated field in the BigQuery table.
  672. FieldId field = 2;
  673. }
  674. // An entity in a dataset is a field or set of fields that correspond to a
  675. // single person. For example, in medical records the `EntityId` might be a
  676. // patient identifier, or for financial records it might be an account
  677. // identifier. This message is used when generalizations or analysis must take
  678. // into account that multiple rows correspond to the same entity.
  679. message EntityId {
  680. // Composite key indicating which field contains the entity identifier.
  681. FieldId field = 1;
  682. }
  683. // Instructions regarding the table content being inspected.
  684. message TableOptions {
  685. // The columns that are the primary keys for table objects included in
  686. // ContentItem. A copy of this cell's value will stored alongside alongside
  687. // each finding so that the finding can be traced to the specific row it came
  688. // from. No more than 3 may be provided.
  689. repeated FieldId identifying_fields = 1;
  690. }