From 5b54b2e9c63acee3022089d9fb94d8b1907c1eb2 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 5 Jan 2023 20:46:23 +0000 Subject: [PATCH] chore: Enable requesting numeric enums in "transport=rest" responses for services supporting this (Java, Go, Python, PHP, TypeScript, C#, and Ruby), even if they do not yet turn on REST transport (#785) - [ ] Regenerate this pull request now. chore: disallow "transport=rest" for services where numeric enums are not confirmed to be supported (except in PHP and Java) PiperOrigin-RevId: 493113566 Source-Link: https://togithub.com/googleapis/googleapis/commit/758f0d1217d9c7fe398aa5efb1057ce4b6409e55 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/78bd8f05e1276363eb14eae70e91fe4bc20703ab Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzhiZDhmMDVlMTI3NjM2M2ViMTRlYWU3MGU5MWZlNGJjMjA3MDNhYiJ9 BEGIN_NESTED_COMMIT feat: ExcludeByHotword added as an ExclusionRule type, NEW_ZEALAND added as a LocationCategory value PiperOrigin-RevId: 487581128 Source-Link: https://togithub.com/googleapis/googleapis/commit/9140e5546470d945fc741f27707aa68f562088f0 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/502b50e61710bca3d774cb918314cb1ef39e6fe9 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTAyYjUwZTYxNzEwYmNhM2Q3NzRjYjkxODMxNGNiMWVmMzllNmZlOSJ9 END_NESTED_COMMIT --- protos/google/privacy/dlp/v2/dlp.proto | 35 ++- protos/google/privacy/dlp/v2/storage.proto | 2 +- protos/protos.d.ts | 116 ++++++- protos/protos.js | 285 +++++++++++++++++- protos/protos.json | 22 +- .../v2/dlp_service.deidentify_content.js | 6 + ...nippet_metadata.google.privacy.dlp.v2.json | 2 +- src/v2/dlp_service_client.ts | 10 + 8 files changed, 465 insertions(+), 13 deletions(-) diff --git a/protos/google/privacy/dlp/v2/dlp.proto b/protos/google/privacy/dlp/v2/dlp.proto index 7e243ddd..c11a1f1d 100644 --- a/protos/google/privacy/dlp/v2/dlp.proto +++ b/protos/google/privacy/dlp/v2/dlp.proto @@ -673,6 +673,20 @@ message ExcludeInfoTypes { repeated InfoType info_types = 1; } +// The rule to exclude findings based on a hotword. For record inspection of +// tables, column names are considered hotwords. An example of this is to +// exclude a finding if a BigQuery column matches a specific pattern. +message ExcludeByHotword { + // Regular expression pattern defining what qualifies as a hotword. + CustomInfoType.Regex hotword_regex = 1; + + // Range of characters within which the entire hotword must reside. + // The total length of the window cannot exceed 1000 characters. + // The windowBefore property in proximity should be set to 1 if the hotword + // needs to be included in a column header. + CustomInfoType.DetectionRule.Proximity proximity = 2; +} + // The rule that specifies conditions when findings of infoTypes specified in // `InspectionRuleSet` are removed from results. message ExclusionRule { @@ -686,6 +700,10 @@ message ExclusionRule { // Set of infoTypes for which findings would affect this rule. ExcludeInfoTypes exclude_info_types = 3; + + // Drop if the hotword rule is contained in the proximate context. For + // tabular data, the context includes the column name. + ExcludeByHotword exclude_by_hotword = 5; } // How the rule is applied, see MatchingType documentation for details. @@ -862,7 +880,6 @@ message ByteContentItem { bytes data = 2; } -// Container structure for the content to inspect. message ContentItem { // Data of the item either in the byte array or UTF-8 string form, or table. oneof data_item { @@ -1289,6 +1306,13 @@ message DeidentifyContentRequest { InspectConfig inspect_config = 3; // The item to de-identify. Will be treated as text. + // + // This value must be of type + // [Table][google.privacy.dlp.v2.Table] if your + // [deidentify_config][google.privacy.dlp.v2.DeidentifyContentRequest.deidentify_config] + // is a + // [RecordTransformations][google.privacy.dlp.v2.RecordTransformations] + // object. ContentItem item = 4; // Template to use. Any configuration directly specified in @@ -1705,6 +1729,9 @@ message InfoTypeCategory { // The infoType is typically used in Google internally. INTERNAL = 40; + + // The infoType is typically used in New Zealand. + NEW_ZEALAND = 41; } // Enum of the current industries in the category. @@ -3716,8 +3743,9 @@ message Action { // Create a de-identified copy of the input data. Deidentify deidentify = 7; - // Enable email notification for project owners and editors on job's - // completion/failure. + // Sends an email when the job completes. The email goes to IAM project + // owners and technical [Essential + // Contacts](https://cloud.google.com/resource-manager/docs/managing-notification-contacts). JobNotificationEmails job_notification_emails = 8; // Enable Stackdriver metric dlp.googleapis.com/finding_count. @@ -5249,6 +5277,7 @@ message TableDataProfile { int64 table_size_bytes = 12; // Number of rows in the table when the profile was generated. + // This will not be populated for BigLake tables. int64 row_count = 13; // How the table is encrypted. diff --git a/protos/google/privacy/dlp/v2/storage.proto b/protos/google/privacy/dlp/v2/storage.proto index 7709f546..f746e63d 100644 --- a/protos/google/privacy/dlp/v2/storage.proto +++ b/protos/google/privacy/dlp/v2/storage.proto @@ -33,7 +33,7 @@ message InfoType { // creating a CustomInfoType, or one of the names listed // at https://cloud.google.com/dlp/docs/infotypes-reference when specifying // a built-in type. When sending Cloud DLP results to Data Catalog, infoType - // names should conform to the pattern `[A-Za-z0-9$-_]{1,64}`. + // names should conform to the pattern `[A-Za-z0-9$_-]{1,64}`. string name = 1; // Optional version name for this InfoType. diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 91360e85..9ee64794 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -861,6 +861,109 @@ export namespace google { public static getTypeUrl(typeUrlPrefix?: string): string; } + /** Properties of an ExcludeByHotword. */ + interface IExcludeByHotword { + + /** ExcludeByHotword hotwordRegex */ + hotwordRegex?: (google.privacy.dlp.v2.CustomInfoType.IRegex|null); + + /** ExcludeByHotword proximity */ + proximity?: (google.privacy.dlp.v2.CustomInfoType.DetectionRule.IProximity|null); + } + + /** Represents an ExcludeByHotword. */ + class ExcludeByHotword implements IExcludeByHotword { + + /** + * Constructs a new ExcludeByHotword. + * @param [properties] Properties to set + */ + constructor(properties?: google.privacy.dlp.v2.IExcludeByHotword); + + /** ExcludeByHotword hotwordRegex. */ + public hotwordRegex?: (google.privacy.dlp.v2.CustomInfoType.IRegex|null); + + /** ExcludeByHotword proximity. */ + public proximity?: (google.privacy.dlp.v2.CustomInfoType.DetectionRule.IProximity|null); + + /** + * Creates a new ExcludeByHotword instance using the specified properties. + * @param [properties] Properties to set + * @returns ExcludeByHotword instance + */ + public static create(properties?: google.privacy.dlp.v2.IExcludeByHotword): google.privacy.dlp.v2.ExcludeByHotword; + + /** + * Encodes the specified ExcludeByHotword message. Does not implicitly {@link google.privacy.dlp.v2.ExcludeByHotword.verify|verify} messages. + * @param message ExcludeByHotword message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encode(message: google.privacy.dlp.v2.IExcludeByHotword, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Encodes the specified ExcludeByHotword message, length delimited. Does not implicitly {@link google.privacy.dlp.v2.ExcludeByHotword.verify|verify} messages. + * @param message ExcludeByHotword message or plain object to encode + * @param [writer] Writer to encode to + * @returns Writer + */ + public static encodeDelimited(message: google.privacy.dlp.v2.IExcludeByHotword, writer?: $protobuf.Writer): $protobuf.Writer; + + /** + * Decodes an ExcludeByHotword message from the specified reader or buffer. + * @param reader Reader or buffer to decode from + * @param [length] Message length if known beforehand + * @returns ExcludeByHotword + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): google.privacy.dlp.v2.ExcludeByHotword; + + /** + * Decodes an ExcludeByHotword message from the specified reader or buffer, length delimited. + * @param reader Reader or buffer to decode from + * @returns ExcludeByHotword + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): google.privacy.dlp.v2.ExcludeByHotword; + + /** + * Verifies an ExcludeByHotword message. + * @param message Plain object to verify + * @returns `null` if valid, otherwise the reason why it is not + */ + public static verify(message: { [k: string]: any }): (string|null); + + /** + * Creates an ExcludeByHotword message from a plain object. Also converts values to their respective internal types. + * @param object Plain object + * @returns ExcludeByHotword + */ + public static fromObject(object: { [k: string]: any }): google.privacy.dlp.v2.ExcludeByHotword; + + /** + * Creates a plain object from an ExcludeByHotword message. Also converts values to other types if specified. + * @param message ExcludeByHotword + * @param [options] Conversion options + * @returns Plain object + */ + public static toObject(message: google.privacy.dlp.v2.ExcludeByHotword, options?: $protobuf.IConversionOptions): { [k: string]: any }; + + /** + * Converts this ExcludeByHotword to JSON. + * @returns JSON object + */ + public toJSON(): { [k: string]: any }; + + /** + * Gets the default type url for ExcludeByHotword + * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns The default type url + */ + public static getTypeUrl(typeUrlPrefix?: string): string; + } + /** Properties of an ExclusionRule. */ interface IExclusionRule { @@ -873,6 +976,9 @@ export namespace google { /** ExclusionRule excludeInfoTypes */ excludeInfoTypes?: (google.privacy.dlp.v2.IExcludeInfoTypes|null); + /** ExclusionRule excludeByHotword */ + excludeByHotword?: (google.privacy.dlp.v2.IExcludeByHotword|null); + /** ExclusionRule matchingType */ matchingType?: (google.privacy.dlp.v2.MatchingType|keyof typeof google.privacy.dlp.v2.MatchingType|null); } @@ -895,11 +1001,14 @@ export namespace google { /** ExclusionRule excludeInfoTypes. */ public excludeInfoTypes?: (google.privacy.dlp.v2.IExcludeInfoTypes|null); + /** ExclusionRule excludeByHotword. */ + public excludeByHotword?: (google.privacy.dlp.v2.IExcludeByHotword|null); + /** ExclusionRule matchingType. */ public matchingType: (google.privacy.dlp.v2.MatchingType|keyof typeof google.privacy.dlp.v2.MatchingType); /** ExclusionRule type. */ - public type?: ("dictionary"|"regex"|"excludeInfoTypes"); + public type?: ("dictionary"|"regex"|"excludeInfoTypes"|"excludeByHotword"); /** * Creates a new ExclusionRule instance using the specified properties. @@ -5549,7 +5658,8 @@ export namespace google { UNITED_STATES = 37, URUGUAY = 38, VENEZUELA = 39, - INTERNAL = 40 + INTERNAL = 40, + NEW_ZEALAND = 41 } /** IndustryCategory enum. */ diff --git a/protos/protos.js b/protos/protos.js index 84c7ae9e..98aba168 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -1447,6 +1447,243 @@ return ExcludeInfoTypes; })(); + v2.ExcludeByHotword = (function() { + + /** + * Properties of an ExcludeByHotword. + * @memberof google.privacy.dlp.v2 + * @interface IExcludeByHotword + * @property {google.privacy.dlp.v2.CustomInfoType.IRegex|null} [hotwordRegex] ExcludeByHotword hotwordRegex + * @property {google.privacy.dlp.v2.CustomInfoType.DetectionRule.IProximity|null} [proximity] ExcludeByHotword proximity + */ + + /** + * Constructs a new ExcludeByHotword. + * @memberof google.privacy.dlp.v2 + * @classdesc Represents an ExcludeByHotword. + * @implements IExcludeByHotword + * @constructor + * @param {google.privacy.dlp.v2.IExcludeByHotword=} [properties] Properties to set + */ + function ExcludeByHotword(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExcludeByHotword hotwordRegex. + * @member {google.privacy.dlp.v2.CustomInfoType.IRegex|null|undefined} hotwordRegex + * @memberof google.privacy.dlp.v2.ExcludeByHotword + * @instance + */ + ExcludeByHotword.prototype.hotwordRegex = null; + + /** + * ExcludeByHotword proximity. + * @member {google.privacy.dlp.v2.CustomInfoType.DetectionRule.IProximity|null|undefined} proximity + * @memberof google.privacy.dlp.v2.ExcludeByHotword + * @instance + */ + ExcludeByHotword.prototype.proximity = null; + + /** + * Creates a new ExcludeByHotword instance using the specified properties. + * @function create + * @memberof google.privacy.dlp.v2.ExcludeByHotword + * @static + * @param {google.privacy.dlp.v2.IExcludeByHotword=} [properties] Properties to set + * @returns {google.privacy.dlp.v2.ExcludeByHotword} ExcludeByHotword instance + */ + ExcludeByHotword.create = function create(properties) { + return new ExcludeByHotword(properties); + }; + + /** + * Encodes the specified ExcludeByHotword message. Does not implicitly {@link google.privacy.dlp.v2.ExcludeByHotword.verify|verify} messages. + * @function encode + * @memberof google.privacy.dlp.v2.ExcludeByHotword + * @static + * @param {google.privacy.dlp.v2.IExcludeByHotword} message ExcludeByHotword message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExcludeByHotword.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.hotwordRegex != null && Object.hasOwnProperty.call(message, "hotwordRegex")) + $root.google.privacy.dlp.v2.CustomInfoType.Regex.encode(message.hotwordRegex, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.proximity != null && Object.hasOwnProperty.call(message, "proximity")) + $root.google.privacy.dlp.v2.CustomInfoType.DetectionRule.Proximity.encode(message.proximity, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExcludeByHotword message, length delimited. Does not implicitly {@link google.privacy.dlp.v2.ExcludeByHotword.verify|verify} messages. + * @function encodeDelimited + * @memberof google.privacy.dlp.v2.ExcludeByHotword + * @static + * @param {google.privacy.dlp.v2.IExcludeByHotword} message ExcludeByHotword message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExcludeByHotword.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExcludeByHotword message from the specified reader or buffer. + * @function decode + * @memberof google.privacy.dlp.v2.ExcludeByHotword + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.privacy.dlp.v2.ExcludeByHotword} ExcludeByHotword + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExcludeByHotword.decode = function decode(reader, length) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.privacy.dlp.v2.ExcludeByHotword(); + while (reader.pos < end) { + var tag = reader.uint32(); + switch (tag >>> 3) { + case 1: { + message.hotwordRegex = $root.google.privacy.dlp.v2.CustomInfoType.Regex.decode(reader, reader.uint32()); + break; + } + case 2: { + message.proximity = $root.google.privacy.dlp.v2.CustomInfoType.DetectionRule.Proximity.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExcludeByHotword message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.privacy.dlp.v2.ExcludeByHotword + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.privacy.dlp.v2.ExcludeByHotword} ExcludeByHotword + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExcludeByHotword.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExcludeByHotword message. + * @function verify + * @memberof google.privacy.dlp.v2.ExcludeByHotword + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExcludeByHotword.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.hotwordRegex != null && message.hasOwnProperty("hotwordRegex")) { + var error = $root.google.privacy.dlp.v2.CustomInfoType.Regex.verify(message.hotwordRegex); + if (error) + return "hotwordRegex." + error; + } + if (message.proximity != null && message.hasOwnProperty("proximity")) { + var error = $root.google.privacy.dlp.v2.CustomInfoType.DetectionRule.Proximity.verify(message.proximity); + if (error) + return "proximity." + error; + } + return null; + }; + + /** + * Creates an ExcludeByHotword message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.privacy.dlp.v2.ExcludeByHotword + * @static + * @param {Object.} object Plain object + * @returns {google.privacy.dlp.v2.ExcludeByHotword} ExcludeByHotword + */ + ExcludeByHotword.fromObject = function fromObject(object) { + if (object instanceof $root.google.privacy.dlp.v2.ExcludeByHotword) + return object; + var message = new $root.google.privacy.dlp.v2.ExcludeByHotword(); + if (object.hotwordRegex != null) { + if (typeof object.hotwordRegex !== "object") + throw TypeError(".google.privacy.dlp.v2.ExcludeByHotword.hotwordRegex: object expected"); + message.hotwordRegex = $root.google.privacy.dlp.v2.CustomInfoType.Regex.fromObject(object.hotwordRegex); + } + if (object.proximity != null) { + if (typeof object.proximity !== "object") + throw TypeError(".google.privacy.dlp.v2.ExcludeByHotword.proximity: object expected"); + message.proximity = $root.google.privacy.dlp.v2.CustomInfoType.DetectionRule.Proximity.fromObject(object.proximity); + } + return message; + }; + + /** + * Creates a plain object from an ExcludeByHotword message. Also converts values to other types if specified. + * @function toObject + * @memberof google.privacy.dlp.v2.ExcludeByHotword + * @static + * @param {google.privacy.dlp.v2.ExcludeByHotword} message ExcludeByHotword + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExcludeByHotword.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.hotwordRegex = null; + object.proximity = null; + } + if (message.hotwordRegex != null && message.hasOwnProperty("hotwordRegex")) + object.hotwordRegex = $root.google.privacy.dlp.v2.CustomInfoType.Regex.toObject(message.hotwordRegex, options); + if (message.proximity != null && message.hasOwnProperty("proximity")) + object.proximity = $root.google.privacy.dlp.v2.CustomInfoType.DetectionRule.Proximity.toObject(message.proximity, options); + return object; + }; + + /** + * Converts this ExcludeByHotword to JSON. + * @function toJSON + * @memberof google.privacy.dlp.v2.ExcludeByHotword + * @instance + * @returns {Object.} JSON object + */ + ExcludeByHotword.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExcludeByHotword + * @function getTypeUrl + * @memberof google.privacy.dlp.v2.ExcludeByHotword + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExcludeByHotword.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.privacy.dlp.v2.ExcludeByHotword"; + }; + + return ExcludeByHotword; + })(); + v2.ExclusionRule = (function() { /** @@ -1456,6 +1693,7 @@ * @property {google.privacy.dlp.v2.CustomInfoType.IDictionary|null} [dictionary] ExclusionRule dictionary * @property {google.privacy.dlp.v2.CustomInfoType.IRegex|null} [regex] ExclusionRule regex * @property {google.privacy.dlp.v2.IExcludeInfoTypes|null} [excludeInfoTypes] ExclusionRule excludeInfoTypes + * @property {google.privacy.dlp.v2.IExcludeByHotword|null} [excludeByHotword] ExclusionRule excludeByHotword * @property {google.privacy.dlp.v2.MatchingType|null} [matchingType] ExclusionRule matchingType */ @@ -1498,6 +1736,14 @@ */ ExclusionRule.prototype.excludeInfoTypes = null; + /** + * ExclusionRule excludeByHotword. + * @member {google.privacy.dlp.v2.IExcludeByHotword|null|undefined} excludeByHotword + * @memberof google.privacy.dlp.v2.ExclusionRule + * @instance + */ + ExclusionRule.prototype.excludeByHotword = null; + /** * ExclusionRule matchingType. * @member {google.privacy.dlp.v2.MatchingType} matchingType @@ -1511,12 +1757,12 @@ /** * ExclusionRule type. - * @member {"dictionary"|"regex"|"excludeInfoTypes"|undefined} type + * @member {"dictionary"|"regex"|"excludeInfoTypes"|"excludeByHotword"|undefined} type * @memberof google.privacy.dlp.v2.ExclusionRule * @instance */ Object.defineProperty(ExclusionRule.prototype, "type", { - get: $util.oneOfGetter($oneOfFields = ["dictionary", "regex", "excludeInfoTypes"]), + get: $util.oneOfGetter($oneOfFields = ["dictionary", "regex", "excludeInfoTypes", "excludeByHotword"]), set: $util.oneOfSetter($oneOfFields) }); @@ -1552,6 +1798,8 @@ $root.google.privacy.dlp.v2.ExcludeInfoTypes.encode(message.excludeInfoTypes, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); if (message.matchingType != null && Object.hasOwnProperty.call(message, "matchingType")) writer.uint32(/* id 4, wireType 0 =*/32).int32(message.matchingType); + if (message.excludeByHotword != null && Object.hasOwnProperty.call(message, "excludeByHotword")) + $root.google.privacy.dlp.v2.ExcludeByHotword.encode(message.excludeByHotword, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); return writer; }; @@ -1598,6 +1846,10 @@ message.excludeInfoTypes = $root.google.privacy.dlp.v2.ExcludeInfoTypes.decode(reader, reader.uint32()); break; } + case 5: { + message.excludeByHotword = $root.google.privacy.dlp.v2.ExcludeByHotword.decode(reader, reader.uint32()); + break; + } case 4: { message.matchingType = reader.int32(); break; @@ -1666,6 +1918,16 @@ return "excludeInfoTypes." + error; } } + if (message.excludeByHotword != null && message.hasOwnProperty("excludeByHotword")) { + if (properties.type === 1) + return "type: multiple values"; + properties.type = 1; + { + var error = $root.google.privacy.dlp.v2.ExcludeByHotword.verify(message.excludeByHotword); + if (error) + return "excludeByHotword." + error; + } + } if (message.matchingType != null && message.hasOwnProperty("matchingType")) switch (message.matchingType) { default: @@ -1706,6 +1968,11 @@ throw TypeError(".google.privacy.dlp.v2.ExclusionRule.excludeInfoTypes: object expected"); message.excludeInfoTypes = $root.google.privacy.dlp.v2.ExcludeInfoTypes.fromObject(object.excludeInfoTypes); } + if (object.excludeByHotword != null) { + if (typeof object.excludeByHotword !== "object") + throw TypeError(".google.privacy.dlp.v2.ExclusionRule.excludeByHotword: object expected"); + message.excludeByHotword = $root.google.privacy.dlp.v2.ExcludeByHotword.fromObject(object.excludeByHotword); + } switch (object.matchingType) { default: if (typeof object.matchingType === "number") { @@ -1765,6 +2032,11 @@ } if (message.matchingType != null && message.hasOwnProperty("matchingType")) object.matchingType = options.enums === String ? $root.google.privacy.dlp.v2.MatchingType[message.matchingType] === undefined ? message.matchingType : $root.google.privacy.dlp.v2.MatchingType[message.matchingType] : message.matchingType; + if (message.excludeByHotword != null && message.hasOwnProperty("excludeByHotword")) { + object.excludeByHotword = $root.google.privacy.dlp.v2.ExcludeByHotword.toObject(message.excludeByHotword, options); + if (options.oneofs) + object.type = "excludeByHotword"; + } return object; }; @@ -13445,6 +13717,7 @@ case 38: case 39: case 40: + case 41: break; } } @@ -13666,6 +13939,10 @@ case 40: message.locationCategory = 40; break; + case "NEW_ZEALAND": + case 41: + message.locationCategory = 41; + break; } switch (object.industryCategory) { default: @@ -13836,6 +14113,7 @@ * @property {number} URUGUAY=38 URUGUAY value * @property {number} VENEZUELA=39 VENEZUELA value * @property {number} INTERNAL=40 INTERNAL value + * @property {number} NEW_ZEALAND=41 NEW_ZEALAND value */ InfoTypeCategory.LocationCategory = (function() { var valuesById = {}, values = Object.create(valuesById); @@ -13880,6 +14158,7 @@ values[valuesById[38] = "URUGUAY"] = 38; values[valuesById[39] = "VENEZUELA"] = 39; values[valuesById[40] = "INTERNAL"] = 40; + values[valuesById[41] = "NEW_ZEALAND"] = 41; return values; })(); diff --git a/protos/protos.json b/protos/protos.json index b891e02f..e4a9b007 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -977,13 +977,26 @@ } } }, + "ExcludeByHotword": { + "fields": { + "hotwordRegex": { + "type": "CustomInfoType.Regex", + "id": 1 + }, + "proximity": { + "type": "CustomInfoType.DetectionRule.Proximity", + "id": 2 + } + } + }, "ExclusionRule": { "oneofs": { "type": { "oneof": [ "dictionary", "regex", - "excludeInfoTypes" + "excludeInfoTypes", + "excludeByHotword" ] } }, @@ -1000,6 +1013,10 @@ "type": "ExcludeInfoTypes", "id": 3 }, + "excludeByHotword": { + "type": "ExcludeByHotword", + "id": 5 + }, "matchingType": { "type": "MatchingType", "id": 4 @@ -1897,7 +1914,8 @@ "UNITED_STATES": 37, "URUGUAY": 38, "VENEZUELA": 39, - "INTERNAL": 40 + "INTERNAL": 40, + "NEW_ZEALAND": 41 } }, "IndustryCategory": { diff --git a/samples/generated/v2/dlp_service.deidentify_content.js b/samples/generated/v2/dlp_service.deidentify_content.js index 3ce07d23..95975ebf 100644 --- a/samples/generated/v2/dlp_service.deidentify_content.js +++ b/samples/generated/v2/dlp_service.deidentify_content.js @@ -57,6 +57,12 @@ function main() { // const inspectConfig = {} /** * The item to de-identify. Will be treated as text. + * This value must be of type + * Table google.privacy.dlp.v2.Table if your + * deidentify_config google.privacy.dlp.v2.DeidentifyContentRequest.deidentify_config + * is a + * RecordTransformations google.privacy.dlp.v2.RecordTransformations + * object. */ // const item = {} /** diff --git a/samples/generated/v2/snippet_metadata.google.privacy.dlp.v2.json b/samples/generated/v2/snippet_metadata.google.privacy.dlp.v2.json index 394368f3..263c3a70 100644 --- a/samples/generated/v2/snippet_metadata.google.privacy.dlp.v2.json +++ b/samples/generated/v2/snippet_metadata.google.privacy.dlp.v2.json @@ -138,7 +138,7 @@ "segments": [ { "start": 25, - "end": 95, + "end": 101, "type": "FULL" } ], diff --git a/src/v2/dlp_service_client.ts b/src/v2/dlp_service_client.ts index 90908f52..df9e50af 100644 --- a/src/v2/dlp_service_client.ts +++ b/src/v2/dlp_service_client.ts @@ -131,6 +131,9 @@ export class DlpServiceClient { (typeof window !== 'undefined' && typeof window?.fetch === 'function'); opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; @@ -733,6 +736,13 @@ export class DlpServiceClient { * inspect_template_name argument. * @param {google.privacy.dlp.v2.ContentItem} request.item * The item to de-identify. Will be treated as text. + * + * This value must be of type + * {@link google.privacy.dlp.v2.Table|Table} if your + * {@link google.privacy.dlp.v2.DeidentifyContentRequest.deidentify_config|deidentify_config} + * is a + * {@link google.privacy.dlp.v2.RecordTransformations|RecordTransformations} + * object. * @param {string} request.inspectTemplateName * Template to use. Any configuration directly specified in * inspect_config will override those set in the template. Singular fields