From 3c0208ab3645e013e22ebecb57d5e600b7c931ad Mon Sep 17 00:00:00 2001 From: Jonathan Lui Date: Thu, 16 Aug 2018 17:35:12 -0700 Subject: [PATCH] Update synth.py (#112) * update synth.py * run synth.py to update API (googleapis/googleapis@a4b52a278) and templates --- .../google-privacy-dlp/.circleci/config.yml | 4 +- .../google-privacy-dlp/CODE_OF_CONDUCT.md | 2 +- .../protos/google/privacy/dlp/v2/dlp.proto | 243 ++++++++++++++- .../google/privacy/dlp/v2/storage.proto | 67 +++- .../v2/doc/google/privacy/dlp/v2/doc_dlp.js | 293 ++++++++++++++++++ .../doc/google/privacy/dlp/v2/doc_storage.js | 97 +++++- packages/google-privacy-dlp/synth.py | 24 +- 7 files changed, 694 insertions(+), 36 deletions(-) diff --git a/packages/google-privacy-dlp/.circleci/config.yml b/packages/google-privacy-dlp/.circleci/config.yml index dd4c80cc6e9..6286d44c7cc 100644 --- a/packages/google-privacy-dlp/.circleci/config.yml +++ b/packages/google-privacy-dlp/.circleci/config.yml @@ -59,7 +59,7 @@ jobs: - image: 'node:6' user: node steps: &unit_tests_steps - - checkout + - checkout - run: &npm_install_and_link name: Install and link the module command: |- @@ -69,7 +69,7 @@ jobs: NPM_CONFIG_PREFIX: /home/node/.npm-global - run: npm test - run: node_modules/.bin/codecov - + node8: docker: - image: 'node:8' diff --git a/packages/google-privacy-dlp/CODE_OF_CONDUCT.md b/packages/google-privacy-dlp/CODE_OF_CONDUCT.md index 46b2a08ea6d..c3727800341 100644 --- a/packages/google-privacy-dlp/CODE_OF_CONDUCT.md +++ b/packages/google-privacy-dlp/CODE_OF_CONDUCT.md @@ -40,4 +40,4 @@ may be reported by opening an issue or contacting one or more of the project maintainers. This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.2.0, -available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) +available at [http://contributor-covenant.org/version/1/2/0/](http://contributor-covenant.org/version/1/2/0/) \ No newline at end of file diff --git a/packages/google-privacy-dlp/protos/google/privacy/dlp/v2/dlp.proto b/packages/google-privacy-dlp/protos/google/privacy/dlp/v2/dlp.proto index 4b151b3ed68..fdf83582274 100644 --- a/packages/google-privacy-dlp/protos/google/privacy/dlp/v2/dlp.proto +++ b/packages/google-privacy-dlp/protos/google/privacy/dlp/v2/dlp.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google Inc. +// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -333,6 +333,71 @@ service DlpService { body: "*" }; } + + // Creates a pre-built stored infoType to be used for inspection. + // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + // learn more. + rpc CreateStoredInfoType(CreateStoredInfoTypeRequest) returns (StoredInfoType) { + option (google.api.http) = { + post: "/v2/{parent=organizations/*}/storedInfoTypes" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*}/storedInfoTypes" + body: "*" + } + }; + } + + // Updates the stored infoType by creating a new version. The existing version + // will continue to be used until the new version is ready. + // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + // learn more. + rpc UpdateStoredInfoType(UpdateStoredInfoTypeRequest) returns (StoredInfoType) { + option (google.api.http) = { + patch: "/v2/{name=organizations/*/storedInfoTypes/*}" + body: "*" + additional_bindings { + patch: "/v2/{name=projects/*/storedInfoTypes/*}" + body: "*" + } + }; + } + + // Gets a stored infoType. + // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + // learn more. + rpc GetStoredInfoType(GetStoredInfoTypeRequest) returns (StoredInfoType) { + option (google.api.http) = { + get: "/v2/{name=organizations/*/storedInfoTypes/*}" + additional_bindings { + get: "/v2/{name=projects/*/storedInfoTypes/*}" + } + }; + } + + // Lists stored infoTypes. + // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + // learn more. + rpc ListStoredInfoTypes(ListStoredInfoTypesRequest) returns (ListStoredInfoTypesResponse) { + option (google.api.http) = { + get: "/v2/{parent=organizations/*}/storedInfoTypes" + additional_bindings { + get: "/v2/{parent=projects/*}/storedInfoTypes" + } + }; + } + + // Deletes a stored infoType. + // See https://cloud.google.com/dlp/docs/creating-stored-infotypes to + // learn more. + rpc DeleteStoredInfoType(DeleteStoredInfoTypeRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=organizations/*/storedInfoTypes/*}" + additional_bindings { + delete: "/v2/{name=projects/*/storedInfoTypes/*}" + } + }; + } } // Configuration description of the scanning process. @@ -375,6 +440,11 @@ message InspectConfig { // When no InfoTypes or CustomInfoTypes are specified in a request, the // system may automatically choose what detectors to run. By default this may // be all types, but may change over time as detectors are updated. + // + // The special InfoType name "ALL_BASIC" can be used to trigger all detectors, + // but may change over time as new InfoTypes are added. If you need precise + // control and predictability as to what detectors are run you should specify + // specific InfoTypes listed in the reference. repeated InfoType info_types = 1; // Only returns findings equal or above this threshold. The default is @@ -2597,6 +2667,157 @@ message DeleteDeidentifyTemplateRequest { string name = 1; } +// Configuration for a custom dictionary created from a data source of any size +// up to the maximum size defined in the +// [limits](https://cloud.google.com/dlp/limits) page. The artifacts of +// dictionary creation are stored in the specified Google Cloud Storage +// location. Consider using `CustomInfoType.Dictionary` for smaller dictionaries +// that satisfy the size requirements. +message LargeCustomDictionaryConfig { + // Location to store dictionary artifacts in Google Cloud Storage. These files + // will only be accessible by project owners and the DLP API. If any of these + // artifacts are modified, the dictionary is considered invalid and can no + // longer be used. + CloudStoragePath output_path = 1; + + oneof source { + // Set of files containing newline-delimited lists of dictionary phrases. + CloudStorageFileSet cloud_storage_file_set = 2; + + // Field in a BigQuery table where each cell represents a dictionary phrase. + BigQueryField big_query_field = 3; + } +} + +// Configuration for a StoredInfoType. +message StoredInfoTypeConfig { + // Display name of the StoredInfoType (max 256 characters). + string display_name = 1; + + // Description of the StoredInfoType (max 256 characters). + string description = 2; + + oneof type { + // StoredInfoType where findings are defined by a dictionary of phrases. + LargeCustomDictionaryConfig large_custom_dictionary = 3; + } +} + +// Version of a StoredInfoType, including the configuration used to build it, +// create timestamp, and current state. +message StoredInfoTypeVersion { + // StoredInfoType configuration. + StoredInfoTypeConfig config = 1; + + // Create timestamp of the version. Read-only, determined by the system + // when the version is created. + google.protobuf.Timestamp create_time = 2; + + // Stored info type version state. Read-only, updated by the system + // during dictionary creation. + StoredInfoTypeState state = 3; + + // Errors that occurred when creating this storedInfoType version, or + // anomalies detected in the storedInfoType data that render it unusable. Only + // the five most recent errors will be displayed, with the most recent error + // appearing first. + //

For example, some of the data for stored custom dictionaries is put in + // the user's Google Cloud Storage bucket, and if this data is modified or + // deleted by the user or another system, the dictionary becomes invalid. + //

If any errors occur, fix the problem indicated by the error message and + // use the UpdateStoredInfoType API method to create another version of the + // storedInfoType to continue using it, reusing the same `config` if it was + // not the source of the error. + repeated Error errors = 4; +} + +// StoredInfoType resource message that contains information about the current +// version and any pending updates. +message StoredInfoType { + // Resource name. + string name = 1; + + // Current version of the stored info type. + StoredInfoTypeVersion current_version = 2; + + // Pending versions of the stored info type. Empty if no versions are + // pending. + repeated StoredInfoTypeVersion pending_versions = 3; +} + +// Request message for CreateStoredInfoType. +message CreateStoredInfoTypeRequest { + // The parent resource name, for example projects/my-project-id or + // organizations/my-org-id. + string parent = 1; + + // Configuration of the storedInfoType to create. + StoredInfoTypeConfig config = 2; + + // The storedInfoType ID can contain uppercase and lowercase letters, + // numbers, and hyphens; that is, it must match the regular + // expression: `[a-zA-Z\\d-]+`. The maximum length is 100 + // characters. Can be empty to allow the system to generate one. + string stored_info_type_id = 3; +} + +// Request message for UpdateStoredInfoType. +message UpdateStoredInfoTypeRequest { + // Resource name of organization and storedInfoType to be updated, for + // example `organizations/433245324/storedInfoTypes/432452342` or + // projects/project-id/storedInfoTypes/432452342. + string name = 1; + + // Updated configuration for the storedInfoType. If not provided, a new + // version of the storedInfoType will be created with the existing + // configuration. + StoredInfoTypeConfig config = 2; + + // Mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3; +} + +// Request message for GetStoredInfoType. +message GetStoredInfoTypeRequest { + // Resource name of the organization and storedInfoType to be read, for + // example `organizations/433245324/storedInfoTypes/432452342` or + // projects/project-id/storedInfoTypes/432452342. + string name = 1; +} + +// Request message for ListStoredInfoTypes. +message ListStoredInfoTypesRequest { + // The parent resource name, for example projects/my-project-id or + // organizations/my-org-id. + string parent = 1; + + // Optional page token to continue retrieval. Comes from previous call + // to `ListStoredInfoTypes`. + string page_token = 2; + + // Optional size of the page, can be limited by server. If zero server returns + // a page of max size 100. + int32 page_size = 3; +} + +// Response message for ListStoredInfoTypes. +message ListStoredInfoTypesResponse { + // List of storedInfoTypes, up to page_size in ListStoredInfoTypesRequest. + repeated StoredInfoType stored_info_types = 1; + + // If the next page is available then the next page token to be used + // in following ListStoredInfoTypes request. + string next_page_token = 2; +} + +// Request message for DeleteStoredInfoType. +message DeleteStoredInfoTypeRequest { + // Resource name of the organization and storedInfoType to be deleted, for + // example `organizations/433245324/storedInfoTypes/432452342` or + // projects/project-id/storedInfoTypes/432452342. + string name = 1; +} + // Options describing which parts of the provided content should be scanned. enum ContentOption { // Includes entire content of a file or a data stream. @@ -2656,3 +2877,23 @@ enum DlpJobType { // The job executed a Risk Analysis computation. RISK_ANALYSIS_JOB = 2; } + +// State of a StoredInfoType version. +enum StoredInfoTypeState { + STORED_INFO_TYPE_STATE_UNSPECIFIED = 0; + + // StoredInfoType version is being created. + PENDING = 1; + + // StoredInfoType version is ready for use. + READY = 2; + + // StoredInfoType creation failed. All relevant error messages are returned in + // the `StoredInfoTypeVersion` message. + FAILED = 3; + + // StoredInfoType is no longer valid because artifacts stored in + // user-controlled storage were modified. To fix an invalid StoredInfoType, + // use the `UpdateStoredInfoType` method to create a new version. + INVALID = 4; +} diff --git a/packages/google-privacy-dlp/protos/google/privacy/dlp/v2/storage.proto b/packages/google-privacy-dlp/protos/google/privacy/dlp/v2/storage.proto index 5c2ca5031a4..54c47e9eb98 100644 --- a/packages/google-privacy-dlp/protos/google/privacy/dlp/v2/storage.proto +++ b/packages/google-privacy-dlp/protos/google/privacy/dlp/v2/storage.proto @@ -1,4 +1,4 @@ -// Copyright 2018 Google Inc. +// Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -36,6 +36,18 @@ message InfoType { string name = 1; } +// A reference to a StoredInfoType to use with scanning. +message StoredType { + // Resource name of the requested `StoredInfoType`, for example + // `organizations/433245324/storedInfoTypes/432452342` or + // `projects/project-id/storedInfoTypes/432452342`. + string name = 1; + + // Timestamp indicating when the version of the `StoredInfoType` used for + // inspection was created. Output-only field, populated by the system. + google.protobuf.Timestamp create_time = 2; +} + // Custom information type provided by the user. Used to find domain-specific // sensitive information configurable to the data in question. message CustomInfoType { @@ -57,7 +69,11 @@ message CustomInfoType { // // Dictionary words containing a large number of characters that are not // letters or digits may result in unexpected findings because such characters - // are treated as whitespace. + // are treated as whitespace. The + // [limits](https://cloud.google.com/dlp/limits) page contains details about + // the size limits of dictionaries. For dictionaries that do not fit within + // these constraints, consider using `LargeCustomDictionaryConfig` in the + // `StoredInfoType` API. message Dictionary { // Message defining a list of words or phrases to search for in the data. message WordList { @@ -173,6 +189,10 @@ message CustomInfoType { // Message for detecting output from deidentification transformations that // support reversing. SurrogateType surrogate_type = 4; + + // Load an existing `StoredInfoType` resource for use in + // `InspectDataSource`. Not currently supported in `InspectContent`. + StoredType stored_type = 5; } // Set of detection rules to apply to all findings of this CustomInfoType. @@ -244,9 +264,16 @@ message CloudStorageOptions { FileSet file_set = 1; // Max number of bytes to scan from a file. If a scanned file's size is bigger - // than this value then the rest of the bytes are omitted. + // than this value then the rest of the bytes are omitted. Only one + // of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. int64 bytes_limit_per_file = 4; + // Max percentage of bytes to scan from a file. The rest are omitted. The + // number of bytes scanned is rounded down. Must be between 0 and 100, + // inclusively. Both 0 and 100 means no limit. Defaults to 0. Only one + // of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. + int32 bytes_limit_per_file_percent = 8; + // List of file type groups to include in the scan. // If empty, all files are scanned and available data format processors // are applied. @@ -260,6 +287,13 @@ message CloudStorageOptions { int32 files_limit_percent = 7; } +// Message representing a set of files in Cloud Storage. +message CloudStorageFileSet { + // The url, in the format `gs:///`. Trailing wildcard in the + // path is allowed. + string url = 1; +} + // Message representing a single file or path in Cloud Storage. message CloudStoragePath { // A url representing a file or path (no wildcards) in Cloud Storage. @@ -291,9 +325,17 @@ message BigQueryOptions { // Max number of rows to scan. If the table has more rows than this value, the // rest of the rows are omitted. If not set, or if set to 0, all rows will be - // scanned. Cannot be used in conjunction with TimespanConfig. + // scanned. Only one of rows_limit and rows_limit_percent can be specified. + // Cannot be used in conjunction with TimespanConfig. int64 rows_limit = 3; + // Max percentage of rows to scan. The rest are omitted. The number of rows + // scanned is rounded down. Must be between 0 and 100, inclusively. Both 0 and + // 100 means no limit. Defaults to 0. Only one of rows_limit and + // rows_limit_percent can be specified. Cannot be used in conjunction with + // TimespanConfig. + int32 rows_limit_percent = 6; + SampleMethod sample_method = 4; } @@ -302,15 +344,17 @@ message StorageConfig { // Configuration of the timespan of the items to include in scanning. // Currently only supported when inspecting Google Cloud Storage and BigQuery. message TimespanConfig { - // Exclude files older than this value. + // Exclude files or rows older than this value. google.protobuf.Timestamp start_time = 1; - // Exclude files newer than this value. + // Exclude files or rows newer than this value. // If set to zero, no upper time limit is applied. google.protobuf.Timestamp end_time = 2; // Specification of the field containing the timestamp of scanned items. - // Required for data sources like Datastore or BigQuery. + // Used for data sources like Datastore or BigQuery. + // If not specified for BigQuery, table last modification timestamp + // is checked against given time span. // The valid data types of the timestamp field are: // for BigQuery - timestamp, date, datetime; // for Datastore - timestamp. @@ -429,6 +473,15 @@ message BigQueryTable { string table_id = 3; } +// Message defining a field of a BigQuery table. +message BigQueryField { + // Source table of the field. + BigQueryTable table = 1; + + // Designated field in the BigQuery table. + FieldId field = 2; +} + // An entity in a dataset is a field or set of fields that correspond to a // single person. For example, in medical records the `EntityId` might be a // patient identifier, or for financial records it might be an account diff --git a/packages/google-privacy-dlp/src/v2/doc/google/privacy/dlp/v2/doc_dlp.js b/packages/google-privacy-dlp/src/v2/doc/google/privacy/dlp/v2/doc_dlp.js index f3bb1e86552..7d2890aaa2a 100644 --- a/packages/google-privacy-dlp/src/v2/doc/google/privacy/dlp/v2/doc_dlp.js +++ b/packages/google-privacy-dlp/src/v2/doc/google/privacy/dlp/v2/doc_dlp.js @@ -29,6 +29,11 @@ * system may automatically choose what detectors to run. By default this may * be all types, but may change over time as detectors are updated. * + * The special InfoType name "ALL_BASIC" can be used to trigger all detectors, + * but may change over time as new InfoTypes are added. If you need precise + * control and predictability as to what detectors are run you should specify + * specific InfoTypes listed in the reference. + * * This object should have the same structure as [InfoType]{@link google.privacy.dlp.v2.InfoType} * * @property {number} minLikelihood @@ -3783,6 +3788,261 @@ var DeleteDeidentifyTemplateRequest = { // This is for documentation. Actual contents will be loaded by gRPC. }; +/** + * Configuration for a custom dictionary created from a data source of any size + * up to the maximum size defined in the + * [limits](https://cloud.google.com/dlp/limits) page. The artifacts of + * dictionary creation are stored in the specified Google Cloud Storage + * location. Consider using `CustomInfoType.Dictionary` for smaller dictionaries + * that satisfy the size requirements. + * + * @property {Object} outputPath + * Location to store dictionary artifacts in Google Cloud Storage. These files + * will only be accessible by project owners and the DLP API. If any of these + * artifacts are modified, the dictionary is considered invalid and can no + * longer be used. + * + * This object should have the same structure as [CloudStoragePath]{@link google.privacy.dlp.v2.CloudStoragePath} + * + * @property {Object} cloudStorageFileSet + * Set of files containing newline-delimited lists of dictionary phrases. + * + * This object should have the same structure as [CloudStorageFileSet]{@link google.privacy.dlp.v2.CloudStorageFileSet} + * + * @property {Object} bigQueryField + * Field in a BigQuery table where each cell represents a dictionary phrase. + * + * This object should have the same structure as [BigQueryField]{@link google.privacy.dlp.v2.BigQueryField} + * + * @typedef LargeCustomDictionaryConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.LargeCustomDictionaryConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var LargeCustomDictionaryConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Configuration for a StoredInfoType. + * + * @property {string} displayName + * Display name of the StoredInfoType (max 256 characters). + * + * @property {string} description + * Description of the StoredInfoType (max 256 characters). + * + * @property {Object} largeCustomDictionary + * StoredInfoType where findings are defined by a dictionary of phrases. + * + * This object should have the same structure as [LargeCustomDictionaryConfig]{@link google.privacy.dlp.v2.LargeCustomDictionaryConfig} + * + * @typedef StoredInfoTypeConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.StoredInfoTypeConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var StoredInfoTypeConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Version of a StoredInfoType, including the configuration used to build it, + * create timestamp, and current state. + * + * @property {Object} config + * StoredInfoType configuration. + * + * This object should have the same structure as [StoredInfoTypeConfig]{@link google.privacy.dlp.v2.StoredInfoTypeConfig} + * + * @property {Object} createTime + * Create timestamp of the version. Read-only, determined by the system + * when the version is created. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {number} state + * Stored info type version state. Read-only, updated by the system + * during dictionary creation. + * + * The number should be among the values of [StoredInfoTypeState]{@link google.privacy.dlp.v2.StoredInfoTypeState} + * + * @property {Object[]} errors + * Errors that occurred when creating this storedInfoType version, or + * anomalies detected in the storedInfoType data that render it unusable. Only + * the five most recent errors will be displayed, with the most recent error + * appearing first. + *

For example, some of the data for stored custom dictionaries is put in + * the user's Google Cloud Storage bucket, and if this data is modified or + * deleted by the user or another system, the dictionary becomes invalid. + *

If any errors occur, fix the problem indicated by the error message and + * use the UpdateStoredInfoType API method to create another version of the + * storedInfoType to continue using it, reusing the same `config` if it was + * not the source of the error. + * + * This object should have the same structure as [Error]{@link google.privacy.dlp.v2.Error} + * + * @typedef StoredInfoTypeVersion + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.StoredInfoTypeVersion definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var StoredInfoTypeVersion = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * StoredInfoType resource message that contains information about the current + * version and any pending updates. + * + * @property {string} name + * Resource name. + * + * @property {Object} currentVersion + * Current version of the stored info type. + * + * This object should have the same structure as [StoredInfoTypeVersion]{@link google.privacy.dlp.v2.StoredInfoTypeVersion} + * + * @property {Object[]} pendingVersions + * Pending versions of the stored info type. Empty if no versions are + * pending. + * + * This object should have the same structure as [StoredInfoTypeVersion]{@link google.privacy.dlp.v2.StoredInfoTypeVersion} + * + * @typedef StoredInfoType + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.StoredInfoType definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var StoredInfoType = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for CreateStoredInfoType. + * + * @property {string} parent + * The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * + * @property {Object} config + * Configuration of the storedInfoType to create. + * + * This object should have the same structure as [StoredInfoTypeConfig]{@link google.privacy.dlp.v2.StoredInfoTypeConfig} + * + * @property {string} storedInfoTypeId + * The storedInfoType ID can contain uppercase and lowercase letters, + * numbers, and hyphens; that is, it must match the regular + * expression: `[a-zA-Z\\d-]+`. The maximum length is 100 + * characters. Can be empty to allow the system to generate one. + * + * @typedef CreateStoredInfoTypeRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CreateStoredInfoTypeRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var CreateStoredInfoTypeRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for UpdateStoredInfoType. + * + * @property {string} name + * Resource name of organization and storedInfoType to be updated, for + * example `organizations/433245324/storedInfoTypes/432452342` or + * projects/project-id/storedInfoTypes/432452342. + * + * @property {Object} config + * Updated configuration for the storedInfoType. If not provided, a new + * version of the storedInfoType will be created with the existing + * configuration. + * + * This object should have the same structure as [StoredInfoTypeConfig]{@link google.privacy.dlp.v2.StoredInfoTypeConfig} + * + * @property {Object} updateMask + * Mask to control which fields get updated. + * + * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} + * + * @typedef UpdateStoredInfoTypeRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.UpdateStoredInfoTypeRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var UpdateStoredInfoTypeRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for GetStoredInfoType. + * + * @property {string} name + * Resource name of the organization and storedInfoType to be read, for + * example `organizations/433245324/storedInfoTypes/432452342` or + * projects/project-id/storedInfoTypes/432452342. + * + * @typedef GetStoredInfoTypeRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.GetStoredInfoTypeRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var GetStoredInfoTypeRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for ListStoredInfoTypes. + * + * @property {string} parent + * The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * + * @property {string} pageToken + * Optional page token to continue retrieval. Comes from previous call + * to `ListStoredInfoTypes`. + * + * @property {number} pageSize + * Optional size of the page, can be limited by server. If zero server returns + * a page of max size 100. + * + * @typedef ListStoredInfoTypesRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ListStoredInfoTypesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ListStoredInfoTypesRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Response message for ListStoredInfoTypes. + * + * @property {Object[]} storedInfoTypes + * List of storedInfoTypes, up to page_size in ListStoredInfoTypesRequest. + * + * This object should have the same structure as [StoredInfoType]{@link google.privacy.dlp.v2.StoredInfoType} + * + * @property {string} nextPageToken + * If the next page is available then the next page token to be used + * in following ListStoredInfoTypes request. + * + * @typedef ListStoredInfoTypesResponse + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ListStoredInfoTypesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ListStoredInfoTypesResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for DeleteStoredInfoType. + * + * @property {string} name + * Resource name of the organization and storedInfoType to be deleted, for + * example `organizations/433245324/storedInfoTypes/432452342` or + * projects/project-id/storedInfoTypes/432452342. + * + * @typedef DeleteStoredInfoTypeRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DeleteStoredInfoTypeRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DeleteStoredInfoTypeRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + /** * Options describing which parts of the provided content should be scanned. * @@ -3890,4 +4150,37 @@ var DlpJobType = { * The job executed a Risk Analysis computation. */ RISK_ANALYSIS_JOB: 2 +}; + +/** + * State of a StoredInfoType version. + * + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ +var StoredInfoTypeState = { + STORED_INFO_TYPE_STATE_UNSPECIFIED: 0, + + /** + * StoredInfoType version is being created. + */ + PENDING: 1, + + /** + * StoredInfoType version is ready for use. + */ + READY: 2, + + /** + * StoredInfoType creation failed. All relevant error messages are returned in + * the `StoredInfoTypeVersion` message. + */ + FAILED: 3, + + /** + * StoredInfoType is no longer valid because artifacts stored in + * user-controlled storage were modified. To fix an invalid StoredInfoType, + * use the `UpdateStoredInfoType` method to create a new version. + */ + INVALID: 4 }; \ No newline at end of file diff --git a/packages/google-privacy-dlp/src/v2/doc/google/privacy/dlp/v2/doc_storage.js b/packages/google-privacy-dlp/src/v2/doc/google/privacy/dlp/v2/doc_storage.js index ed4ccc06d74..28b0576a17a 100644 --- a/packages/google-privacy-dlp/src/v2/doc/google/privacy/dlp/v2/doc_storage.js +++ b/packages/google-privacy-dlp/src/v2/doc/google/privacy/dlp/v2/doc_storage.js @@ -32,6 +32,28 @@ var InfoType = { // This is for documentation. Actual contents will be loaded by gRPC. }; +/** + * A reference to a StoredInfoType to use with scanning. + * + * @property {string} name + * Resource name of the requested `StoredInfoType`, for example + * `organizations/433245324/storedInfoTypes/432452342` or + * `projects/project-id/storedInfoTypes/432452342`. + * + * @property {Object} createTime + * Timestamp indicating when the version of the `StoredInfoType` used for + * inspection was created. Output-only field, populated by the system. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @typedef StoredType + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.StoredType definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var StoredType = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + /** * Custom information type provided by the user. Used to find domain-specific * sensitive information configurable to the data in question. @@ -65,6 +87,12 @@ var InfoType = { * * This object should have the same structure as [SurrogateType]{@link google.privacy.dlp.v2.SurrogateType} * + * @property {Object} storedType + * Load an existing `StoredInfoType` resource for use in + * `InspectDataSource`. Not currently supported in `InspectContent`. + * + * This object should have the same structure as [StoredType]{@link google.privacy.dlp.v2.StoredType} + * * @property {Object[]} detectionRules * Set of detection rules to apply to all findings of this CustomInfoType. * Rules are applied in order that they are specified. Not supported for the @@ -98,7 +126,11 @@ var CustomInfoType = { * * Dictionary words containing a large number of characters that are not * letters or digits may result in unexpected findings because such characters - * are treated as whitespace. + * are treated as whitespace. The + * [limits](https://cloud.google.com/dlp/limits) page contains details about + * the size limits of dictionaries. For dictionaries that do not fit within + * these constraints, consider using `LargeCustomDictionaryConfig` in the + * `StoredInfoType` API. * * @property {Object} wordList * List of words or phrases to search for. @@ -345,7 +377,14 @@ var DatastoreOptions = { * * @property {number} bytesLimitPerFile * Max number of bytes to scan from a file. If a scanned file's size is bigger - * than this value then the rest of the bytes are omitted. + * than this value then the rest of the bytes are omitted. Only one + * of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. + * + * @property {number} bytesLimitPerFilePercent + * Max percentage of bytes to scan from a file. The rest are omitted. The + * number of bytes scanned is rounded down. Must be between 0 and 100, + * inclusively. Both 0 and 100 means no limit. Defaults to 0. Only one + * of bytes_limit_per_file and bytes_limit_per_file_percent can be specified. * * @property {number[]} fileTypes * List of file type groups to include in the scan. @@ -408,6 +447,21 @@ var CloudStorageOptions = { } }; +/** + * Message representing a set of files in Cloud Storage. + * + * @property {string} url + * The url, in the format `gs:///`. Trailing wildcard in the + * path is allowed. + * + * @typedef CloudStorageFileSet + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CloudStorageFileSet definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var CloudStorageFileSet = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + /** * Message representing a single file or path in Cloud Storage. * @@ -440,7 +494,15 @@ var CloudStoragePath = { * @property {number} rowsLimit * Max number of rows to scan. If the table has more rows than this value, the * rest of the rows are omitted. If not set, or if set to 0, all rows will be - * scanned. Cannot be used in conjunction with TimespanConfig. + * scanned. Only one of rows_limit and rows_limit_percent can be specified. + * Cannot be used in conjunction with TimespanConfig. + * + * @property {number} rowsLimitPercent + * Max percentage of rows to scan. The rest are omitted. The number of rows + * scanned is rounded down. Must be between 0 and 100, inclusively. Both 0 and + * 100 means no limit. Defaults to 0. Only one of rows_limit and + * rows_limit_percent can be specified. Cannot be used in conjunction with + * TimespanConfig. * * @property {number} sampleMethod * The number should be among the values of [SampleMethod]{@link google.privacy.dlp.v2.SampleMethod} @@ -508,19 +570,21 @@ var StorageConfig = { * Currently only supported when inspecting Google Cloud Storage and BigQuery. * * @property {Object} startTime - * Exclude files older than this value. + * Exclude files or rows older than this value. * * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} * * @property {Object} endTime - * Exclude files newer than this value. + * Exclude files or rows newer than this value. * If set to zero, no upper time limit is applied. * * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} * * @property {Object} timestampField * Specification of the field containing the timestamp of scanned items. - * Required for data sources like Datastore or BigQuery. + * Used for data sources like Datastore or BigQuery. + * If not specified for BigQuery, table last modification timestamp + * is checked against given time span. * The valid data types of the timestamp field are: * for BigQuery - timestamp, date, datetime; * for Datastore - timestamp. @@ -687,6 +751,27 @@ var BigQueryTable = { // This is for documentation. Actual contents will be loaded by gRPC. }; +/** + * Message defining a field of a BigQuery table. + * + * @property {Object} table + * Source table of the field. + * + * This object should have the same structure as [BigQueryTable]{@link google.privacy.dlp.v2.BigQueryTable} + * + * @property {Object} field + * Designated field in the BigQuery table. + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @typedef BigQueryField + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.BigQueryField definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var BigQueryField = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + /** * An entity in a dataset is a field or set of fields that correspond to a * single person. For example, in medical records the `EntityId` might be a diff --git a/packages/google-privacy-dlp/synth.py b/packages/google-privacy-dlp/synth.py index 8f169385959..a972bb0a07f 100644 --- a/packages/google-privacy-dlp/synth.py +++ b/packages/google-privacy-dlp/synth.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - """This script is used to synthesize generated parts of this library.""" import synthtool as s @@ -22,26 +21,13 @@ common_templates = gcp.CommonTemplates() version = 'v2' -library = gapic.node_library('dlp', version, - config_path='/google/privacy/dlp/artman_dlp_v2.yaml' -) -s.copy(library, - excludes=['README.md', 'package.json'] -) +library = gapic.node_library( + 'dlp', version, config_path='/google/privacy/dlp/artman_dlp_v2.yaml') +s.copy(library, excludes=['src/index.js', 'README.md', 'package.json']) -templates = common_templates.node_library(package_name="@google-cloud/dlp") +templates = common_templates.node_library( + package_name="@google-cloud/dlp", repo_name="googleapis/nodejs-dlp") s.copy(templates) - - -''' -Replace the namespace so RPC types documentation are linked properly. -''' -s.replace( - 'src/index.js', - '\* @namespace google.cloud', - '* @namespace google.privacy', -) - ''' Node.js specific cleanup '''