diff --git a/packages/google-privacy-dlp/.cloud-repo-tools.json b/packages/google-privacy-dlp/.cloud-repo-tools.json index 1d7499caa6b..b14df37cd3d 100644 --- a/packages/google-privacy-dlp/.cloud-repo-tools.json +++ b/packages/google-privacy-dlp/.cloud-repo-tools.json @@ -1,10 +1,6 @@ { "requiresKeyFile": true, "requiresProjectId": true, - "requiredEnvVars": [ - "DLP_DEID_WRAPPED_KEY", - "DLP_DEID_KEY_NAME" - ], "product": "dlp", "client_reference_url": "https://cloud.google.com/nodejs/docs/reference/dlp/latest/", "release_quality": "beta", @@ -43,6 +39,27 @@ "file": "risk.js", "docs_link": "https://cloud.google.com/dlp/docs", "usage": "node risk.js --help" + }, + { + "id": "templates", + "name": "Inspect Templates", + "file": "templates.js", + "docs_link": "https://cloud.google.com/dlp/docs", + "usage": "node templates.js --help" + }, + { + "id": "jobs", + "name": "Job Management", + "file": "jobs.js", + "docs_link": "https://cloud.google.com/dlp/docs", + "usage": "node jobs.js --help" + }, + { + "id": "triggers", + "name": "Job Triggers", + "file": "triggers.js", + "docs_link": "https://cloud.google.com/dlp/docs", + "usage": "node triggers.js --help" } ] } diff --git a/packages/google-privacy-dlp/.gitignore b/packages/google-privacy-dlp/.gitignore index 6b80718f261..b7d407606fb 100644 --- a/packages/google-privacy-dlp/.gitignore +++ b/packages/google-privacy-dlp/.gitignore @@ -7,4 +7,3 @@ out/ system-test/secrets.js system-test/*key.json *.lock -*-lock.js* diff --git a/packages/google-privacy-dlp/.mailmap b/packages/google-privacy-dlp/.mailmap index 480e8418a06..60d394706d1 100644 --- a/packages/google-privacy-dlp/.mailmap +++ b/packages/google-privacy-dlp/.mailmap @@ -3,3 +3,4 @@ Jason Dobry Jason Dobry Luke Sneeringer Luke Sneeringer Stephen Sawchuk Stephen Sawchuk Stephen Sawchuk Stephen Sawchuk +Alexander Fenster Alexander Fenster diff --git a/packages/google-privacy-dlp/CONTRIBUTORS b/packages/google-privacy-dlp/CONTRIBUTORS index e04cad20651..2c88150a60a 100644 --- a/packages/google-privacy-dlp/CONTRIBUTORS +++ b/packages/google-privacy-dlp/CONTRIBUTORS @@ -7,10 +7,10 @@ Ace Nassri Alexander Fenster Ernest Landrito Evawere Ogbe -Google API Publisher Jason Dobry Luke Sneeringer Song Wang Stephen Stephen Sawchuk Tim Swast +greenkeeper[bot] diff --git a/packages/google-privacy-dlp/README.md b/packages/google-privacy-dlp/README.md index d5a139c881e..5d6e48a7391 100644 --- a/packages/google-privacy-dlp/README.md +++ b/packages/google-privacy-dlp/README.md @@ -72,6 +72,9 @@ const dlp = new DLP.DlpServiceClient(); // The string to inspect const string = 'Robert Frost'; +// The project ID to run the API call under +const projectId = process.env.GCLOUD_PROJECT; + // The minimum likelihood required before returning a match const minLikelihood = 'LIKELIHOOD_UNSPECIFIED'; @@ -79,30 +82,33 @@ const minLikelihood = 'LIKELIHOOD_UNSPECIFIED'; const maxFindings = 0; // The infoTypes of information to match -const infoTypes = [{name: 'US_MALE_NAME'}, {name: 'US_FEMALE_NAME'}]; +const infoTypes = [{name: 'PERSON_NAME'}, {name: 'US_STATE'}]; // Whether to include the matching string const includeQuote = true; -// Construct items to inspect -const items = [{type: 'text/plain', value: string}]; +// Construct item to inspect +const item = {value: string}; // Construct request const request = { + parent: dlp.projectPath(projectId), inspectConfig: { infoTypes: infoTypes, minLikelihood: minLikelihood, - maxFindings: maxFindings, + limits: { + maxFindingsPerRequest: maxFindings, + }, includeQuote: includeQuote, }, - items: items, + item: item, }; // Run request dlp .inspectContent(request) .then(response => { - const findings = response[0].results[0].findings; + const findings = response[0].result.findings; if (findings.length > 0) { console.log(`Findings:`); findings.forEach(finding => { @@ -133,6 +139,9 @@ has instructions for running the samples. | Metadata | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/metadata.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/metadata.js,samples/README.md) | | DeID | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/deid.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/deid.js,samples/README.md) | | Risk Analysis | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/risk.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/risk.js,samples/README.md) | +| Inspect Templates | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/templates.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/templates.js,samples/README.md) | +| Job Management | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/jobs.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/jobs.js,samples/README.md) | +| Job Triggers | [source code](https://github.com/googleapis/nodejs-dlp/blob/master/samples/triggers.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/triggers.js,samples/README.md) | The [Data Loss Prevention (DLP) API Node.js Client API Reference][client-docs] documentation also contains samples. @@ -162,4 +171,4 @@ See [LICENSE](https://github.com/googleapis/nodejs-dlp/blob/master/LICENSE) [client-docs]: https://cloud.google.com/nodejs/docs/reference/dlp/latest/ [product-docs]: https://cloud.google.com/dlp/docs/ -[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png +[shell_img]: //gstatic.com/cloudssh/images/open-btn.png diff --git a/packages/google-privacy-dlp/package.json b/packages/google-privacy-dlp/package.json index 2611199dc52..2136e1c6660 100644 --- a/packages/google-privacy-dlp/package.json +++ b/packages/google-privacy-dlp/package.json @@ -1,7 +1,7 @@ { "name": "@google-cloud/dlp", "description": "DLP API client for Node.js", - "version": "0.2.0", + "version": "0.3.0", "license": "Apache-2.0", "author": "Google Inc", "engines": { @@ -33,13 +33,13 @@ "Alexander Fenster ", "Ernest Landrito ", "Evawere Ogbe ", - "Google API Publisher ", "Jason Dobry ", "Luke Sneeringer ", "Song Wang ", "Stephen ", "Stephen Sawchuk ", - "Tim Swast " + "Tim Swast ", + "greenkeeper[bot] " ], "scripts": { "cover": "nyc --reporter=lcov mocha --require intelli-espower-loader test/*.js && nyc report", 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 new file mode 100644 index 00000000000..8a7554f1147 --- /dev/null +++ b/packages/google-privacy-dlp/protos/google/privacy/dlp/v2/dlp.proto @@ -0,0 +1,2399 @@ +// Copyright 2018 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +syntax = "proto3"; + +package google.privacy.dlp.v2; + +import "google/api/annotations.proto"; +import "google/privacy/dlp/v2/storage.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; +import "google/type/date.proto"; +import "google/type/dayofweek.proto"; +import "google/type/timeofday.proto"; + +option csharp_namespace = "Google.Cloud.Dlp.V2"; +option go_package = "google.golang.org/genproto/googleapis/privacy/dlp/v2;dlp"; +option java_multiple_files = true; +option java_outer_classname = "DlpProto"; +option java_package = "com.google.privacy.dlp.v2"; +option php_namespace = "Google\\Cloud\\Dlp\\V2"; + + +// The DLP API is a service that allows clients +// to detect the presence of Personally Identifiable Information (PII) and other +// privacy-sensitive data in user-supplied, unstructured data streams, like text +// blocks or images. +// The service also includes methods for sensitive data redaction and +// scheduling of data scans on Google Cloud Platform based data sets. +service DlpService { + // Finds potentially sensitive info in content. + // This method has limits on input size, processing time, and output size. + // [How-to guide for text](/dlp/docs/inspecting-text), [How-to guide for + // images](/dlp/docs/inspecting-images) + rpc InspectContent(InspectContentRequest) returns (InspectContentResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/content:inspect" + body: "*" + }; + } + + // Redacts potentially sensitive info from an image. + // This method has limits on input size, processing time, and output size. + // [How-to guide](/dlp/docs/redacting-sensitive-data-images) + rpc RedactImage(RedactImageRequest) returns (RedactImageResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/image:redact" + body: "*" + }; + } + + // De-identifies potentially sensitive info from a ContentItem. + // This method has limits on input size and output size. + // [How-to guide](/dlp/docs/deidentify-sensitive-data) + rpc DeidentifyContent(DeidentifyContentRequest) returns (DeidentifyContentResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/content:deidentify" + body: "*" + }; + } + + // Re-identify content that has been de-identified. + rpc ReidentifyContent(ReidentifyContentRequest) returns (ReidentifyContentResponse) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/content:reidentify" + body: "*" + }; + } + + // Returns sensitive information types DLP supports. + rpc ListInfoTypes(ListInfoTypesRequest) returns (ListInfoTypesResponse) { + option (google.api.http) = { + get: "/v2/infoTypes" + }; + } + + // Creates an inspect template for re-using frequently used configuration + // for inspecting content, images, and storage. + rpc CreateInspectTemplate(CreateInspectTemplateRequest) returns (InspectTemplate) { + option (google.api.http) = { + post: "/v2/{parent=organizations/*}/inspectTemplates" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*}/inspectTemplates" + body: "*" + } + }; + } + + // Updates the inspect template. + rpc UpdateInspectTemplate(UpdateInspectTemplateRequest) returns (InspectTemplate) { + option (google.api.http) = { + patch: "/v2/{name=organizations/*/inspectTemplates/*}" + body: "*" + additional_bindings { + patch: "/v2/{name=projects/*/inspectTemplates/*}" + body: "*" + } + }; + } + + // Gets an inspect template. + rpc GetInspectTemplate(GetInspectTemplateRequest) returns (InspectTemplate) { + option (google.api.http) = { + get: "/v2/{name=organizations/*/inspectTemplates/*}" + additional_bindings { + get: "/v2/{name=projects/*/inspectTemplates/*}" + } + }; + } + + // Lists inspect templates. + rpc ListInspectTemplates(ListInspectTemplatesRequest) returns (ListInspectTemplatesResponse) { + option (google.api.http) = { + get: "/v2/{parent=organizations/*}/inspectTemplates" + additional_bindings { + get: "/v2/{parent=projects/*}/inspectTemplates" + } + }; + } + + // Deletes inspect templates. + rpc DeleteInspectTemplate(DeleteInspectTemplateRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=organizations/*/inspectTemplates/*}" + additional_bindings { + delete: "/v2/{name=projects/*/inspectTemplates/*}" + } + }; + } + + // Creates an Deidentify template for re-using frequently used configuration + // for Deidentifying content, images, and storage. + rpc CreateDeidentifyTemplate(CreateDeidentifyTemplateRequest) returns (DeidentifyTemplate) { + option (google.api.http) = { + post: "/v2/{parent=organizations/*}/deidentifyTemplates" + body: "*" + additional_bindings { + post: "/v2/{parent=projects/*}/deidentifyTemplates" + body: "*" + } + }; + } + + // Updates the inspect template. + rpc UpdateDeidentifyTemplate(UpdateDeidentifyTemplateRequest) returns (DeidentifyTemplate) { + option (google.api.http) = { + patch: "/v2/{name=organizations/*/deidentifyTemplates/*}" + body: "*" + additional_bindings { + patch: "/v2/{name=projects/*/deidentifyTemplates/*}" + body: "*" + } + }; + } + + // Gets an inspect template. + rpc GetDeidentifyTemplate(GetDeidentifyTemplateRequest) returns (DeidentifyTemplate) { + option (google.api.http) = { + get: "/v2/{name=organizations/*/deidentifyTemplates/*}" + additional_bindings { + get: "/v2/{name=projects/*/deidentifyTemplates/*}" + } + }; + } + + // Lists inspect templates. + rpc ListDeidentifyTemplates(ListDeidentifyTemplatesRequest) returns (ListDeidentifyTemplatesResponse) { + option (google.api.http) = { + get: "/v2/{parent=organizations/*}/deidentifyTemplates" + additional_bindings { + get: "/v2/{parent=projects/*}/deidentifyTemplates" + } + }; + } + + // Deletes inspect templates. + rpc DeleteDeidentifyTemplate(DeleteDeidentifyTemplateRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=organizations/*/deidentifyTemplates/*}" + additional_bindings { + delete: "/v2/{name=projects/*/deidentifyTemplates/*}" + } + }; + } + + // Creates a job to run DLP actions such as scanning storage for sensitive + // information on a set schedule. + rpc CreateJobTrigger(CreateJobTriggerRequest) returns (JobTrigger) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/jobTriggers" + body: "*" + }; + } + + // Updates a job trigger. + rpc UpdateJobTrigger(UpdateJobTriggerRequest) returns (JobTrigger) { + option (google.api.http) = { + patch: "/v2/{name=projects/*/jobTriggers/*}" + body: "*" + }; + } + + // Gets a job trigger. + rpc GetJobTrigger(GetJobTriggerRequest) returns (JobTrigger) { + option (google.api.http) = { + get: "/v2/{name=projects/*/jobTriggers/*}" + }; + } + + // Lists job triggers. + rpc ListJobTriggers(ListJobTriggersRequest) returns (ListJobTriggersResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/jobTriggers" + }; + } + + // Deletes a job trigger. + rpc DeleteJobTrigger(DeleteJobTriggerRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/jobTriggers/*}" + }; + } + + // Create a new job to inspect storage or calculate risk metrics [How-to + // guide](/dlp/docs/compute-risk-analysis). + rpc CreateDlpJob(CreateDlpJobRequest) returns (DlpJob) { + option (google.api.http) = { + post: "/v2/{parent=projects/*}/dlpJobs" + body: "*" + }; + } + + // Lists DlpJobs that match the specified filter in the request. + rpc ListDlpJobs(ListDlpJobsRequest) returns (ListDlpJobsResponse) { + option (google.api.http) = { + get: "/v2/{parent=projects/*}/dlpJobs" + }; + } + + // Gets the latest state of a long-running DlpJob. + rpc GetDlpJob(GetDlpJobRequest) returns (DlpJob) { + option (google.api.http) = { + get: "/v2/{name=projects/*/dlpJobs/*}" + }; + } + + // Deletes a long-running DlpJob. This method indicates that the client is + // no longer interested in the DlpJob result. The job will be cancelled if + // possible. + rpc DeleteDlpJob(DeleteDlpJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v2/{name=projects/*/dlpJobs/*}" + }; + } + + // Starts asynchronous cancellation on a long-running DlpJob. The server + // makes a best effort to cancel the DlpJob, but success is not + // guaranteed. + rpc CancelDlpJob(CancelDlpJobRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + post: "/v2/{name=projects/*/dlpJobs/*}:cancel" + body: "*" + }; + } +} + +// Configuration description of the scanning process. +// When used with redactContent only info_types and min_likelihood are currently +// used. +message InspectConfig { + message FindingLimits { + // Max findings configuration per infoType, per content item or long + // running DlpJob. + message InfoTypeLimit { + // Type of information the findings limit applies to. Only one limit per + // info_type should be provided. If InfoTypeLimit does not have an + // info_type, the DLP API applies the limit against all info_types that + // are found but not specified in another InfoTypeLimit. + InfoType info_type = 1; + + // Max findings limit for the given infoType. + int32 max_findings = 2; + } + + // Max number of findings that will be returned for each item scanned. + // When set within `InspectDataSourceRequest`, + // the maximum returned is 1000 regardless if this is set higher. + // When set within `InspectContentRequest`, this field is ignored. + int32 max_findings_per_item = 1; + + // Max number of findings that will be returned per request/job. + // When set within `InspectContentRequest`, the maximum returned is 1000 + // regardless if this is set higher. + int32 max_findings_per_request = 2; + + // Configuration of findings limit given for specified infoTypes. + repeated InfoTypeLimit max_findings_per_info_type = 3; + } + + // Restricts what info_types to look for. The values must correspond to + // InfoType values returned by ListInfoTypes or found in documentation. + // Empty info_types runs all enabled detectors. + repeated InfoType info_types = 1; + + // Only returns findings equal or above this threshold. The default is + // POSSIBLE. + Likelihood min_likelihood = 2; + + FindingLimits limits = 3; + + // When true, a contextual quote from the data that triggered a finding is + // included in the response; see Finding.quote. + bool include_quote = 4; + + // When true, excludes type information of the findings. + bool exclude_info_types = 5; + + // Custom infoTypes provided by the user. + repeated CustomInfoType custom_info_types = 6; + + // List of options defining data content to scan. + // If empty, text, images, and other content will be included. + repeated ContentOption content_options = 8; +} + +// Container for bytes to inspect or redact. +message ByteContentItem { + enum BytesType { + BYTES_TYPE_UNSPECIFIED = 0; + + IMAGE_JPEG = 1; + + IMAGE_BMP = 2; + + IMAGE_PNG = 3; + + IMAGE_SVG = 4; + + TEXT_UTF8 = 5; + } + + // The type of data stored in the bytes string. Default will be TEXT_UTF8. + BytesType type = 1; + + // Content data to inspect or redact. + 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 { + // String data to inspect or redact. + string value = 3; + + // Structured content for inspection. + Table table = 4; + + // Content data to inspect or redact. Replaces `type` and `data`. + ByteContentItem byte_item = 5; + } +} + +// Structured content to inspect. Up to 50,000 `Value`s per request allowed. +message Table { + message Row { + repeated Value values = 1; + } + + repeated FieldId headers = 1; + + repeated Row rows = 2; +} + +// All the findings for a single scanned item. +message InspectResult { + // List of findings for an item. + repeated Finding findings = 1; + + // If true, then this item might have more findings than were returned, + // and the findings returned are an arbitrary subset of all findings. + // The findings list might be truncated because the input items were too + // large, or because the server reached the maximum amount of resources + // allowed for a single API call. For best results, divide the input into + // smaller batches. + bool findings_truncated = 2; +} + +// Represents a piece of potentially sensitive content. +message Finding { + // The content that was found. Even if the content is not textual, it + // may be converted to a textual representation here. + // Provided if requested by the `InspectConfig` and the finding is + // less than or equal to 4096 bytes long. If the finding exceeds 4096 bytes + // in length, the quote may be omitted. + string quote = 1; + + // The type of content that might have been found. + // Provided if requested by the `InspectConfig`. + InfoType info_type = 2; + + // Estimate of how likely it is that the `info_type` is correct. + Likelihood likelihood = 3; + + // Where the content was found. + Location location = 4; + + // Timestamp when finding was detected. + google.protobuf.Timestamp create_time = 6; + + // Contains data parsed from quotes. Only populated if include_quote was set + // to true and a supported infoType was requested. Currently supported + // infoTypes: DATE, DATE_OF_BIRTH and TIME. + QuoteInfo quote_info = 7; +} + +// Specifies the location of the finding. +message Location { + // Zero-based byte offsets delimiting the finding. + // These are relative to the finding's containing element. + // Note that when the content is not textual, this references + // the UTF-8 encoded textual representation of the content. + // Omitted if content is an image. + Range byte_range = 1; + + // Unicode character offsets delimiting the finding. + // These are relative to the finding's containing element. + // Provided when the content is text. + Range codepoint_range = 2; + + // List of nested objects pointing to the precise location of the finding + // within the file or record. + repeated ContentLocation content_locations = 7; +} + +// Findings container location data. +message ContentLocation { + // Name of the container where the finding is located. + // The top level name is the source file name or table name. Nested names + // could be absent if the embedded object has no string identifier + // (for an example an image contained within a document). + string container_name = 1; + + // Type of the container within the file with location of the finding. + oneof location { + // Location within a row or record of a database table. + RecordLocation record_location = 2; + + // Location within an image's pixels. + ImageLocation image_location = 3; + + // Location data for document files. + DocumentLocation document_location = 5; + } + + // Findings container modification timestamp, if applicable. + // For Google Cloud Storage contains last file modification timestamp. + // For BigQuery table contains last_modified_time property. + // For Datastore - not populated. + google.protobuf.Timestamp container_timestamp = 6; + + // Findings container version, if available + // ("generation" for Google Cloud Storage). + string container_version = 7; +} + +// Location of a finding within a document. +message DocumentLocation { + // Offset of the line, from the beginning of the file, where the finding + // is located. + int64 file_offset = 1; +} + +// Location of a finding within a row or record. +message RecordLocation { + // Key of the finding. + RecordKey record_key = 1; + + // Field id of the field containing the finding. + FieldId field_id = 2; + + // Location within a `ContentItem.Table`. + TableLocation table_location = 3; +} + +// Location of a finding within a table. +message TableLocation { + // The zero-based index of the row where the finding is located. + int64 row_index = 1; +} + +// Generic half-open interval [start, end) +message Range { + // Index of the first character of the range (inclusive). + int64 start = 1; + + // Index of the last character of the range (exclusive). + int64 end = 2; +} + +// Location of the finding within an image. +message ImageLocation { + // Bounding boxes locating the pixels within the image containing the finding. + repeated BoundingBox bounding_boxes = 1; +} + +// Bounding box encompassing detected text within an image. +message BoundingBox { + // Top coordinate of the bounding box. (0,0) is upper left. + int32 top = 1; + + // Left coordinate of the bounding box. (0,0) is upper left. + int32 left = 2; + + // Width of the bounding box in pixels. + int32 width = 3; + + // Height of the bounding box in pixels. + int32 height = 4; +} + +// Request to search for potentially sensitive info in a list of items +// and replace it with a default or provided content. +message RedactImageRequest { + // Configuration for determining how redaction of images should occur. + message ImageRedactionConfig { + // Type of information to redact from images. + oneof target { + // Only one per info_type should be provided per request. If not + // specified, and redact_all_text is false, the DLP API will redact all + // text that it matches against all info_types that are found, but not + // specified in another ImageRedactionConfig. + InfoType info_type = 1; + + // If true, all text found in the image, regardless whether it matches an + // info_type, is redacted. + bool redact_all_text = 2; + } + + // The color to use when redacting content from an image. If not specified, + // the default is black. + Color redaction_color = 3; + } + + // The parent resource name, for example projects/my-project-id. + string parent = 1; + + // Configuration for the inspector. + InspectConfig inspect_config = 2; + + // The configuration for specifying what content to redact from images. + repeated ImageRedactionConfig image_redaction_configs = 5; + + // The content must be PNG, JPEG, SVG or BMP. + ByteContentItem byte_item = 7; +} + +// Represents a color in the RGB color space. +message Color { + // The amount of red in the color as a value in the interval [0, 1]. + float red = 1; + + // The amount of green in the color as a value in the interval [0, 1]. + float green = 2; + + // The amount of blue in the color as a value in the interval [0, 1]. + float blue = 3; +} + +// Results of redacting an image. +message RedactImageResponse { + // The redacted image. The type will be the same as the original image. + bytes redacted_image = 1; + + // If an image was being inspected and the InspectConfig's include_quote was + // set to true, then this field will include all text, if any, that was found + // in the image. + string extracted_text = 2; +} + +// Request to de-identify a list of items. +message DeidentifyContentRequest { + // The parent resource name, for example projects/my-project-id. + string parent = 1; + + // Configuration for the de-identification of the content item. + // Items specified here will override the template referenced by the + // deidentify_template_name argument. + DeidentifyConfig deidentify_config = 2; + + // Configuration for the inspector. + // Items specified here will override the template referenced by the + // inspect_template_name argument. + InspectConfig inspect_config = 3; + + // The item to de-identify. Will be treated as text. + ContentItem item = 4; + + // Optional template to use. Any configuration directly specified in + // inspect_config will override those set in the template. Singular fields + // that are set in this request will replace their corresponding fields in the + // template. Repeated fields are appended. Singular sub-messages and groups + // are recursively merged. + string inspect_template_name = 5; + + // Optional template to use. Any configuration directly specified in + // deidentify_config will override those set in the template. Singular fields + // that are set in this request will replace their corresponding fields in the + // template. Repeated fields are appended. Singular sub-messages and groups + // are recursively merged. + string deidentify_template_name = 6; +} + +// Results of de-identifying a ContentItem. +message DeidentifyContentResponse { + // The de-identified item. + ContentItem item = 1; + + // An overview of the changes that were made on the `item`. + TransformationOverview overview = 2; +} + +// Request to re-identify an item. +message ReidentifyContentRequest { + // The parent resource name. + string parent = 1; + + // Configuration for the re-identification of the content item. + // This field shares the same proto message type that is used for + // de-identification, however its usage here is for the reversal of the + // previous de-identification. Re-identification is performed by examining + // the transformations used to de-identify the items and executing the + // reverse. This requires that only reversible transformations + // be provided here. The reversible transformations are: + // + // - `CryptoReplaceFfxFpeConfig` + DeidentifyConfig reidentify_config = 2; + + // Configuration for the inspector. + InspectConfig inspect_config = 3; + + // The item to re-identify. Will be treated as text. + ContentItem item = 4; + + // Optional template to use. Any configuration directly specified in + // `inspect_config` will override those set in the template. Singular fields + // that are set in this request will replace their corresponding fields in the + // template. Repeated fields are appended. Singular sub-messages and groups + // are recursively merged. + string inspect_template_name = 5; + + // Optional template to use. References an instance of `DeidentifyTemplate`. + // Any configuration directly specified in `reidentify_config` or + // `inspect_config` will override those set in the template. Singular fields + // that are set in this request will replace their corresponding fields in the + // template. Repeated fields are appended. Singular sub-messages and groups + // are recursively merged. + string reidentify_template_name = 6; +} + +// Results of re-identifying a item. +message ReidentifyContentResponse { + // The re-identified item. + ContentItem item = 1; + + // An overview of the changes that were made to the `item`. + TransformationOverview overview = 2; +} + +// Request to search for potentially sensitive info in a ContentItem. +message InspectContentRequest { + // The parent resource name, for example projects/my-project-id. + string parent = 1; + + // Configuration for the inspector. What specified here will override + // the template referenced by the inspect_template_name argument. + InspectConfig inspect_config = 2; + + // The item to inspect. + ContentItem item = 3; + + // Optional template to use. Any configuration directly specified in + // inspect_config will override those set in the template. Singular fields + // that are set in this request will replace their corresponding fields in the + // template. Repeated fields are appended. Singular sub-messages and groups + // are recursively merged. + string inspect_template_name = 4; +} + +// Results of inspecting an item. +message InspectContentResponse { + // The findings. + InspectResult result = 1; +} + +// Cloud repository for storing output. +message OutputStorageConfig { + // Predefined schemas for storing findings. + enum OutputSchema { + OUTPUT_SCHEMA_UNSPECIFIED = 0; + + // Basic schema including only `info_type`, `quote`, `certainty`, and + // `timestamp`. + BASIC_COLUMNS = 1; + + // Schema tailored to findings from scanning Google Cloud Storage. + GCS_COLUMNS = 2; + + // Schema tailored to findings from scanning Google Datastore. + DATASTORE_COLUMNS = 3; + + // Schema tailored to findings from scanning Google BigQuery. + BIG_QUERY_COLUMNS = 4; + + // Schema containing all columns. + ALL_COLUMNS = 5; + } + + oneof type { + // Store findings in an existing table or a new table in an existing + // dataset. Each column in an existing table must have the same name, type, + // and mode of a field in the `Finding` object. If table_id is not set a new + // one will be generated for you with the following format: + // dlp_googleapis_yyyy_mm_dd_[dlp_job_id]. Pacific timezone will be used for + // generating the date details. + BigQueryTable table = 1; + } + + // Schema used for writing the findings. Columns are derived from the + // `Finding` object. If appending to an existing table, any columns from the + // predefined schema that are missing will be added. No columns in the + // existing table will be deleted. + // + // If unspecified, then all available columns will be used for a new table, + // and no changes will be made to an existing table. + OutputSchema output_schema = 3; +} + +// Statistics regarding a specific InfoType. +message InfoTypeStats { + // The type of finding this stat is for. + InfoType info_type = 1; + + // Number of findings for this infoType. + int64 count = 2; +} + +// The results of an inspect DataSource job. +message InspectDataSourceDetails { + message RequestedOptions { + // If run with an inspect template, a snapshot of it's state at the time of + // this run. + InspectTemplate snapshot_inspect_template = 1; + + InspectJobConfig job_config = 3; + } + + message Result { + // Total size in bytes that were processed. + int64 processed_bytes = 1; + + // Estimate of the number of bytes to process. + int64 total_estimated_bytes = 2; + + // Statistics of how many instances of each info type were found during + // inspect job. + repeated InfoTypeStats info_type_stats = 3; + } + + // The configuration used for this job. + RequestedOptions requested_options = 2; + + // A summary of the outcome of this inspect job. + Result result = 3; +} + +// InfoType description. +message InfoTypeDescription { + // Internal name of the infoType. + string name = 1; + + // Human readable form of the infoType name. + string display_name = 2; + + // Which parts of the API supports this InfoType. + repeated InfoTypeSupportedBy supported_by = 3; +} + +// Request for the list of infoTypes. +message ListInfoTypesRequest { + // Optional BCP-47 language code for localized infoType friendly + // names. If omitted, or if localized strings are not available, + // en-US strings will be returned. + string language_code = 1; + + // Optional filter to only return infoTypes supported by certain parts of the + // API. Defaults to supported_by=INSPECT. + string filter = 2; +} + +// Response to the ListInfoTypes request. +message ListInfoTypesResponse { + // Set of sensitive infoTypes. + repeated InfoTypeDescription info_types = 1; +} + +// Configuration for a risk analysis job. +message RiskAnalysisJobConfig { + // Privacy metric to compute. + PrivacyMetric privacy_metric = 1; + + // Input dataset to compute metrics over. + BigQueryTable source_table = 2; + + // Actions to execute at the completion of the job. Are executed in the order + // provided. + repeated Action actions = 3; +} + +// Privacy metric to compute for reidentification risk analysis. +message PrivacyMetric { + // Compute numerical stats over an individual column, including + // min, max, and quantiles. + message NumericalStatsConfig { + // Field to compute numerical stats on. Supported types are + // integer, float, date, datetime, timestamp, time. + FieldId field = 1; + } + + // Compute numerical stats over an individual column, including + // number of distinct values and value count distribution. + message CategoricalStatsConfig { + // Field to compute categorical stats on. All column types are + // supported except for arrays and structs. However, it may be more + // informative to use NumericalStats when the field type is supported, + // depending on the data. + FieldId field = 1; + } + + // k-anonymity metric, used for analysis of reidentification risk. + message KAnonymityConfig { + // Set of fields to compute k-anonymity over. When multiple fields are + // specified, they are considered a single composite key. Structs and + // repeated data types are not supported; however, nested fields are + // supported so long as they are not structs themselves or nested within + // a repeated field. + repeated FieldId quasi_ids = 1; + } + + // l-diversity metric, used for analysis of reidentification risk. + message LDiversityConfig { + // Set of quasi-identifiers indicating how equivalence classes are + // defined for the l-diversity computation. When multiple fields are + // specified, they are considered a single composite key. + repeated FieldId quasi_ids = 1; + + // Sensitive field for computing the l-value. + FieldId sensitive_attribute = 2; + } + + // Reidentifiability metric. This corresponds to a risk model similar to what + // is called "journalist risk" in the literature, except the attack dataset is + // statistically modeled instead of being perfectly known. This can be done + // using publicly available data (like the US Census), or using a custom + // statistical model (indicated as one or several BigQuery tables), or by + // extrapolating from the distribution of values in the input dataset. + message KMapEstimationConfig { + // A column with a semantic tag attached. + message TaggedField { + // Identifies the column. [required] + FieldId field = 1; + + // Semantic tag that identifies what a column contains, to determine which + // statistical model to use to estimate the reidentifiability of each + // value. [required] + oneof tag { + // A column can be tagged with a InfoType to use the relevant public + // dataset as a statistical model of population, if available. We + // currently support US ZIP codes, region codes, ages and genders. + // To programmatically obtain the list of supported InfoTypes, use + // ListInfoTypes with the supported_by=RISK_ANALYSIS filter. + InfoType info_type = 2; + + // A column can be tagged with a custom tag. In this case, the user must + // indicate an auxiliary table that contains statistical information on + // the possible values of this column (below). + string custom_tag = 3; + + // If no semantic tag is indicated, we infer the statistical model from + // the distribution of values in the input data + google.protobuf.Empty inferred = 4; + } + } + + // An auxiliary table contains statistical information on the relative + // frequency of different quasi-identifiers values. It has one or several + // quasi-identifiers columns, and one column that indicates the relative + // frequency of each quasi-identifier tuple. + // If a tuple is present in the data but not in the auxiliary table, the + // corresponding relative frequency is assumed to be zero (and thus, the + // tuple is highly reidentifiable). + message AuxiliaryTable { + // A quasi-identifier column has a custom_tag, used to know which column + // in the data corresponds to which column in the statistical model. + message QuasiIdField { + FieldId field = 1; + + string custom_tag = 2; + } + + // Auxiliary table location. [required] + BigQueryTable table = 3; + + // Quasi-identifier columns. [required] + repeated QuasiIdField quasi_ids = 1; + + // The relative frequency column must contain a floating-point number + // between 0 and 1 (inclusive). Null values are assumed to be zero. + // [required] + FieldId relative_frequency = 2; + } + + // Fields considered to be quasi-identifiers. No two columns can have the + // same tag. [required] + repeated TaggedField quasi_ids = 1; + + // ISO 3166-1 alpha-2 region code to use in the statistical modeling. + // Required if no column is tagged with a region-specific InfoType (like + // US_ZIP_5) or a region code. + string region_code = 2; + + // Several auxiliary tables can be used in the analysis. Each custom_tag + // used to tag a quasi-identifiers column must appear in exactly one column + // of one auxiliary table. + repeated AuxiliaryTable auxiliary_tables = 3; + } + + oneof type { + NumericalStatsConfig numerical_stats_config = 1; + + CategoricalStatsConfig categorical_stats_config = 2; + + KAnonymityConfig k_anonymity_config = 3; + + LDiversityConfig l_diversity_config = 4; + + KMapEstimationConfig k_map_estimation_config = 5; + } +} + +// Result of a risk analysis operation request. +message AnalyzeDataSourceRiskDetails { + // Result of the numerical stats computation. + message NumericalStatsResult { + // Minimum value appearing in the column. + Value min_value = 1; + + // Maximum value appearing in the column. + Value max_value = 2; + + // List of 99 values that partition the set of field values into 100 equal + // sized buckets. + repeated Value quantile_values = 4; + } + + // Result of the categorical stats computation. + message CategoricalStatsResult { + message CategoricalStatsHistogramBucket { + // Lower bound on the value frequency of the values in this bucket. + int64 value_frequency_lower_bound = 1; + + // Upper bound on the value frequency of the values in this bucket. + int64 value_frequency_upper_bound = 2; + + // Total number of values in this bucket. + int64 bucket_size = 3; + + // Sample of value frequencies in this bucket. The total number of + // values returned per bucket is capped at 20. + repeated ValueFrequency bucket_values = 4; + + // Total number of distinct values in this bucket. + int64 bucket_value_count = 5; + } + + // Histogram of value frequencies in the column. + repeated CategoricalStatsHistogramBucket value_frequency_histogram_buckets = 5; + } + + // Result of the k-anonymity computation. + message KAnonymityResult { + // The set of columns' values that share the same ldiversity value + message KAnonymityEquivalenceClass { + // Set of values defining the equivalence class. One value per + // quasi-identifier column in the original KAnonymity metric message. + // The order is always the same as the original request. + repeated Value quasi_ids_values = 1; + + // Size of the equivalence class, for example number of rows with the + // above set of values. + int64 equivalence_class_size = 2; + } + + message KAnonymityHistogramBucket { + // Lower bound on the size of the equivalence classes in this bucket. + int64 equivalence_class_size_lower_bound = 1; + + // Upper bound on the size of the equivalence classes in this bucket. + int64 equivalence_class_size_upper_bound = 2; + + // Total number of equivalence classes in this bucket. + int64 bucket_size = 3; + + // Sample of equivalence classes in this bucket. The total number of + // classes returned per bucket is capped at 20. + repeated KAnonymityEquivalenceClass bucket_values = 4; + + // Total number of distinct equivalence classes in this bucket. + int64 bucket_value_count = 5; + } + + // Histogram of k-anonymity equivalence classes. + repeated KAnonymityHistogramBucket equivalence_class_histogram_buckets = 5; + } + + // Result of the l-diversity computation. + message LDiversityResult { + // The set of columns' values that share the same ldiversity value. + message LDiversityEquivalenceClass { + // Quasi-identifier values defining the k-anonymity equivalence + // class. The order is always the same as the original request. + repeated Value quasi_ids_values = 1; + + // Size of the k-anonymity equivalence class. + int64 equivalence_class_size = 2; + + // Number of distinct sensitive values in this equivalence class. + int64 num_distinct_sensitive_values = 3; + + // Estimated frequencies of top sensitive values. + repeated ValueFrequency top_sensitive_values = 4; + } + + message LDiversityHistogramBucket { + // Lower bound on the sensitive value frequencies of the equivalence + // classes in this bucket. + int64 sensitive_value_frequency_lower_bound = 1; + + // Upper bound on the sensitive value frequencies of the equivalence + // classes in this bucket. + int64 sensitive_value_frequency_upper_bound = 2; + + // Total number of equivalence classes in this bucket. + int64 bucket_size = 3; + + // Sample of equivalence classes in this bucket. The total number of + // classes returned per bucket is capped at 20. + repeated LDiversityEquivalenceClass bucket_values = 4; + + // Total number of distinct equivalence classes in this bucket. + int64 bucket_value_count = 5; + } + + // Histogram of l-diversity equivalence class sensitive value frequencies. + repeated LDiversityHistogramBucket sensitive_value_frequency_histogram_buckets = 5; + } + + // Result of the reidentifiability analysis. Note that these results are an + // estimation, not exact values. + message KMapEstimationResult { + // A tuple of values for the quasi-identifier columns. + message KMapEstimationQuasiIdValues { + // The quasi-identifier values. + repeated Value quasi_ids_values = 1; + + // The estimated anonymity for these quasi-identifier values. + int64 estimated_anonymity = 2; + } + + // A KMapEstimationHistogramBucket message with the following values: + // min_anonymity: 3 + // max_anonymity: 5 + // frequency: 42 + // means that there are 42 records whose quasi-identifier values correspond + // to 3, 4 or 5 people in the overlying population. An important particular + // case is when min_anonymity = max_anonymity = 1: the frequency field then + // corresponds to the number of uniquely identifiable records. + message KMapEstimationHistogramBucket { + // Always positive. + int64 min_anonymity = 1; + + // Always greater than or equal to min_anonymity. + int64 max_anonymity = 2; + + // Number of records within these anonymity bounds. + int64 bucket_size = 5; + + // Sample of quasi-identifier tuple values in this bucket. The total + // number of classes returned per bucket is capped at 20. + repeated KMapEstimationQuasiIdValues bucket_values = 6; + + // Total number of distinct quasi-identifier tuple values in this bucket. + int64 bucket_value_count = 7; + } + + // The intervals [min_anonymity, max_anonymity] do not overlap. If a value + // doesn't correspond to any such interval, the associated frequency is + // zero. For example, the following records: + // {min_anonymity: 1, max_anonymity: 1, frequency: 17} + // {min_anonymity: 2, max_anonymity: 3, frequency: 42} + // {min_anonymity: 5, max_anonymity: 10, frequency: 99} + // mean that there are no record with an estimated anonymity of 4, 5, or + // larger than 10. + repeated KMapEstimationHistogramBucket k_map_estimation_histogram = 1; + } + + // Privacy metric to compute. + PrivacyMetric requested_privacy_metric = 1; + + // Input dataset to compute metrics over. + BigQueryTable requested_source_table = 2; + + // Values associated with this metric. + oneof result { + NumericalStatsResult numerical_stats_result = 3; + + CategoricalStatsResult categorical_stats_result = 4; + + KAnonymityResult k_anonymity_result = 5; + + LDiversityResult l_diversity_result = 6; + + KMapEstimationResult k_map_estimation_result = 7; + } +} + +// A value of a field, including its frequency. +message ValueFrequency { + // A value contained in the field in question. + Value value = 1; + + // How many times the value is contained in the field. + int64 count = 2; +} + +// Set of primitive values supported by the system. +// Note that for the purposes of inspection or transformation, the number +// of bytes considered to comprise a 'Value' is based on its representation +// as a UTF-8 encoded string. For example, if 'integer_value' is set to +// 123456789, the number of bytes would be counted as 9, even though an +// int64 only holds up to 8 bytes of data. +message Value { + oneof type { + int64 integer_value = 1; + + double float_value = 2; + + string string_value = 3; + + bool boolean_value = 4; + + google.protobuf.Timestamp timestamp_value = 5; + + google.type.TimeOfDay time_value = 6; + + google.type.Date date_value = 7; + + google.type.DayOfWeek day_of_week_value = 8; + } +} + +// Message for infoType-dependent details parsed from quote. +message QuoteInfo { + // Object representation of the quote. + oneof parsed_quote { + DateTime date_time = 2; + } +} + +// Message for a date time object. +message DateTime { + message TimeZone { + // Set only if the offset can be determined. Positive for time ahead of UTC. + // E.g. For "UTC-9", this value is -540. + int32 offset_minutes = 1; + } + + // One or more of the following must be set. All fields are optional, but + // when set must be valid date or time values. + google.type.Date date = 1; + + google.type.DayOfWeek day_of_week = 2; + + google.type.TimeOfDay time = 3; + + TimeZone time_zone = 4; +} + +// The configuration that controls how the data will change. +message DeidentifyConfig { + oneof transformation { + // Treat the dataset as free-form text and apply the same free text + // transformation everywhere. + InfoTypeTransformations info_type_transformations = 1; + + // Treat the dataset as structured. Transformations can be applied to + // specific locations within structured datasets, such as transforming + // a column within a table. + RecordTransformations record_transformations = 2; + } +} + +// A rule for transforming a value. +message PrimitiveTransformation { + oneof transformation { + ReplaceValueConfig replace_config = 1; + + RedactConfig redact_config = 2; + + CharacterMaskConfig character_mask_config = 3; + + CryptoReplaceFfxFpeConfig crypto_replace_ffx_fpe_config = 4; + + FixedSizeBucketingConfig fixed_size_bucketing_config = 5; + + BucketingConfig bucketing_config = 6; + + ReplaceWithInfoTypeConfig replace_with_info_type_config = 7; + + TimePartConfig time_part_config = 8; + + CryptoHashConfig crypto_hash_config = 9; + + DateShiftConfig date_shift_config = 11; + } +} + +// For use with `Date`, `Timestamp`, and `TimeOfDay`, extract or preserve a +// portion of the value. +message TimePartConfig { + enum TimePart { + TIME_PART_UNSPECIFIED = 0; + + // [0-9999] + YEAR = 1; + + // [1-12] + MONTH = 2; + + // [1-31] + DAY_OF_MONTH = 3; + + // [1-7] + DAY_OF_WEEK = 4; + + // [1-52] + WEEK_OF_YEAR = 5; + + // [0-23] + HOUR_OF_DAY = 6; + } + + TimePart part_to_extract = 1; +} + +// Pseudonymization method that generates surrogates via cryptographic hashing. +// Uses SHA-256. +// The key size must be either 32 or 64 bytes. +// Outputs a 32 byte digest as an uppercase hex string +// (for example, 41D1567F7F99F1DC2A5FAB886DEE5BEE). +// Currently, only string and integer values can be hashed. +message CryptoHashConfig { + // The key used by the hash function. + CryptoKey crypto_key = 1; +} + +// Replace each input value with a given `Value`. +message ReplaceValueConfig { + // Value to replace it with. + Value new_value = 1; +} + +// Replace each matching finding with the name of the info_type. +message ReplaceWithInfoTypeConfig { + +} + +// Redact a given value. For example, if used with an `InfoTypeTransformation` +// transforming PHONE_NUMBER, and input 'My phone number is 206-555-0123', the +// output would be 'My phone number is '. +message RedactConfig { + +} + +// Characters to skip when doing deidentification of a value. These will be left +// alone and skipped. +message CharsToIgnore { + enum CommonCharsToIgnore { + COMMON_CHARS_TO_IGNORE_UNSPECIFIED = 0; + + // 0-9 + NUMERIC = 1; + + // A-Z + ALPHA_UPPER_CASE = 2; + + // a-z + ALPHA_LOWER_CASE = 3; + + // US Punctuation, one of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ + PUNCTUATION = 4; + + // Whitespace character, one of [ \t\n\x0B\f\r] + WHITESPACE = 5; + } + + oneof characters { + string characters_to_skip = 1; + + CommonCharsToIgnore common_characters_to_ignore = 2; + } +} + +// Partially mask a string by replacing a given number of characters with a +// fixed character. Masking can start from the beginning or end of the string. +// This can be used on data of any type (numbers, longs, and so on) and when +// de-identifying structured data we'll attempt to preserve the original data's +// type. (This allows you to take a long like 123 and modify it to a string like +// **3. +message CharacterMaskConfig { + // Character to mask the sensitive values—for example, "*" for an + // alphabetic string such as name, or "0" for a numeric string such as ZIP + // code or credit card number. String must have length 1. If not supplied, we + // will default to "*" for strings, 0 for digits. + string masking_character = 1; + + // Number of characters to mask. If not set, all matching chars will be + // masked. Skipped characters do not count towards this tally. + int32 number_to_mask = 2; + + // Mask characters in reverse order. For example, if `masking_character` is + // '0', number_to_mask is 14, and `reverse_order` is false, then + // 1234-5678-9012-3456 -> 00000000000000-3456 + // If `masking_character` is '*', `number_to_mask` is 3, and `reverse_order` + // is true, then 12345 -> 12*** + bool reverse_order = 3; + + // When masking a string, items in this list will be skipped when replacing. + // For example, if your string is 555-555-5555 and you ask us to skip `-` and + // mask 5 chars with * we would produce ***-*55-5555. + repeated CharsToIgnore characters_to_ignore = 4; +} + +// Buckets values based on fixed size ranges. The +// Bucketing transformation can provide all of this functionality, +// but requires more configuration. This message is provided as a convenience to +// the user for simple bucketing strategies. +// +// The transformed value will be a hyphenated string of +// -, i.e if lower_bound = 10 and upper_bound = 20 +// all values that are within this bucket will be replaced with "10-20". +// +// This can be used on data of type: double, long. +// +// If the bound Value type differs from the type of data +// being transformed, we will first attempt converting the type of the data to +// be transformed to match the type of the bound before comparing. +message FixedSizeBucketingConfig { + // Lower bound value of buckets. All values less than `lower_bound` are + // grouped together into a single bucket; for example if `lower_bound` = 10, + // then all values less than 10 are replaced with the value “-10”. [Required]. + Value lower_bound = 1; + + // Upper bound value of buckets. All values greater than upper_bound are + // grouped together into a single bucket; for example if `upper_bound` = 89, + // then all values greater than 89 are replaced with the value “89+”. + // [Required]. + Value upper_bound = 2; + + // Size of each bucket (except for minimum and maximum buckets). So if + // `lower_bound` = 10, `upper_bound` = 89, and `bucket_size` = 10, then the + // following buckets would be used: -10, 10-20, 20-30, 30-40, 40-50, 50-60, + // 60-70, 70-80, 80-89, 89+. Precision up to 2 decimals works. [Required]. + double bucket_size = 3; +} + +// Generalization function that buckets values based on ranges. The ranges and +// replacement values are dynamically provided by the user for custom behavior, +// such as 1-30 -> LOW 31-65 -> MEDIUM 66-100 -> HIGH +// This can be used on +// data of type: number, long, string, timestamp. +// If the bound `Value` type differs from the type of data being transformed, we +// will first attempt converting the type of the data to be transformed to match +// the type of the bound before comparing. +message BucketingConfig { + // Bucket is represented as a range, along with replacement values. + message Bucket { + // Lower bound of the range, inclusive. Type should be the same as max if + // used. + Value min = 1; + + // Upper bound of the range, exclusive; type must match min. + Value max = 2; + + // Replacement value for this bucket. If not provided + // the default behavior will be to hyphenate the min-max range. + Value replacement_value = 3; + } + + // Set of buckets. Ranges must be non-overlapping. + repeated Bucket buckets = 1; +} + +// Replaces an identifier with a surrogate using FPE with the FFX +// mode of operation; however when used in the `ReidentifyContent` API method, +// it serves the opposite function by reversing the surrogate back into +// the original identifier. +// The identifier must be encoded as ASCII. +// For a given crypto key and context, the same identifier will be +// replaced with the same surrogate. +// Identifiers must be at least two characters long. +// In the case that the identifier is the empty string, it will be skipped. +// See [Pseudonymization](/dlp/docs/pseudonymization) for example usage. +message CryptoReplaceFfxFpeConfig { + // These are commonly used subsets of the alphabet that the FFX mode + // natively supports. In the algorithm, the alphabet is selected using + // the "radix". Therefore each corresponds to particular radix. + enum FfxCommonNativeAlphabet { + FFX_COMMON_NATIVE_ALPHABET_UNSPECIFIED = 0; + + // [0-9] (radix of 10) + NUMERIC = 1; + + // [0-9A-F] (radix of 16) + HEXADECIMAL = 2; + + // [0-9A-Z] (radix of 36) + UPPER_CASE_ALPHA_NUMERIC = 3; + + // [0-9A-Za-z] (radix of 62) + ALPHA_NUMERIC = 4; + } + + // The key used by the encryption algorithm. [required] + CryptoKey crypto_key = 1; + + // The 'tweak', a context may be used for higher security since the same + // identifier in two different contexts won't be given the same surrogate. If + // the context is not set, a default tweak will be used. + // + // If the context is set but: + // + // 1. there is no record present when transforming a given value or + // 1. the field is not present when transforming a given value, + // + // a default tweak will be used. + // + // Note that case (1) is expected when an `InfoTypeTransformation` is + // applied to both structured and non-structured `ContentItem`s. + // Currently, the referenced field may be of value type integer or string. + // + // The tweak is constructed as a sequence of bytes in big endian byte order + // such that: + // + // - a 64 bit integer is encoded followed by a single byte of value 1 + // - a string is encoded in UTF-8 format followed by a single byte of value + // å 2 + FieldId context = 2; + + oneof alphabet { + FfxCommonNativeAlphabet common_alphabet = 4; + + // This is supported by mapping these to the alphanumeric characters + // that the FFX mode natively supports. This happens before/after + // encryption/decryption. + // Each character listed must appear only once. + // Number of characters must be in the range [2, 62]. + // This must be encoded as ASCII. + // The order of characters does not matter. + string custom_alphabet = 5; + + // The native way to select the alphabet. Must be in the range [2, 62]. + int32 radix = 6; + } + + // The custom infoType to annotate the surrogate with. + // This annotation will be applied to the surrogate by prefixing it with + // the name of the custom infoType followed by the number of + // characters comprising the surrogate. The following scheme defines the + // format: info_type_name(surrogate_character_count):surrogate + // + // For example, if the name of custom infoType is 'MY_TOKEN_INFO_TYPE' and + // the surrogate is 'abc', the full replacement value + // will be: 'MY_TOKEN_INFO_TYPE(3):abc' + // + // This annotation identifies the surrogate when inspecting content using the + // custom infoType + // [`SurrogateType`](/dlp/docs/reference/rest/v2/InspectConfig#surrogatetype). + // This facilitates reversal of the surrogate when it occurs in free text. + // + // In order for inspection to work properly, the name of this infoType must + // not occur naturally anywhere in your data; otherwise, inspection may + // find a surrogate that does not correspond to an actual identifier. + // Therefore, choose your custom infoType name carefully after considering + // what your data looks like. One way to select a name that has a high chance + // of yielding reliable detection is to include one or more unicode characters + // that are highly improbable to exist in your data. + // For example, assuming your data is entered from a regular ASCII keyboard, + // the symbol with the hex code point 29DD might be used like so: + // ⧝MY_TOKEN_TYPE + InfoType surrogate_info_type = 8; +} + +// This is a data encryption key (DEK) (as opposed to +// a key encryption key (KEK) stored by KMS). +// When using KMS to wrap/unwrap DEKs, be sure to set an appropriate +// IAM policy on the KMS CryptoKey (KEK) to ensure an attacker cannot +// unwrap the data crypto key. +message CryptoKey { + oneof source { + TransientCryptoKey transient = 1; + + UnwrappedCryptoKey unwrapped = 2; + + KmsWrappedCryptoKey kms_wrapped = 3; + } +} + +// Use this to have a random data crypto key generated. +// It will be discarded after the request finishes. +message TransientCryptoKey { + // Name of the key. [required] + // This is an arbitrary string used to differentiate different keys. + // A unique key is generated per name: two separate `TransientCryptoKey` + // protos share the same generated key if their names are the same. + // When the data crypto key is generated, this name is not used in any way + // (repeating the api call will result in a different key being generated). + string name = 1; +} + +// Using raw keys is prone to security risks due to accidentally +// leaking the key. Choose another type of key if possible. +message UnwrappedCryptoKey { + // The AES 128/192/256 bit key. [required] + bytes key = 1; +} + +// Include to use an existing data crypto key wrapped by KMS. +// Authorization requires the following IAM permissions when sending a request +// to perform a crypto transformation using a kms-wrapped crypto key: +// dlp.kms.encrypt +message KmsWrappedCryptoKey { + // The wrapped data crypto key. [required] + bytes wrapped_key = 1; + + // The resource name of the KMS CryptoKey to use for unwrapping. [required] + string crypto_key_name = 2; +} + +// Shifts dates by random number of days, with option to be consistent for the +// same context. +message DateShiftConfig { + // Range of shift in days. Actual shift will be selected at random within this + // range (inclusive ends). Negative means shift to earlier in time. Must not + // be more than 365250 days (1000 years) each direction. + // + // For example, 3 means shift date to at most 3 days into the future. + // [Required] + int32 upper_bound_days = 1; + + // For example, -5 means shift date to at most 5 days back in the past. + // [Required] + int32 lower_bound_days = 2; + + // Points to the field that contains the context, for example, an entity id. + // If set, must also set method. If set, shift will be consistent for the + // given context. + FieldId context = 3; + + // Method for calculating shift that takes context into consideration. If + // set, must also set context. Can only be applied to table items. + oneof method { + // Causes the shift to be computed based on this key and the context. This + // results in the same shift for the same context and crypto_key. + CryptoKey crypto_key = 4; + } +} + +// A type of transformation that will scan unstructured text and +// apply various `PrimitiveTransformation`s to each finding, where the +// transformation is applied to only values that were identified as a specific +// info_type. +message InfoTypeTransformations { + // A transformation to apply to text that is identified as a specific + // info_type. + message InfoTypeTransformation { + // InfoTypes to apply the transformation to. Empty list will match all + // available infoTypes for this transformation. + repeated InfoType info_types = 1; + + // Primitive transformation to apply to the infoType. [required] + PrimitiveTransformation primitive_transformation = 2; + } + + // Transformation for each infoType. Cannot specify more than one + // for a given infoType. [required] + repeated InfoTypeTransformation transformations = 1; +} + +// The transformation to apply to the field. +message FieldTransformation { + // Input field(s) to apply the transformation to. [required] + repeated FieldId fields = 1; + + // Only apply the transformation if the condition evaluates to true for the + // given `RecordCondition`. The conditions are allowed to reference fields + // that are not used in the actual transformation. [optional] + // + // Example Use Cases: + // + // - Apply a different bucket transformation to an age column if the zip code + // column for the same record is within a specific range. + // - Redact a field if the date of birth field is greater than 85. + RecordCondition condition = 3; + + // Transformation to apply. [required] + oneof transformation { + // Apply the transformation to the entire field. + PrimitiveTransformation primitive_transformation = 4; + + // Treat the contents of the field as free text, and selectively + // transform content that matches an `InfoType`. + InfoTypeTransformations info_type_transformations = 5; + } +} + +// A type of transformation that is applied over structured data such as a +// table. +message RecordTransformations { + // Transform the record by applying various field transformations. + repeated FieldTransformation field_transformations = 1; + + // Configuration defining which records get suppressed entirely. Records that + // match any suppression rule are omitted from the output [optional]. + repeated RecordSuppression record_suppressions = 2; +} + +// Configuration to suppress records whose suppression conditions evaluate to +// true. +message RecordSuppression { + // A condition that when it evaluates to true will result in the record being + // evaluated to be suppressed from the transformed content. + RecordCondition condition = 1; +} + +// A condition for determining whether a transformation should be applied to +// a field. +message RecordCondition { + // The field type of `value` and `field` do not need to match to be + // considered equal, but not all comparisons are possible. + // + // A `value` of type: + // + // - `string` can be compared against all other types + // - `boolean` can only be compared against other booleans + // - `integer` can be compared against doubles or a string if the string value + // can be parsed as an integer. + // - `double` can be compared against integers or a string if the string can + // be parsed as a double. + // - `Timestamp` can be compared against strings in RFC 3339 date string + // format. + // - `TimeOfDay` can be compared against timestamps and strings in the format + // of 'HH:mm:ss'. + // + // If we fail to compare do to type mismatch, a warning will be given and + // the condition will evaluate to false. + message Condition { + // Field within the record this condition is evaluated against. [required] + FieldId field = 1; + + // Operator used to compare the field or infoType to the value. [required] + RelationalOperator operator = 3; + + // Value to compare against. [Required, except for `EXISTS` tests.] + Value value = 4; + } + + // A collection of conditions. + message Conditions { + repeated Condition conditions = 1; + } + + // An expression, consisting or an operator and conditions. + message Expressions { + enum LogicalOperator { + LOGICAL_OPERATOR_UNSPECIFIED = 0; + + AND = 1; + } + + // The operator to apply to the result of conditions. Default and currently + // only supported value is `AND`. + LogicalOperator logical_operator = 1; + + oneof type { + Conditions conditions = 3; + } + } + + // An expression. + Expressions expressions = 3; +} + +// Overview of the modifications that occurred. +message TransformationOverview { + // Total size in bytes that were transformed in some way. + int64 transformed_bytes = 2; + + // Transformations applied to the dataset. + repeated TransformationSummary transformation_summaries = 3; +} + +// Summary of a single tranformation. +// Only one of 'transformation', 'field_transformation', or 'record_suppress' +// will be set. +message TransformationSummary { + // A collection that informs the user the number of times a particular + // `TransformationResultCode` and error details occurred. + message SummaryResult { + int64 count = 1; + + TransformationResultCode code = 2; + + // A place for warnings or errors to show up if a transformation didn't + // work as expected. + string details = 3; + } + + // Possible outcomes of transformations. + enum TransformationResultCode { + TRANSFORMATION_RESULT_CODE_UNSPECIFIED = 0; + + SUCCESS = 1; + + ERROR = 2; + } + + // Set if the transformation was limited to a specific info_type. + InfoType info_type = 1; + + // Set if the transformation was limited to a specific FieldId. + FieldId field = 2; + + // The specific transformation these stats apply to. + PrimitiveTransformation transformation = 3; + + // The field transformation that was applied. + // If multiple field transformations are requested for a single field, + // this list will contain all of them; otherwise, only one is supplied. + repeated FieldTransformation field_transformations = 5; + + // The specific suppression option these stats apply to. + RecordSuppression record_suppress = 6; + + repeated SummaryResult results = 4; + + // Total size in bytes that were transformed in some way. + int64 transformed_bytes = 7; +} + +// Schedule for triggeredJobs. +message Schedule { + oneof option { + // With this option a job is started a regular periodic basis. For + // example: every 10 minutes. + // + // A scheduled start time will be skipped if the previous + // execution has not ended when its scheduled time occurs. + // + // This value must be set to a time duration greater than or equal + // to 60 minutes and can be no longer than 60 days. + google.protobuf.Duration recurrence_period_duration = 1; + } +} + +// The inspectTemplate contains a configuration (set of types of sensitive data +// to be detected) to be used anywhere you otherwise would normally specify +// InspectConfig. +message InspectTemplate { + // The template name. Output only. + // + // The template will have one of the following formats: + // `projects/PROJECT_ID/inspectTemplates/TEMPLATE_ID` OR + // `organizations/ORGANIZATION_ID/inspectTemplates/TEMPLATE_ID` + string name = 1; + + // Display name (max 256 chars). + string display_name = 2; + + // Short description (max 256 chars). + string description = 3; + + // The creation timestamp of a inspectTemplate, output only field. + google.protobuf.Timestamp create_time = 4; + + // The last update timestamp of a inspectTemplate, output only field. + google.protobuf.Timestamp update_time = 5; + + // The core content of the template. Configuration of the scanning process. + InspectConfig inspect_config = 6; +} + +// The DeidentifyTemplates contains instructions on how to deidentify content. +message DeidentifyTemplate { + // The template name. Output only. + // + // The template will have one of the following formats: + // `projects/PROJECT_ID/deidentifyTemplates/TEMPLATE_ID` OR + // `organizations/ORGANIZATION_ID/deidentifyTemplates/TEMPLATE_ID` + string name = 1; + + // Display name (max 256 chars). + string display_name = 2; + + // Short description (max 256 chars). + string description = 3; + + // The creation timestamp of a inspectTemplate, output only field. + google.protobuf.Timestamp create_time = 4; + + // The last update timestamp of a inspectTemplate, output only field. + google.protobuf.Timestamp update_time = 5; + + // ///////////// // The core content of the template // /////////////// + DeidentifyConfig deidentify_config = 6; +} + +// Details information about an error encountered during job execution or +// the results of an unsuccessful activation of the JobTrigger. +// Output only field. +message Error { + google.rpc.Status details = 1; + + // The times the error occurred. + repeated google.protobuf.Timestamp timestamps = 2; +} + +// Contains a configuration to make dlp api calls on a repeating basis. +message JobTrigger { + // What event needs to occur for a new job to be started. + message Trigger { + oneof trigger { + // Create a job on a repeating basis based on the elapse of time. + Schedule schedule = 1; + } + } + + // Whether the trigger is currently active. If PAUSED or CANCELLED, no jobs + // will be created with this configuration. The service may automatically + // pause triggers experiencing frequent errors. To restart a job, set the + // status to HEALTHY after correcting user errors. + enum Status { + STATUS_UNSPECIFIED = 0; + + // Trigger is healthy. + HEALTHY = 1; + + // Trigger is temporarily paused. + PAUSED = 2; + + // Trigger is cancelled and can not be resumed. + CANCELLED = 3; + } + + // Unique resource name for the triggeredJob, assigned by the service when the + // triggeredJob is created, for example + // `projects/dlp-test-project/triggeredJobs/53234423`. + string name = 1; + + // Display name (max 100 chars) + string display_name = 2; + + // User provided description (max 256 chars) + string description = 3; + + // The configuration details for the specific type of job to run. + oneof job { + InspectJobConfig inspect_job = 4; + } + + // A list of triggers which will be OR'ed together. Only one in the list + // needs to trigger for a job to be started. The list may contain only + // a single Schedule trigger and must have at least one object. + repeated Trigger triggers = 5; + + // A stream of errors encountered when the trigger was activated. Repeated + // errors may result in the JobTrigger automaticaly being paused. + // Will return the last 100 errors. Whenever the JobTrigger is modified + // this list will be cleared. Output only field. + repeated Error errors = 6; + + // The creation timestamp of a triggeredJob, output only field. + google.protobuf.Timestamp create_time = 7; + + // The last update timestamp of a triggeredJob, output only field. + google.protobuf.Timestamp update_time = 8; + + // The timestamp of the last time this trigger executed, output only field. + google.protobuf.Timestamp last_run_time = 9; + + // A status for this trigger. [required] + Status status = 10; +} + +// A task to execute on the completion of a job. +message Action { + // If set, the detailed findings will be persisted to the specified + // OutputStorageConfig. Compatible with: Inspect + message SaveFindings { + OutputStorageConfig output_config = 1; + } + + // Publish the results of a DlpJob to a pub sub channel. + // Compatible with: Inpect, Risk + message PublishToPubSub { + // Cloud Pub/Sub topic to send notifications to. The topic must have given + // publishing access rights to the DLP API service account executing + // the long running DlpJob sending the notifications. + // Format is projects/{project}/topics/{topic}. + string topic = 1; + } + + oneof action { + // Save resulting findings in a provided location. + SaveFindings save_findings = 1; + + // Publish a notification to a pubsub topic. + PublishToPubSub pub_sub = 2; + } +} + +// Request message for CreateInspectTemplate. +message CreateInspectTemplateRequest { + // The parent resource name, for example projects/my-project-id or + // organizations/my-org-id. + string parent = 1; + + // The InspectTemplate to create. + InspectTemplate inspect_template = 2; + + // The template 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 template_id = 3; +} + +// Request message for UpdateInspectTemplate. +message UpdateInspectTemplateRequest { + // Resource name of organization and inspectTemplate to be updated, for + // example `organizations/433245324/inspectTemplates/432452342` or + // projects/project-id/inspectTemplates/432452342. + string name = 1; + + // New InspectTemplate value. + InspectTemplate inspect_template = 2; + + // Mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3; +} + +// Request message for GetInspectTemplate. +message GetInspectTemplateRequest { + // Resource name of the organization and inspectTemplate to be read, for + // example `organizations/433245324/inspectTemplates/432452342` or + // projects/project-id/inspectTemplates/432452342. + string name = 1; +} + +// Request message for ListInspectTemplates. +message ListInspectTemplatesRequest { + // 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 `ListInspectTemplates`. + 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 ListInspectTemplates. +message ListInspectTemplatesResponse { + // List of inspectTemplates, up to page_size in ListInspectTemplatesRequest. + repeated InspectTemplate inspect_templates = 1; + + // If the next page is available then the next page token to be used + // in following ListInspectTemplates request. + string next_page_token = 2; +} + +// Request message for DeleteInspectTemplate. +message DeleteInspectTemplateRequest { + // Resource name of the organization and inspectTemplate to be deleted, for + // example `organizations/433245324/inspectTemplates/432452342` or + // projects/project-id/inspectTemplates/432452342. + string name = 1; +} + +// Request message for CreateJobTrigger. +message CreateJobTriggerRequest { + // The parent resource name, for example projects/my-project-id. + string parent = 1; + + // The JobTrigger to create. + JobTrigger job_trigger = 2; + + // The trigger 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 trigger_id = 3; +} + +// Request message for UpdateJobTrigger. +message UpdateJobTriggerRequest { + // Resource name of the project and the triggeredJob, for example + // `projects/dlp-test-project/jobTriggers/53234423`. + string name = 1; + + // New JobTrigger value. + JobTrigger job_trigger = 2; + + // Mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3; +} + +// Request message for GetJobTrigger. +message GetJobTriggerRequest { + // Resource name of the project and the triggeredJob, for example + // `projects/dlp-test-project/jobTriggers/53234423`. + string name = 1; +} + +// Request message for CreateDlpJobRequest. Used to initiate long running +// jobs such as calculating risk metrics or inspecting Google Cloud +// Storage. +message CreateDlpJobRequest { + // The parent resource name, for example projects/my-project-id. + string parent = 1; + + // The configuration details for the specific type of job to run. + oneof job { + InspectJobConfig inspect_job = 2; + + RiskAnalysisJobConfig risk_job = 3; + } + + // The job 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 job_id = 4; +} + +// Request message for ListJobTriggers. +message ListJobTriggersRequest { + // The parent resource name, for example projects/my-project-id. + string parent = 1; + + // Optional page token to continue retrieval. Comes from previous call + // to ListJobTriggers. `order_by` and `filter` should not change for + // subsequent calls, but can be omitted if token is specified. + string page_token = 2; + + // Optional size of the page, can be limited by a server. + int32 page_size = 3; + + // Optional comma separated list of triggeredJob fields to order by, + // followed by 'asc/desc' postfix, i.e. + // `"create_time asc,name desc,schedule_mode asc"`. This list is + // case-insensitive. + // + // Example: `"name asc,schedule_mode desc, status desc"` + // + // Supported filters keys and values are: + // + // - `create_time`: corresponds to time the triggeredJob was created. + // - `update_time`: corresponds to time the triggeredJob was last updated. + // - `name`: corresponds to JobTrigger's display name. + // - `status`: corresponds to the triggeredJob status. + string order_by = 4; +} + +// Response message for ListJobTriggers. +message ListJobTriggersResponse { + // List of triggeredJobs, up to page_size in ListJobTriggersRequest. + repeated JobTrigger job_triggers = 1; + + // If the next page is available then the next page token to be used + // in following ListJobTriggers request. + string next_page_token = 2; +} + +// Request message for DeleteJobTrigger. +message DeleteJobTriggerRequest { + // Resource name of the project and the triggeredJob, for example + // `projects/dlp-test-project/jobTriggers/53234423`. + string name = 1; +} + +message InspectJobConfig { + // The data to scan. + StorageConfig storage_config = 1; + + // How and what to scan for. + InspectConfig inspect_config = 2; + + // If provided, will be used as the default for all values in InspectConfig. + // `inspect_config` will be merged into the values persisted as part of the + // template. + string inspect_template_name = 3; + + // Actions to execute at the completion of the job. Are executed in the order + // provided. + repeated Action actions = 4; +} + +// Combines all of the information about a DLP job. +message DlpJob { + enum JobState { + JOB_STATE_UNSPECIFIED = 0; + + // The job has not yet started. + PENDING = 1; + + // The job is currently running. + RUNNING = 2; + + // The job is no longer running. + DONE = 3; + + // The job was canceled before it could complete. + CANCELED = 4; + + // The job had an error and did not complete. + FAILED = 5; + } + + // The server-assigned name. + string name = 1; + + // The type of job. + DlpJobType type = 2; + + // State of a job. + JobState state = 3; + + oneof details { + // Results from analyzing risk of a data source. + AnalyzeDataSourceRiskDetails risk_details = 4; + + // Results from inspecting a data source. + InspectDataSourceDetails inspect_details = 5; + } + + // Time when the job was created. + google.protobuf.Timestamp create_time = 6; + + // Time when the job started. + google.protobuf.Timestamp start_time = 7; + + // Time when the job finished. + google.protobuf.Timestamp end_time = 8; + + // If created by a job trigger, the resource name of the trigger that + // instantiated the job. + string job_trigger_name = 10; + + // A stream of errors encountered running the job. + repeated Error errors = 11; +} + +// The request message for [DlpJobs.GetDlpJob][]. +message GetDlpJobRequest { + // The name of the DlpJob resource. + string name = 1; +} + +// The request message for listing DLP jobs. +message ListDlpJobsRequest { + // The parent resource name, for example projects/my-project-id. + string parent = 4; + + // Optional. Allows filtering. + // + // Supported syntax: + // + // * Filter expressions are made up of one or more restrictions. + // * Restrictions can be combined by `AND` or `OR` logical operators. A + // sequence of restrictions implicitly uses `AND`. + // * A restriction has the form of ` `. + // * Supported fields/values for inspect jobs: + // - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED + // - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + // - `trigger_name` - The resource name of the trigger that created job. + // * Supported fields for risk analysis jobs: + // - `state` - RUNNING|CANCELED|FINISHED|FAILED + // * The operator must be `=` or `!=`. + // + // Examples: + // + // * inspected_storage = cloud_storage AND state = done + // * inspected_storage = cloud_storage OR inspected_storage = bigquery + // * inspected_storage = cloud_storage AND (state = done OR state = canceled) + // + // The length of this field should be no more than 500 characters. + string filter = 1; + + // The standard list page size. + int32 page_size = 2; + + // The standard list page token. + string page_token = 3; + + // The type of job. Defaults to `DlpJobType.INSPECT` + DlpJobType type = 5; +} + +// The response message for listing DLP jobs. +message ListDlpJobsResponse { + // A list of DlpJobs that matches the specified filter in the request. + repeated DlpJob jobs = 1; + + // The standard List next-page token. + string next_page_token = 2; +} + +// The request message for canceling a DLP job. +message CancelDlpJobRequest { + // The name of the DlpJob resource to be cancelled. + string name = 1; +} + +// The request message for deleting a DLP job. +message DeleteDlpJobRequest { + // The name of the DlpJob resource to be deleted. + string name = 1; +} + +// Request message for CreateDeidentifyTemplate. +message CreateDeidentifyTemplateRequest { + // The parent resource name, for example projects/my-project-id or + // organizations/my-org-id. + string parent = 1; + + // The DeidentifyTemplate to create. + DeidentifyTemplate deidentify_template = 2; + + // The template 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 template_id = 3; +} + +// Request message for UpdateDeidentifyTemplate. +message UpdateDeidentifyTemplateRequest { + // Resource name of organization and deidentify template to be updated, for + // example `organizations/433245324/deidentifyTemplates/432452342` or + // projects/project-id/deidentifyTemplates/432452342. + string name = 1; + + // New DeidentifyTemplate value. + DeidentifyTemplate deidentify_template = 2; + + // Mask to control which fields get updated. + google.protobuf.FieldMask update_mask = 3; +} + +// Request message for GetDeidentifyTemplate. +message GetDeidentifyTemplateRequest { + // Resource name of the organization and deidentify template to be read, for + // example `organizations/433245324/deidentifyTemplates/432452342` or + // projects/project-id/deidentifyTemplates/432452342. + string name = 1; +} + +// Request message for ListDeidentifyTemplates. +message ListDeidentifyTemplatesRequest { + // 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 `ListDeidentifyTemplates`. + 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 ListDeidentifyTemplates. +message ListDeidentifyTemplatesResponse { + // List of deidentify templates, up to page_size in + // ListDeidentifyTemplatesRequest. + repeated DeidentifyTemplate deidentify_templates = 1; + + // If the next page is available then the next page token to be used + // in following ListDeidentifyTemplates request. + string next_page_token = 2; +} + +// Request message for DeleteDeidentifyTemplate. +message DeleteDeidentifyTemplateRequest { + // Resource name of the organization and deidentify template to be deleted, + // for example `organizations/433245324/deidentifyTemplates/432452342` or + // projects/project-id/deidentifyTemplates/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. + CONTENT_UNSPECIFIED = 0; + + // Text content within the data, excluding any metadata. + CONTENT_TEXT = 1; + + // Images found in the data. + CONTENT_IMAGE = 2; +} + +// Parts of the APIs which use certain infoTypes. +enum InfoTypeSupportedBy { + ENUM_TYPE_UNSPECIFIED = 0; + + // Supported by the inspect operations. + INSPECT = 1; + + // Supported by the risk analysis operations. + RISK_ANALYSIS = 2; +} + +// Operators available for comparing the value of fields. +enum RelationalOperator { + RELATIONAL_OPERATOR_UNSPECIFIED = 0; + + // Equal. + EQUAL_TO = 1; + + // Not equal to. + NOT_EQUAL_TO = 2; + + // Greater than. + GREATER_THAN = 3; + + // Less than. + LESS_THAN = 4; + + // Greater than or equals. + GREATER_THAN_OR_EQUALS = 5; + + // Less than or equals. + LESS_THAN_OR_EQUALS = 6; + + // Exists + EXISTS = 7; +} + +// An enum to represent the various type of DLP jobs. +enum DlpJobType { + DLP_JOB_TYPE_UNSPECIFIED = 0; + + // The job inspected Google Cloud for sensitive data. + INSPECT_JOB = 1; + + // The job executed a Risk Analysis computation. + RISK_ANALYSIS_JOB = 2; +} 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 new file mode 100644 index 00000000000..fd6131cb7d7 --- /dev/null +++ b/packages/google-privacy-dlp/protos/google/privacy/dlp/v2/storage.proto @@ -0,0 +1,389 @@ +// Copyright 2018 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +syntax = "proto3"; + +package google.privacy.dlp.v2; + +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Dlp.V2"; +option go_package = "google.golang.org/genproto/googleapis/privacy/dlp/v2;dlp"; +option java_multiple_files = true; +option java_outer_classname = "DlpStorage"; +option java_package = "com.google.privacy.dlp.v2"; +option php_namespace = "Google\\Cloud\\Dlp\\V2"; + + +// Type of information detected by the API. +message InfoType { + // Name of the information type. + string name = 1; +} + +// Custom information type provided by the user. Used to find domain-specific +// sensitive information configurable to the data in question. +message CustomInfoType { + // Custom information type based on a dictionary of words or phrases. This can + // be used to match sensitive information specific to the data, such as a list + // of employee IDs or job titles. + // + // Dictionary words are case-insensitive and all characters other than letters + // and digits in the unicode [Basic Multilingual + // Plane](https://en.wikipedia.org/wiki/Plane_%28Unicode%29#Basic_Multilingual_Plane) + // will be replaced with whitespace when scanning for matches, so the + // dictionary phrase "Sam Johnson" will match all three phrases "sam johnson", + // "Sam, Johnson", and "Sam (Johnson)". Additionally, the characters + // surrounding any match must be of a different type than the adjacent + // characters within the word, so letters must be next to non-letters and + // digits next to non-digits. For example, the dictionary word "jen" will + // match the first three letters of the text "jen123" but will return no + // matches for "jennifer". + // + // 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. + message Dictionary { + // Message defining a list of words or phrases to search for in the data. + message WordList { + // Words or phrases defining the dictionary. The dictionary must contain + // at least one phrase and every phrase must contain at least 2 characters + // that are letters or digits. [required] + repeated string words = 1; + } + + oneof source { + // List of words or phrases to search for. + WordList word_list = 1; + } + } + + // Message defining a custom regular expression. + message Regex { + // Pattern defining the regular expression. + string pattern = 1; + } + + // Message for detecting output from deidentification transformations + // such as + // [`CryptoReplaceFfxFpeConfig`](/dlp/docs/reference/rest/v2/content/deidentify#CryptoReplaceFfxFpeConfig). + // These types of transformations are + // those that perform pseudonymization, thereby producing a "surrogate" as + // output. This should be used in conjunction with a field on the + // transformation such as `surrogate_info_type`. This custom info type does + // not support the use of `detection_rules`. + message SurrogateType { + + } + + // Rule for modifying a custom info type to alter behavior under certain + // circumstances, depending on the specific details of the rule. Not supported + // for the `surrogate_type` custom info type. + message DetectionRule { + // Message for specifying a window around a finding to apply a detection + // rule. + message Proximity { + // Number of characters before the finding to consider. + int32 window_before = 1; + + // Number of characters after the finding to consider. + int32 window_after = 2; + } + + // Message for specifying an adjustment to the likelihood of a finding as + // part of a detection rule. + message LikelihoodAdjustment { + oneof adjustment { + // Set the likelihood of a finding to a fixed value. + Likelihood fixed_likelihood = 1; + + // Increase or decrease the likelihood by the specified number of + // levels. For example, if a finding would be `POSSIBLE` without the + // detection rule and `relative_likelihood` is 1, then it is upgraded to + // `LIKELY`, while a value of -1 would downgrade it to `UNLIKELY`. + // Likelihood may never drop below `VERY_UNLIKELY` or exceed + // `VERY_LIKELY`, so applying an adjustment of 1 followed by an + // adjustment of -1 when base likelihood is `VERY_LIKELY` will result in + // a final likelihood of `LIKELY`. + int32 relative_likelihood = 2; + } + } + + // Detection rule that adjusts the likelihood of findings within a certain + // proximity of hotwords. + message HotwordRule { + // Regex pattern defining what qualifies as a hotword. + Regex hotword_regex = 1; + + // Proximity of the finding within which the entire hotword must reside. + // The total length of the window cannot exceed 1000 characters. Note that + // the finding itself will be included in the window, so that hotwords may + // be used to match substrings of the finding itself. For example, the + // certainty of a phone number regex "\(\d{3}\) \d{3}-\d{4}" could be + // adjusted upwards if the area code is known to be the local area code of + // a company office using the hotword regex "\(xxx\)", where "xxx" + // is the area code in question. + Proximity proximity = 2; + + // Likelihood adjustment to apply to all matching findings. + LikelihoodAdjustment likelihood_adjustment = 3; + } + + oneof type { + // Hotword-based detection rule. + HotwordRule hotword_rule = 1; + } + } + + // Info type configuration. All custom info types must have configurations + // that do not conflict with built-in info types or other custom info types. + InfoType info_type = 1; + + // Likelihood to return for this custom info type. This base value can be + // altered by a detection rule if the finding meets the criteria specified by + // the rule. Defaults to `VERY_LIKELY` if not specified. + Likelihood likelihood = 6; + + oneof type { + // Dictionary-based custom info type. + Dictionary dictionary = 2; + + // Regex-based custom info type. + Regex regex = 3; + + // Surrogate info type. + SurrogateType surrogate_type = 4; + } + + // Set of detection rules to apply to all findings of this custom info type. + // Rules are applied in order that they are specified. Not supported for the + // `surrogate_type` custom info type. + repeated DetectionRule detection_rules = 7; +} + +// General identifier of a data field in a storage service. +message FieldId { + // Name describing the field. + string name = 1; +} + +// Datastore partition ID. +// A partition ID identifies a grouping of entities. The grouping is always +// by project and namespace, however the namespace ID may be empty. +// +// A partition ID contains several dimensions: +// project ID and namespace ID. +message PartitionId { + // The ID of the project to which the entities belong. + string project_id = 2; + + // If not empty, the ID of the namespace to which the entities belong. + string namespace_id = 4; +} + +// A representation of a Datastore kind. +message KindExpression { + // The name of the kind. + string name = 1; +} + +// Options defining a data set within Google Cloud Datastore. +message DatastoreOptions { + // A partition ID identifies a grouping of entities. The grouping is always + // by project and namespace, however the namespace ID may be empty. + PartitionId partition_id = 1; + + // The kind to process. + KindExpression kind = 2; +} + +// Options defining a file or a set of files (path ending with *) within +// a Google Cloud Storage bucket. +message CloudStorageOptions { + // Set of files to scan. + message FileSet { + // The url, in the format `gs:///`. Trailing wildcard in the + // path is allowed. + string url = 1; + } + + 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. + int64 bytes_limit_per_file = 4; +} + +// Options defining BigQuery table and row identifiers. +message BigQueryOptions { + // Complete BigQuery table reference. + BigQueryTable table_reference = 1; + + // References to fields uniquely identifying rows within the table. + // Nested fields in the format, like `person.birthdate.year`, are allowed. + repeated FieldId identifying_fields = 2; +} + +// Shared message indicating Cloud storage type. +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. + google.protobuf.Timestamp start_time = 1; + + // Exclude files 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. + // The valid data types of the timestamp field are: + // for BigQuery - timestamp, date, datetime; + // for Datastore - timestamp. + // Datastore entity will be scanned if the timestamp property does not exist + // or its value is empty or invalid. + FieldId timestamp_field = 3; + + // When the job is started by a JobTrigger we will automatically figure out + // a valid start_time to avoid scanning files that have not been modified + // since the last time the JobTrigger executed. This will be based on the + // time of the execution of the last run of the JobTrigger. + bool enable_auto_population_of_timespan_config = 4; + } + + oneof type { + // Google Cloud Datastore options specification. + DatastoreOptions datastore_options = 2; + + // Google Cloud Storage options specification. + CloudStorageOptions cloud_storage_options = 3; + + // BigQuery options specification. + BigQueryOptions big_query_options = 4; + } + + TimespanConfig timespan_config = 6; +} + +// Row key for identifying a record in BigQuery table. +message BigQueryKey { + // Complete BigQuery table reference. + BigQueryTable table_reference = 1; + + // Absolute number of the row from the beginning of the table at the time + // of scanning. + int64 row_number = 2; +} + +// Record key for a finding in Cloud Datastore. +message DatastoreKey { + // Datastore entity key. + Key entity_key = 1; +} + +// A unique identifier for a Datastore entity. +// If a key's partition ID or any of its path kinds or names are +// reserved/read-only, the key is reserved/read-only. +// A reserved/read-only key is forbidden in certain documented contexts. +message Key { + // A (kind, ID/name) pair used to construct a key path. + // + // If either name or ID is set, the element is complete. + // If neither is set, the element is incomplete. + message PathElement { + // The kind of the entity. + // A kind matching regex `__.*__` is reserved/read-only. + // A kind must not contain more than 1500 bytes when UTF-8 encoded. + // Cannot be `""`. + string kind = 1; + + // The type of ID. + oneof id_type { + // The auto-allocated ID of the entity. + // Never equal to zero. Values less than zero are discouraged and may not + // be supported in the future. + int64 id = 2; + + // The name of the entity. + // A name matching regex `__.*__` is reserved/read-only. + // A name must not be more than 1500 bytes when UTF-8 encoded. + // Cannot be `""`. + string name = 3; + } + } + + // Entities are partitioned into subsets, currently identified by a project + // ID and namespace ID. + // Queries are scoped to a single partition. + PartitionId partition_id = 1; + + // The entity path. + // An entity path consists of one or more elements composed of a kind and a + // string or numerical identifier, which identify entities. The first + // element identifies a _root entity_, the second element identifies + // a _child_ of the root entity, the third element identifies a child of the + // second entity, and so forth. The entities identified by all prefixes of + // the path are called the element's _ancestors_. + // + // A path can never be empty, and a path can have at most 100 elements. + repeated PathElement path = 2; +} + +// Message for a unique key indicating a record that contains a finding. +message RecordKey { + oneof type { + DatastoreKey datastore_key = 2; + + BigQueryKey big_query_key = 3; + } +} + +// Message defining the location of a BigQuery table. A table is uniquely +// identified by its project_id, dataset_id, and table_name. Within a query +// a table is often referenced with a string in the format of: +// `:.` or +// `..`. +message BigQueryTable { + // The Google Cloud Platform project ID of the project containing the table. + // If omitted, project ID is inferred from the API call. + string project_id = 1; + + // Dataset ID of the table. + string dataset_id = 2; + + // Name of the table. + string table_id = 3; +} + +// Categorization of results based on how likely they are to represent a match, +// based on the number of elements they contain which imply a match. +enum Likelihood { + // Default value; information with all likelihoods is included. + LIKELIHOOD_UNSPECIFIED = 0; + + // Few matching elements. + VERY_UNLIKELY = 1; + + UNLIKELY = 2; + + // Some matching elements. + POSSIBLE = 3; + + LIKELY = 4; + + // Many matching elements. + VERY_LIKELY = 5; +} diff --git a/packages/google-privacy-dlp/samples/.eslintrc.yml b/packages/google-privacy-dlp/samples/.eslintrc.yml index 282535f55f6..7e847a0e1eb 100644 --- a/packages/google-privacy-dlp/samples/.eslintrc.yml +++ b/packages/google-privacy-dlp/samples/.eslintrc.yml @@ -1,3 +1,4 @@ --- rules: no-console: off + no-warning-comments: off diff --git a/packages/google-privacy-dlp/samples/README.md b/packages/google-privacy-dlp/samples/README.md index b302767e0b7..9b01bb8b224 100644 --- a/packages/google-privacy-dlp/samples/README.md +++ b/packages/google-privacy-dlp/samples/README.md @@ -15,6 +15,9 @@ The [Data Loss Prevention API](https://cloud.google.com/dlp/docs/) provides prog * [Metadata](#metadata) * [DeID](#deid) * [Risk Analysis](#risk-analysis) + * [Inspect Templates](#inspect-templates) + * [Job Management](#job-management) + * [Job Triggers](#job-triggers) ## Before you begin @@ -36,36 +39,39 @@ __Usage:__ `node inspect.js --help` inspect.js Commands: - inspect.js string Inspect a string using the Data Loss Prevention API. - inspect.js file Inspects a local text, PNG, or JPEG file using the Data Loss - Prevention API. - inspect.js gcsFilePromise Inspects a text file stored on Google Cloud Storage using the Data - Loss Prevention API and the promise pattern. - inspect.js gcsFileEvent Inspects a text file stored on Google Cloud Storage using the Data - Loss Prevention API and the event-handler pattern. - inspect.js bigquery Inspects a BigQuery table using the Data Loss Prevention API. - inspect.js datastore Inspect a Datastore instance using the Data Loss Prevention API. + inspect.js string Inspect a string using the Data Loss Prevention API. + inspect.js file Inspects a local text, PNG, or JPEG file using the Data + Loss Prevention API. + inspect.js gcsFile Inspects a text file stored on Google Cloud Storage with + the Data Loss Prevention API, using Pub/Sub for job + notifications. + inspect.js bigquery Inspects a BigQuery table using the Data Loss Prevention + API using Pub/Sub for job notifications. + inspect.js datastore Inspect a Datastore instance using the Data Loss + Prevention API using Pub/Sub for job notifications. Options: - --version Show version number [boolean] + --version Show version number [boolean] -m, --minLikelihood [string] [choices: "LIKELIHOOD_UNSPECIFIED", "VERY_UNLIKELY", "UNLIKELY", "POSSIBLE", "LIKELY", "VERY_LIKELY"] [default: "LIKELIHOOD_UNSPECIFIED"] + -c, --callingProjectId [string] [default: ""] + -p, --dataProjectId [string] [default: ""] -f, --maxFindings [number] [default: 0] -q, --includeQuote [boolean] [default: true] -t, --infoTypes [array] [default: ["PHONE_NUMBER","EMAIL_ADDRESS","CREDIT_CARD_NUMBER"]] - --help Show help [boolean] + -n, --notificationTopic [string] + --help Show help [boolean] Examples: - node inspect.js string "My phone number is (123) 456-7890 and my email address is me@somedomain.com" + node inspect.js string "My email address is me@somedomain.com" node inspect.js file resources/test.txt - node inspect.js gcsFilePromise my-bucket my-file.txt - node inspect.js gcsFileEvent my-bucket my-file.txt - node inspect.js bigquery my-dataset my-table - node inspect.js datastore my-datastore-kind + node inspect.js gcsFile my-bucket my-file.txt my-topic my-subscription + node inspect.js bigquery my-dataset my-table my-topic my-subscription + node inspect.js datastore my-datastore-kind my-topic my-subscription For more information, see https://cloud.google.com/dlp/docs. Optional flags are explained at -https://cloud.google.com/dlp/docs/reference/rest/v2beta1/content/inspect#InspectConfig +https://cloud.google.com/dlp/docs/reference/rest/v2/InspectConfig ``` [inspect_0_docs]: https://cloud.google.com/dlp/docs @@ -83,23 +89,22 @@ __Usage:__ `node redact.js --help` redact.js Commands: - redact.js string Redact sensitive data from a string using the Data Loss Prevention API. - redact.js image Redact sensitive data from an image using the Data Loss Prevention API. + redact.js image Redact sensitive data from an image using the Data Loss Prevention API. Options: - --version Show version number [boolean] + --version Show version number [boolean] -m, --minLikelihood [string] [choices: "LIKELIHOOD_UNSPECIFIED", "VERY_UNLIKELY", "UNLIKELY", "POSSIBLE", "LIKELY", "VERY_LIKELY"] [default: "LIKELIHOOD_UNSPECIFIED"] -t, --infoTypes [array] [required] - --help Show help [boolean] + -c, --callingProject [string] [default: ""] + --help Show help [boolean] Examples: - node redact.js string "My name is Gary" "REDACTED" -t US_MALE_NAME - node redact.js image resources/test.png redaction_result.png -t US_MALE_NAME + node redact.js image resources/test.png result.png -t MALE_NAME For more information, see https://cloud.google.com/dlp/docs. Optional flags are explained at -https://cloud.google.com/dlp/docs/reference/rest/v2beta1/content/inspect#InspectConfig +https://cloud.google.com/dlp/docs/reference/rest/v2/projects.image/redact#ImageRedactionConfig ``` [redact_1_docs]: https://cloud.google.com/dlp/docs @@ -117,8 +122,7 @@ __Usage:__ `node metadata.js --help` metadata.js Commands: - metadata.js infoTypes List types of sensitive information within a category. - metadata.js categories List root categories of sensitive information. + metadata.js infoTypes [filter] List the types of sensitive information the DLP API supports. Options: --version Show version number [boolean] @@ -126,8 +130,7 @@ Options: --help Show help [boolean] Examples: - node metadata.js infoTypes GOVERNMENT - node metadata.js categories + node metadata.js infoTypes "supported_by=INSPECT" For more information, see https://cloud.google.com/dlp/docs ``` @@ -147,16 +150,28 @@ __Usage:__ `node deid.js --help` deid.js Commands: - deid.js mask Deidentify sensitive data by masking it with a character. - deid.js fpe Deidentify sensitive data using Format Preserving Encryption (FPE). + deid.js deidMask Deidentify sensitive data in a string by masking it with + a character. + deid.js deidFpe Deidentify sensitive data in a string using Format + Preserving Encryption (FPE). + deid.js reidFpe Reidentify sensitive data in a string using Format + Preserving Encryption (FPE). + deid.js deidDateShift Deidentify dates in a CSV file by pseudorandomly + [dateFields...] shifting them. Options: - --version Show version number [boolean] - --help Show help [boolean] + --version Show version number [boolean] + -c, --callingProjectId [string] [default: ""] + --help Show help [boolean] Examples: - node deid.js mask "My SSN is 372819127" - node deid.js fpe "My SSN is 372819127" + node deid.js deidMask "My SSN is 372819127" + node deid.js deidFpe "My SSN is 372819127" + projects/my-project/locations/global/keyrings/my-keyring -s SSN_TOKEN + node deid.js reidFpe "My SSN is SSN_TOKEN(9):#########" + projects/my-project/locations/global/keyrings/my-keyring SSN_TOKEN -a NUMERIC + node deid.js deidDateShift dates.csv dates-shifted.csv 30 30 birth_date register_date [-w + -n projects/my-project/locations/global/keyrings/my-keyring] For more information, see https://cloud.google.com/dlp/docs. ``` @@ -177,24 +192,33 @@ risk.js Commands: risk.js numerical Computes risk metrics of a column of numbers in a Google - BigQuery table. + BigQuery table. risk.js categorical Computes risk metrics of a column of data in a Google - BigQuery table. - risk.js kAnonymity Computes the k-anonymity of a column set in a Google - [quasiIdColumnNames..] BigQuery table. + BigQuery table. + risk.js kAnonymity Computes the k-anonymity of a column set in a Google + [quasiIdColumnNames..] BigQuery table. risk.js lDiversity Computes the l-diversity of a column set in a Google - [quasiIdColumnNames..] BigQuery table. + BigQuery table. + [quasiIdColumnNames..] + risk.js kMap Computes the k-map risk estimation of a column set in a + [quasiIdColumnNames..] Google BigQuery table. Options: - --version Show version number [boolean] - -p, --projectId [string] - --help Show help [boolean] + --version Show version number [boolean] + -c, --callingProjectId [string] [default: ""] + -p, --tableProjectId [string] [default: ""] + --help Show help [boolean] Examples: - node risk.js numerical nhtsa_traffic_fatalities accident_2015 state_number -p bigquery-public-data - node risk.js categorical nhtsa_traffic_fatalities accident_2015 state_name -p bigquery-public-data - node risk.js kAnonymity nhtsa_traffic_fatalities accident_2015 state_number county -p bigquery-public-data - node risk.js lDiversity nhtsa_traffic_fatalities accident_2015 city state_number county -p bigquery-public-data + node risk.js numerical nhtsa_traffic_fatalities accident_2015 state_number my-topic my-subscription -p + bigquery-public-data + node risk.js categorical nhtsa_traffic_fatalities accident_2015 state_name my-topic my-subscription -p + bigquery-public-data + node risk.js kAnonymity nhtsa_traffic_fatalities accident_2015 my-topic my-subscription state_number county -p + bigquery-public-data + node risk.js lDiversity nhtsa_traffic_fatalities accident_2015 my-topic my-subscription city state_number county -p + bigquery-public-data + node risk kMap san_francisco bikeshare_trips my-topic my-subscription zip_code -t US_ZIP_5 -p bigquery-public-data For more information, see https://cloud.google.com/dlp/docs. ``` @@ -202,5 +226,100 @@ For more information, see https://cloud.google.com/dlp/docs. [risk_4_docs]: https://cloud.google.com/dlp/docs [risk_4_code]: risk.js -[shell_img]: http://gstatic.com/cloudssh/images/open-btn.png +### Inspect Templates + +View the [source code][templates_5_code]. + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/templates.js,samples/README.md) + +__Usage:__ `node templates.js --help` + +``` +templates.js + +Commands: + templates.js create Create a new DLP inspection configuration template. + templates.js list List DLP inspection configuration templates. + templates.js delete Delete the DLP inspection configuration template with the specified name. + +Options: + --version Show version number [boolean] + -c, --callingProjectId [string] [default: ""] + -p, --tableProjectId [string] [default: ""] + --help Show help [boolean] + +Examples: + node templates.js create -m VERY_LIKELY -t PERSON_NAME -f 5 -q false -i my-template-id + node templates.js list + node templates.js delete projects/my-project/inspectTemplates/##### + +For more information, see https://cloud.google.com/dlp/docs. +``` + +[templates_5_docs]: https://cloud.google.com/dlp/docs +[templates_5_code]: templates.js + +### Job Management + +View the [source code][jobs_6_code]. + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/jobs.js,samples/README.md) + +__Usage:__ `node jobs.js --help` + +``` +jobs.js + +Commands: + jobs.js list List Data Loss Prevention API jobs corresponding to a given filter. + jobs.js delete Delete results of a Data Loss Prevention API job. + +Options: + --version Show version number [boolean] + -c, --callingProject [string] [default: ""] + --help Show help [boolean] + +Examples: + node jobs.js list "state=DONE" -t RISK_ANALYSIS_JOB + node jobs.js delete projects/YOUR_GCLOUD_PROJECT/dlpJobs/X-##### + +For more information, see https://cloud.google.com/dlp/docs. +``` + +[jobs_6_docs]: https://cloud.google.com/dlp/docs +[jobs_6_code]: jobs.js + +### Job Triggers + +View the [source code][triggers_7_code]. + +[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/triggers.js,samples/README.md) + +__Usage:__ `node triggers.js --help` + +``` +triggers.js + +Commands: + triggers.js create Create a Data Loss Prevention API job trigger. + triggers.js list List Data Loss Prevention API job triggers. + triggers.js delete Delete a Data Loss Prevention API job trigger. + +Options: + --version Show version number [boolean] + -c, --callingProjectId [string] [default: ""] + --help Show help [boolean] + +Examples: + node triggers.js create my-bucket 1 + node triggers.js list + node triggers.js delete projects/my-project/jobTriggers/my-trigger + +For more information, see https://cloud.google.com/dlp/docs. +``` + +[triggers_7_docs]: https://cloud.google.com/dlp/docs +[triggers_7_code]: triggers.js + +[shell_img]: //gstatic.com/cloudssh/images/open-btn.png [shell_link]: https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-dlp&page=editor&open_in_editor=samples/README.md diff --git a/packages/google-privacy-dlp/samples/package.json b/packages/google-privacy-dlp/samples/package.json index f80208af63f..bc0a231df3c 100644 --- a/packages/google-privacy-dlp/samples/package.json +++ b/packages/google-privacy-dlp/samples/package.json @@ -1,6 +1,6 @@ { - "name": "dlp-cli", - "description": "Command-line interface for Google Cloud Platform's Data Loss Prevention API", + "name": "dlp-samples", + "description": "Code samples for Google Cloud Platform's Data Loss Prevention API", "version": "0.0.1", "private": true, "license": "Apache-2.0", @@ -10,11 +10,12 @@ "node": ">=4.0.0" }, "scripts": { - "test": "repo-tools test run --cmd ava -- -T 1m --verbose system-test/*.test.js" + "test": "repo-tools test run --cmd ava -- -T 5m --verbose system-test/*.test.js" }, "dependencies": { "@google-cloud/bigquery": "^0.10.0", - "@google-cloud/dlp": "^0.2.0", + "@google-cloud/dlp": "^0.3.0", + "@google-cloud/pubsub": "^0.16.2", "google-auth-library": "0.11.0", "google-auto-auth": "0.7.2", "google-proto-files": "0.13.1", @@ -26,6 +27,7 @@ }, "devDependencies": { "@google-cloud/nodejs-repo-tools": "2.1.0", - "ava": "0.23.0" + "ava": "0.23.0", + "uuid": "^3.2.1" } } diff --git a/packages/google-privacy-dlp/samples/quickstart.js b/packages/google-privacy-dlp/samples/quickstart.js index 587c57f05a1..d431f0e622c 100644 --- a/packages/google-privacy-dlp/samples/quickstart.js +++ b/packages/google-privacy-dlp/samples/quickstart.js @@ -25,6 +25,9 @@ const dlp = new DLP.DlpServiceClient(); // The string to inspect const string = 'Robert Frost'; +// The project ID to run the API call under +const projectId = process.env.GCLOUD_PROJECT; + // The minimum likelihood required before returning a match const minLikelihood = 'LIKELIHOOD_UNSPECIFIED'; @@ -32,30 +35,33 @@ const minLikelihood = 'LIKELIHOOD_UNSPECIFIED'; const maxFindings = 0; // The infoTypes of information to match -const infoTypes = [{name: 'US_MALE_NAME'}, {name: 'US_FEMALE_NAME'}]; +const infoTypes = [{name: 'PERSON_NAME'}, {name: 'US_STATE'}]; // Whether to include the matching string const includeQuote = true; -// Construct items to inspect -const items = [{type: 'text/plain', value: string}]; +// Construct item to inspect +const item = {value: string}; // Construct request const request = { + parent: dlp.projectPath(projectId), inspectConfig: { infoTypes: infoTypes, minLikelihood: minLikelihood, - maxFindings: maxFindings, + limits: { + maxFindingsPerRequest: maxFindings, + }, includeQuote: includeQuote, }, - items: items, + item: item, }; // Run request dlp .inspectContent(request) .then(response => { - const findings = response[0].results[0].findings; + const findings = response[0].result.findings; if (findings.length > 0) { console.log(`Findings:`); findings.forEach(finding => { diff --git a/packages/google-privacy-dlp/smoke-test/dlp_service_smoke_test.js b/packages/google-privacy-dlp/smoke-test/dlp_service_smoke_test.js deleted file mode 100644 index ad941c44c42..00000000000 --- a/packages/google-privacy-dlp/smoke-test/dlp_service_smoke_test.js +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2017, Google LLC All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// 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. - -'use strict'; - -describe('DlpServiceSmokeTest', () => { - it('successfully makes a call to the service', done => { - const dlp = require('../src'); - - var client = new dlp.v2beta1.DlpServiceClient({ - // optional auth parameters. - }); - - var minLikelihood = 'POSSIBLE'; - var inspectConfig = { - minLikelihood: minLikelihood, - }; - var type = 'text/plain'; - var value = 'my phone number is 215-512-1212'; - var itemsElement = { - type: type, - value: value, - }; - var items = [itemsElement]; - var request = { - inspectConfig: inspectConfig, - items: items, - }; - client.inspectContent(request) - .then(responses => { - var response = responses[0]; - console.log(response); - }) - .then(done) - .catch(done); - }); -}); diff --git a/packages/google-privacy-dlp/src/index.js b/packages/google-privacy-dlp/src/index.js index 79a98669d97..86b9c7ada22 100644 --- a/packages/google-privacy-dlp/src/index.js +++ b/packages/google-privacy-dlp/src/index.js @@ -30,6 +30,7 @@ // Import the clients for each version supported by this package. const gapic = Object.freeze({ v2beta1: require('./v2beta1'), + v2: require('./v2'), }); /** @@ -66,7 +67,7 @@ const gapic = Object.freeze({ * @property {constructor} DlpServiceClient * Reference to {@link v2beta1.DlpServiceClient} */ -module.exports = gapic.v2beta1; +module.exports = gapic.v2; /** * @type {object} @@ -74,6 +75,7 @@ module.exports = gapic.v2beta1; * Reference to {@link v2beta1.DlpServiceClient} */ module.exports.v2beta1 = gapic.v2beta1; +module.exports.v2 = gapic.v2; // Alias `module.exports` as `module.exports.default`, for future-proofing. module.exports.default = Object.assign({}, module.exports); diff --git a/packages/google-privacy-dlp/src/v2/dlp_service_client.js b/packages/google-privacy-dlp/src/v2/dlp_service_client.js new file mode 100644 index 00000000000..7a12e277928 --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/dlp_service_client.js @@ -0,0 +1,2382 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +'use strict'; + +const gapicConfig = require('./dlp_service_client_config'); +const gax = require('google-gax'); +const merge = require('lodash.merge'); +const path = require('path'); + +const VERSION = require('../../package.json').version; + +/** + * The DLP API is a service that allows clients + * to detect the presence of Personally Identifiable Information (PII) and other + * privacy-sensitive data in user-supplied, unstructured data streams, like text + * blocks or images. + * The service also includes methods for sensitive data redaction and + * scheduling of data scans on Google Cloud Platform based data sets. + * + * @class + * @memberof v2 + */ +class DlpServiceClient { + /** + * Construct an instance of DlpServiceClient. + * + * @param {object} [options] - The configuration object. See the subsequent + * parameters for more details. + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {function} [options.promise] - Custom promise module to use instead + * of native Promises. + * @param {string} [options.servicePath] - The domain name of the + * API remote host. + */ + constructor(opts) { + this._descriptors = {}; + + // Ensure that options include the service address and port. + opts = Object.assign( + { + clientConfig: {}, + port: this.constructor.port, + servicePath: this.constructor.servicePath, + }, + opts + ); + + // Create a `gaxGrpc` object, with any grpc-specific options + // sent to the client. + opts.scopes = this.constructor.scopes; + var gaxGrpc = gax.grpc(opts); + + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth; + + // Determine the client header string. + var clientHeader = [ + `gl-node/${process.version.node}`, + `grpc/${gaxGrpc.grpcVersion}`, + `gax/${gax.version}`, + `gapic/${VERSION}`, + ]; + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + + // Load the applicable protos. + var protos = merge( + {}, + gaxGrpc.loadProto( + path.join(__dirname, '..', '..', 'protos'), + 'google/privacy/dlp/v2/dlp.proto' + ) + ); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this._pathTemplates = { + organizationPathTemplate: new gax.PathTemplate( + 'organizations/{organization}' + ), + organizationDeidentifyTemplatePathTemplate: new gax.PathTemplate( + 'organizations/{organization}/deidentifyTemplates/{deidentify_template}' + ), + projectDeidentifyTemplatePathTemplate: new gax.PathTemplate( + 'projects/{project}/deidentifyTemplates/{deidentify_template}' + ), + organizationInspectTemplatePathTemplate: new gax.PathTemplate( + 'organizations/{organization}/inspectTemplates/{inspect_template}' + ), + projectInspectTemplatePathTemplate: new gax.PathTemplate( + 'projects/{project}/inspectTemplates/{inspect_template}' + ), + projectJobTriggerPathTemplate: new gax.PathTemplate( + 'projects/{project}/jobTriggers/{job_trigger}' + ), + projectPathTemplate: new gax.PathTemplate('projects/{project}'), + dlpJobPathTemplate: new gax.PathTemplate( + 'projects/{project}/dlpJobs/{dlp_job}' + ), + }; + + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this._descriptors.page = { + listInspectTemplates: new gax.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'inspectTemplates' + ), + listDeidentifyTemplates: new gax.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'deidentifyTemplates' + ), + listDlpJobs: new gax.PageDescriptor('pageToken', 'nextPageToken', 'jobs'), + listJobTriggers: new gax.PageDescriptor( + 'pageToken', + 'nextPageToken', + 'jobTriggers' + ), + }; + + // Put together the default options sent with requests. + var defaults = gaxGrpc.constructSettings( + 'google.privacy.dlp.v2.DlpService', + gapicConfig, + opts.clientConfig, + {'x-goog-api-client': clientHeader.join(' ')} + ); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this._innerApiCalls = {}; + + // Put together the "service stub" for + // google.privacy.dlp.v2.DlpService. + var dlpServiceStub = gaxGrpc.createStub( + protos.google.privacy.dlp.v2.DlpService, + opts + ); + + // Iterate over each of the methods that the service provides + // and create an API call method for each. + var dlpServiceStubMethods = [ + 'inspectContent', + 'redactImage', + 'deidentifyContent', + 'reidentifyContent', + 'listInfoTypes', + 'createInspectTemplate', + 'updateInspectTemplate', + 'getInspectTemplate', + 'listInspectTemplates', + 'deleteInspectTemplate', + 'createDeidentifyTemplate', + 'updateDeidentifyTemplate', + 'getDeidentifyTemplate', + 'listDeidentifyTemplates', + 'deleteDeidentifyTemplate', + 'createDlpJob', + 'listDlpJobs', + 'getDlpJob', + 'deleteDlpJob', + 'cancelDlpJob', + 'listJobTriggers', + 'getJobTrigger', + 'deleteJobTrigger', + 'updateJobTrigger', + 'createJobTrigger', + ]; + for (let methodName of dlpServiceStubMethods) { + this._innerApiCalls[methodName] = gax.createApiCall( + dlpServiceStub.then( + stub => + function() { + var args = Array.prototype.slice.call(arguments, 0); + return stub[methodName].apply(stub, args); + } + ), + defaults[methodName], + this._descriptors.page[methodName] + ); + } + } + + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'dlp.googleapis.com'; + } + + /** + * The port for this API service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + + /** + * Return the project ID used by this class. + * @param {function(Error, string)} callback - the callback to + * be called with the current project Id. + */ + getProjectId(callback) { + return this.auth.getProjectId(callback); + } + + // ------------------- + // -- Service calls -- + // ------------------- + + /** + * Finds potentially sensitive info in content. + * This method has limits on input size, processing time, and output size. + * [How-to guide for text](https://cloud.google.com/dlp/docs/inspecting-text), [How-to guide for + * images](https://cloud.google.com/dlp/docs/inspecting-images) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id. + * @param {Object} [request.inspectConfig] + * Configuration for the inspector. What specified here will override + * the template referenced by the inspect_template_name argument. + * + * This object should have the same structure as [InspectConfig]{@link google.privacy.dlp.v2.InspectConfig} + * @param {Object} [request.item] + * The item to inspect. + * + * This object should have the same structure as [ContentItem]{@link google.privacy.dlp.v2.ContentItem} + * @param {string} [request.inspectTemplateName] + * Optional template to use. Any configuration directly specified in + * inspect_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [InspectContentResponse]{@link google.privacy.dlp.v2.InspectContentResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [InspectContentResponse]{@link google.privacy.dlp.v2.InspectContentResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedParent = client.projectPath('[PROJECT]'); + * client.inspectContent({parent: formattedParent}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + inspectContent(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.inspectContent(request, options, callback); + } + + /** + * Redacts potentially sensitive info from an image. + * This method has limits on input size, processing time, and output size. + * [How-to guide](https://cloud.google.com/dlp/docs/redacting-sensitive-data-images) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id. + * @param {Object} [request.inspectConfig] + * Configuration for the inspector. + * + * This object should have the same structure as [InspectConfig]{@link google.privacy.dlp.v2.InspectConfig} + * @param {Object[]} [request.imageRedactionConfigs] + * The configuration for specifying what content to redact from images. + * + * This object should have the same structure as [ImageRedactionConfig]{@link google.privacy.dlp.v2.ImageRedactionConfig} + * @param {Object} [request.byteItem] + * The content must be PNG, JPEG, SVG or BMP. + * + * This object should have the same structure as [ByteContentItem]{@link google.privacy.dlp.v2.ByteContentItem} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [RedactImageResponse]{@link google.privacy.dlp.v2.RedactImageResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [RedactImageResponse]{@link google.privacy.dlp.v2.RedactImageResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedParent = client.projectPath('[PROJECT]'); + * client.redactImage({parent: formattedParent}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + redactImage(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.redactImage(request, options, callback); + } + + /** + * De-identifies potentially sensitive info from a ContentItem. + * This method has limits on input size and output size. + * [How-to guide](https://cloud.google.com/dlp/docs/deidentify-sensitive-data) + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id. + * @param {Object} [request.deidentifyConfig] + * Configuration for the de-identification of the content item. + * Items specified here will override the template referenced by the + * deidentify_template_name argument. + * + * This object should have the same structure as [DeidentifyConfig]{@link google.privacy.dlp.v2.DeidentifyConfig} + * @param {Object} [request.inspectConfig] + * Configuration for the inspector. + * Items specified here will override the template referenced by the + * inspect_template_name argument. + * + * This object should have the same structure as [InspectConfig]{@link google.privacy.dlp.v2.InspectConfig} + * @param {Object} [request.item] + * The item to de-identify. Will be treated as text. + * + * This object should have the same structure as [ContentItem]{@link google.privacy.dlp.v2.ContentItem} + * @param {string} [request.inspectTemplateName] + * Optional template to use. Any configuration directly specified in + * inspect_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * @param {string} [request.deidentifyTemplateName] + * Optional template to use. Any configuration directly specified in + * deidentify_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [DeidentifyContentResponse]{@link google.privacy.dlp.v2.DeidentifyContentResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [DeidentifyContentResponse]{@link google.privacy.dlp.v2.DeidentifyContentResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedParent = client.projectPath('[PROJECT]'); + * client.deidentifyContent({parent: formattedParent}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + deidentifyContent(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.deidentifyContent(request, options, callback); + } + + /** + * Re-identify content that has been de-identified. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name. + * @param {Object} [request.reidentifyConfig] + * Configuration for the re-identification of the content item. + * This field shares the same proto message type that is used for + * de-identification, however its usage here is for the reversal of the + * previous de-identification. Re-identification is performed by examining + * the transformations used to de-identify the items and executing the + * reverse. This requires that only reversible transformations + * be provided here. The reversible transformations are: + * + * - `CryptoReplaceFfxFpeConfig` + * + * This object should have the same structure as [DeidentifyConfig]{@link google.privacy.dlp.v2.DeidentifyConfig} + * @param {Object} [request.inspectConfig] + * Configuration for the inspector. + * + * This object should have the same structure as [InspectConfig]{@link google.privacy.dlp.v2.InspectConfig} + * @param {Object} [request.item] + * The item to re-identify. Will be treated as text. + * + * This object should have the same structure as [ContentItem]{@link google.privacy.dlp.v2.ContentItem} + * @param {string} [request.inspectTemplateName] + * Optional template to use. Any configuration directly specified in + * `inspect_config` will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * @param {string} [request.reidentifyTemplateName] + * Optional template to use. References an instance of `DeidentifyTemplate`. + * Any configuration directly specified in `reidentify_config` or + * `inspect_config` will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [ReidentifyContentResponse]{@link google.privacy.dlp.v2.ReidentifyContentResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ReidentifyContentResponse]{@link google.privacy.dlp.v2.ReidentifyContentResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedParent = client.projectPath('[PROJECT]'); + * client.reidentifyContent({parent: formattedParent}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + reidentifyContent(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.reidentifyContent(request, options, callback); + } + + /** + * Returns sensitive information types DLP supports. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} [request.languageCode] + * Optional BCP-47 language code for localized infoType friendly + * names. If omitted, or if localized strings are not available, + * en-US strings will be returned. + * @param {string} [request.filter] + * Optional filter to only return infoTypes supported by certain parts of the + * API. Defaults to supported_by=INSPECT. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [ListInfoTypesResponse]{@link google.privacy.dlp.v2.ListInfoTypesResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ListInfoTypesResponse]{@link google.privacy.dlp.v2.ListInfoTypesResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * + * client.listInfoTypes({}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + listInfoTypes(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.listInfoTypes(request, options, callback); + } + + /** + * Creates an inspect template for re-using frequently used configuration + * for inspecting content, images, and storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * @param {Object} [request.inspectTemplate] + * The InspectTemplate to create. + * + * This object should have the same structure as [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate} + * @param {string} [request.templateId] + * The template 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. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedParent = client.organizationPath('[ORGANIZATION]'); + * client.createInspectTemplate({parent: formattedParent}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + createInspectTemplate(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.createInspectTemplate( + request, + options, + callback + ); + } + + /** + * Updates the inspect template. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name of organization and inspectTemplate to be updated, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + * @param {Object} [request.inspectTemplate] + * New InspectTemplate value. + * + * This object should have the same structure as [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate} + * @param {Object} [request.updateMask] + * Mask to control which fields get updated. + * + * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedName = client.organizationInspectTemplatePath('[ORGANIZATION]', '[INSPECT_TEMPLATE]'); + * client.updateInspectTemplate({name: formattedName}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + updateInspectTemplate(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.updateInspectTemplate( + request, + options, + callback + ); + } + + /** + * Gets an inspect template. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} [request.name] + * Resource name of the organization and inspectTemplate to be read, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * + * client.getInspectTemplate({}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + getInspectTemplate(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.getInspectTemplate(request, options, callback); + } + + /** + * Lists inspect templates. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * @param {number} [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is Array of [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate}. + * + * When autoPaginate: false is specified through options, it contains the result + * in a single response. If the response indicates the next page exists, the third + * parameter is set to be used for the next request object. The fourth parameter keeps + * the raw response object of an object representing [ListInspectTemplatesResponse]{@link google.privacy.dlp.v2.ListInspectTemplatesResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate}. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate} in a single response. + * The second element is the next request object if the response + * indicates the next page exists, or null. The third element is + * an object representing [ListInspectTemplatesResponse]{@link google.privacy.dlp.v2.ListInspectTemplatesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * // Iterate over all elements. + * var formattedParent = client.organizationPath('[ORGANIZATION]'); + * + * client.listInspectTemplates({parent: formattedParent}) + * .then(responses => { + * var resources = responses[0]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]) + * } + * }) + * .catch(err => { + * console.error(err); + * }); + * + * // Or obtain the paged response. + * var formattedParent = client.organizationPath('[ORGANIZATION]'); + * + * + * var options = {autoPaginate: false}; + * var callback = responses => { + * // The actual resources in a response. + * var resources = responses[0]; + * // The next request if the response shows that there are more responses. + * var nextRequest = responses[1]; + * // The actual response object, if necessary. + * // var rawResponse = responses[2]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]); + * } + * if (nextRequest) { + * // Fetch the next page. + * return client.listInspectTemplates(nextRequest, options).then(callback); + * } + * } + * client.listInspectTemplates({parent: formattedParent}, options) + * .then(callback) + * .catch(err => { + * console.error(err); + * }); + */ + listInspectTemplates(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.listInspectTemplates(request, options, callback); + } + + /** + * Equivalent to {@link listInspectTemplates}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listInspectTemplates} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * @param {number} [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @returns {Stream} + * An object stream which emits an object representing [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate} on 'data' event. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedParent = client.organizationPath('[ORGANIZATION]'); + * client.listInspectTemplatesStream({parent: formattedParent}) + * .on('data', element => { + * // doThingsWith(element) + * }).on('error', err => { + * console.log(err); + * }); + */ + listInspectTemplatesStream(request, options) { + options = options || {}; + + return this._descriptors.page.listInspectTemplates.createStream( + this._innerApiCalls.listInspectTemplates, + request, + options + ); + } + + /** + * Deletes inspect templates. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name of the organization and inspectTemplate to be deleted, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error)} [callback] + * The function which will be called with the result of the API call. + * @returns {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedName = client.organizationInspectTemplatePath('[ORGANIZATION]', '[INSPECT_TEMPLATE]'); + * client.deleteInspectTemplate({name: formattedName}).catch(err => { + * console.error(err); + * }); + */ + deleteInspectTemplate(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.deleteInspectTemplate( + request, + options, + callback + ); + } + + /** + * Creates an Deidentify template for re-using frequently used configuration + * for Deidentifying content, images, and storage. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * @param {Object} [request.deidentifyTemplate] + * The DeidentifyTemplate to create. + * + * This object should have the same structure as [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate} + * @param {string} [request.templateId] + * The template 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. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedParent = client.organizationPath('[ORGANIZATION]'); + * client.createDeidentifyTemplate({parent: formattedParent}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + createDeidentifyTemplate(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.createDeidentifyTemplate( + request, + options, + callback + ); + } + + /** + * Updates the inspect template. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name of organization and deidentify template to be updated, for + * example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + * @param {Object} [request.deidentifyTemplate] + * New DeidentifyTemplate value. + * + * This object should have the same structure as [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate} + * @param {Object} [request.updateMask] + * Mask to control which fields get updated. + * + * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedName = client.organizationDeidentifyTemplatePath('[ORGANIZATION]', '[DEIDENTIFY_TEMPLATE]'); + * client.updateDeidentifyTemplate({name: formattedName}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + updateDeidentifyTemplate(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.updateDeidentifyTemplate( + request, + options, + callback + ); + } + + /** + * Gets an inspect template. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name of the organization and deidentify template to be read, for + * example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedName = client.organizationDeidentifyTemplatePath('[ORGANIZATION]', '[DEIDENTIFY_TEMPLATE]'); + * client.getDeidentifyTemplate({name: formattedName}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + getDeidentifyTemplate(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.getDeidentifyTemplate( + request, + options, + callback + ); + } + + /** + * Lists inspect templates. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * @param {number} [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is Array of [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate}. + * + * When autoPaginate: false is specified through options, it contains the result + * in a single response. If the response indicates the next page exists, the third + * parameter is set to be used for the next request object. The fourth parameter keeps + * the raw response object of an object representing [ListDeidentifyTemplatesResponse]{@link google.privacy.dlp.v2.ListDeidentifyTemplatesResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate}. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate} in a single response. + * The second element is the next request object if the response + * indicates the next page exists, or null. The third element is + * an object representing [ListDeidentifyTemplatesResponse]{@link google.privacy.dlp.v2.ListDeidentifyTemplatesResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * // Iterate over all elements. + * var formattedParent = client.organizationPath('[ORGANIZATION]'); + * + * client.listDeidentifyTemplates({parent: formattedParent}) + * .then(responses => { + * var resources = responses[0]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]) + * } + * }) + * .catch(err => { + * console.error(err); + * }); + * + * // Or obtain the paged response. + * var formattedParent = client.organizationPath('[ORGANIZATION]'); + * + * + * var options = {autoPaginate: false}; + * var callback = responses => { + * // The actual resources in a response. + * var resources = responses[0]; + * // The next request if the response shows that there are more responses. + * var nextRequest = responses[1]; + * // The actual response object, if necessary. + * // var rawResponse = responses[2]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]); + * } + * if (nextRequest) { + * // Fetch the next page. + * return client.listDeidentifyTemplates(nextRequest, options).then(callback); + * } + * } + * client.listDeidentifyTemplates({parent: formattedParent}, options) + * .then(callback) + * .catch(err => { + * console.error(err); + * }); + */ + listDeidentifyTemplates(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.listDeidentifyTemplates( + request, + options, + callback + ); + } + + /** + * Equivalent to {@link listDeidentifyTemplates}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listDeidentifyTemplates} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * @param {number} [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @returns {Stream} + * An object stream which emits an object representing [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate} on 'data' event. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedParent = client.organizationPath('[ORGANIZATION]'); + * client.listDeidentifyTemplatesStream({parent: formattedParent}) + * .on('data', element => { + * // doThingsWith(element) + * }).on('error', err => { + * console.log(err); + * }); + */ + listDeidentifyTemplatesStream(request, options) { + options = options || {}; + + return this._descriptors.page.listDeidentifyTemplates.createStream( + this._innerApiCalls.listDeidentifyTemplates, + request, + options + ); + } + + /** + * Deletes inspect templates. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name of the organization and deidentify template to be deleted, + * for example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error)} [callback] + * The function which will be called with the result of the API call. + * @returns {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedName = client.organizationDeidentifyTemplatePath('[ORGANIZATION]', '[DEIDENTIFY_TEMPLATE]'); + * client.deleteDeidentifyTemplate({name: formattedName}).catch(err => { + * console.error(err); + * }); + */ + deleteDeidentifyTemplate(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.deleteDeidentifyTemplate( + request, + options, + callback + ); + } + + /** + * Create a new job to inspect storage or calculate risk metrics [How-to + * guide](https://cloud.google.com/dlp/docs/compute-risk-analysis). + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id. + * @param {Object} [request.inspectJob] + * This object should have the same structure as [InspectJobConfig]{@link google.privacy.dlp.v2.InspectJobConfig} + * @param {Object} [request.riskJob] + * This object should have the same structure as [RiskAnalysisJobConfig]{@link google.privacy.dlp.v2.RiskAnalysisJobConfig} + * @param {string} [request.jobId] + * The job 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. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [DlpJob]{@link google.privacy.dlp.v2.DlpJob}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [DlpJob]{@link google.privacy.dlp.v2.DlpJob}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedParent = client.projectPath('[PROJECT]'); + * client.createDlpJob({parent: formattedParent}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + createDlpJob(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.createDlpJob(request, options, callback); + } + + /** + * Lists DlpJobs that match the specified filter in the request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id. + * @param {string} [request.filter] + * Optional. Allows filtering. + * + * Supported syntax: + * + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of ` `. + * * Supported fields/values for inspect jobs: + * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - `trigger_name` - The resource name of the trigger that created job. + * * Supported fields for risk analysis jobs: + * - `state` - RUNNING|CANCELED|FINISHED|FAILED + * * The operator must be `=` or `!=`. + * + * Examples: + * + * * inspected_storage = cloud_storage AND state = done + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = done OR state = canceled) + * + * The length of this field should be no more than 500 characters. + * @param {number} [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {number} [request.type] + * The type of job. Defaults to `DlpJobType.INSPECT` + * + * The number should be among the values of [DlpJobType]{@link google.privacy.dlp.v2.DlpJobType} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is Array of [DlpJob]{@link google.privacy.dlp.v2.DlpJob}. + * + * When autoPaginate: false is specified through options, it contains the result + * in a single response. If the response indicates the next page exists, the third + * parameter is set to be used for the next request object. The fourth parameter keeps + * the raw response object of an object representing [ListDlpJobsResponse]{@link google.privacy.dlp.v2.ListDlpJobsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [DlpJob]{@link google.privacy.dlp.v2.DlpJob}. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [DlpJob]{@link google.privacy.dlp.v2.DlpJob} in a single response. + * The second element is the next request object if the response + * indicates the next page exists, or null. The third element is + * an object representing [ListDlpJobsResponse]{@link google.privacy.dlp.v2.ListDlpJobsResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * // Iterate over all elements. + * var formattedParent = client.projectPath('[PROJECT]'); + * + * client.listDlpJobs({parent: formattedParent}) + * .then(responses => { + * var resources = responses[0]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]) + * } + * }) + * .catch(err => { + * console.error(err); + * }); + * + * // Or obtain the paged response. + * var formattedParent = client.projectPath('[PROJECT]'); + * + * + * var options = {autoPaginate: false}; + * var callback = responses => { + * // The actual resources in a response. + * var resources = responses[0]; + * // The next request if the response shows that there are more responses. + * var nextRequest = responses[1]; + * // The actual response object, if necessary. + * // var rawResponse = responses[2]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]); + * } + * if (nextRequest) { + * // Fetch the next page. + * return client.listDlpJobs(nextRequest, options).then(callback); + * } + * } + * client.listDlpJobs({parent: formattedParent}, options) + * .then(callback) + * .catch(err => { + * console.error(err); + * }); + */ + listDlpJobs(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.listDlpJobs(request, options, callback); + } + + /** + * Equivalent to {@link listDlpJobs}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listDlpJobs} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id. + * @param {string} [request.filter] + * Optional. Allows filtering. + * + * Supported syntax: + * + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of ` `. + * * Supported fields/values for inspect jobs: + * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - `trigger_name` - The resource name of the trigger that created job. + * * Supported fields for risk analysis jobs: + * - `state` - RUNNING|CANCELED|FINISHED|FAILED + * * The operator must be `=` or `!=`. + * + * Examples: + * + * * inspected_storage = cloud_storage AND state = done + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = done OR state = canceled) + * + * The length of this field should be no more than 500 characters. + * @param {number} [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {number} [request.type] + * The type of job. Defaults to `DlpJobType.INSPECT` + * + * The number should be among the values of [DlpJobType]{@link google.privacy.dlp.v2.DlpJobType} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @returns {Stream} + * An object stream which emits an object representing [DlpJob]{@link google.privacy.dlp.v2.DlpJob} on 'data' event. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedParent = client.projectPath('[PROJECT]'); + * client.listDlpJobsStream({parent: formattedParent}) + * .on('data', element => { + * // doThingsWith(element) + * }).on('error', err => { + * console.log(err); + * }); + */ + listDlpJobsStream(request, options) { + options = options || {}; + + return this._descriptors.page.listDlpJobs.createStream( + this._innerApiCalls.listDlpJobs, + request, + options + ); + } + + /** + * Gets the latest state of a long-running DlpJob. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the DlpJob resource. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [DlpJob]{@link google.privacy.dlp.v2.DlpJob}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [DlpJob]{@link google.privacy.dlp.v2.DlpJob}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedName = client.dlpJobPath('[PROJECT]', '[DLP_JOB]'); + * client.getDlpJob({name: formattedName}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + getDlpJob(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.getDlpJob(request, options, callback); + } + + /** + * Deletes a long-running DlpJob. This method indicates that the client is + * no longer interested in the DlpJob result. The job will be cancelled if + * possible. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the DlpJob resource to be deleted. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error)} [callback] + * The function which will be called with the result of the API call. + * @returns {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedName = client.dlpJobPath('[PROJECT]', '[DLP_JOB]'); + * client.deleteDlpJob({name: formattedName}).catch(err => { + * console.error(err); + * }); + */ + deleteDlpJob(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.deleteDlpJob(request, options, callback); + } + + /** + * Starts asynchronous cancellation on a long-running DlpJob. The server + * makes a best effort to cancel the DlpJob, but success is not + * guaranteed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The name of the DlpJob resource to be cancelled. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error)} [callback] + * The function which will be called with the result of the API call. + * @returns {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedName = client.dlpJobPath('[PROJECT]', '[DLP_JOB]'); + * client.cancelDlpJob({name: formattedName}).catch(err => { + * console.error(err); + * }); + */ + cancelDlpJob(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.cancelDlpJob(request, options, callback); + } + + /** + * Lists job triggers. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id. + * @param {number} [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {string} [request.orderBy] + * Optional comma separated list of triggeredJob fields to order by, + * followed by 'asc/desc' postfix, i.e. + * `"create_time asc,name desc,schedule_mode asc"`. This list is + * case-insensitive. + * + * Example: `"name asc,schedule_mode desc, status desc"` + * + * Supported filters keys and values are: + * + * - `create_time`: corresponds to time the triggeredJob was created. + * - `update_time`: corresponds to time the triggeredJob was last updated. + * - `name`: corresponds to JobTrigger's display name. + * - `status`: corresponds to the triggeredJob status. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Array, ?Object, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is Array of [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger}. + * + * When autoPaginate: false is specified through options, it contains the result + * in a single response. If the response indicates the next page exists, the third + * parameter is set to be used for the next request object. The fourth parameter keeps + * the raw response object of an object representing [ListJobTriggersResponse]{@link google.privacy.dlp.v2.ListJobTriggersResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger}. + * + * When autoPaginate: false is specified through options, the array has three elements. + * The first element is Array of [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger} in a single response. + * The second element is the next request object if the response + * indicates the next page exists, or null. The third element is + * an object representing [ListJobTriggersResponse]{@link google.privacy.dlp.v2.ListJobTriggersResponse}. + * + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * // Iterate over all elements. + * var formattedParent = client.projectPath('[PROJECT]'); + * + * client.listJobTriggers({parent: formattedParent}) + * .then(responses => { + * var resources = responses[0]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]) + * } + * }) + * .catch(err => { + * console.error(err); + * }); + * + * // Or obtain the paged response. + * var formattedParent = client.projectPath('[PROJECT]'); + * + * + * var options = {autoPaginate: false}; + * var callback = responses => { + * // The actual resources in a response. + * var resources = responses[0]; + * // The next request if the response shows that there are more responses. + * var nextRequest = responses[1]; + * // The actual response object, if necessary. + * // var rawResponse = responses[2]; + * for (let i = 0; i < resources.length; i += 1) { + * // doThingsWith(resources[i]); + * } + * if (nextRequest) { + * // Fetch the next page. + * return client.listJobTriggers(nextRequest, options).then(callback); + * } + * } + * client.listJobTriggers({parent: formattedParent}, options) + * .then(callback) + * .catch(err => { + * console.error(err); + * }); + */ + listJobTriggers(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.listJobTriggers(request, options, callback); + } + + /** + * Equivalent to {@link listJobTriggers}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listJobTriggers} continuously + * and invokes the callback registered for 'data' event for each element in the + * responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id. + * @param {number} [request.pageSize] + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {string} [request.orderBy] + * Optional comma separated list of triggeredJob fields to order by, + * followed by 'asc/desc' postfix, i.e. + * `"create_time asc,name desc,schedule_mode asc"`. This list is + * case-insensitive. + * + * Example: `"name asc,schedule_mode desc, status desc"` + * + * Supported filters keys and values are: + * + * - `create_time`: corresponds to time the triggeredJob was created. + * - `update_time`: corresponds to time the triggeredJob was last updated. + * - `name`: corresponds to JobTrigger's display name. + * - `status`: corresponds to the triggeredJob status. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @returns {Stream} + * An object stream which emits an object representing [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger} on 'data' event. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedParent = client.projectPath('[PROJECT]'); + * client.listJobTriggersStream({parent: formattedParent}) + * .on('data', element => { + * // doThingsWith(element) + * }).on('error', err => { + * console.log(err); + * }); + */ + listJobTriggersStream(request, options) { + options = options || {}; + + return this._descriptors.page.listJobTriggers.createStream( + this._innerApiCalls.listJobTriggers, + request, + options + ); + } + + /** + * Gets a job trigger. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name of the project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedName = client.projectJobTriggerPath('[PROJECT]', '[JOB_TRIGGER]'); + * client.getJobTrigger({name: formattedName}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + getJobTrigger(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.getJobTrigger(request, options, callback); + } + + /** + * Deletes a job trigger. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name of the project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error)} [callback] + * The function which will be called with the result of the API call. + * @returns {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var name = ''; + * client.deleteJobTrigger({name: name}).catch(err => { + * console.error(err); + * }); + */ + deleteJobTrigger(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.deleteJobTrigger(request, options, callback); + } + + /** + * Updates a job trigger. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name of the project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + * @param {Object} [request.jobTrigger] + * New JobTrigger value. + * + * This object should have the same structure as [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger} + * @param {Object} [request.updateMask] + * Mask to control which fields get updated. + * + * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedName = client.projectJobTriggerPath('[PROJECT]', '[JOB_TRIGGER]'); + * client.updateJobTrigger({name: formattedName}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + updateJobTrigger(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.updateJobTrigger(request, options, callback); + } + + /** + * Creates a job to run DLP actions such as scanning storage for sensitive + * information on a set schedule. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * The parent resource name, for example projects/my-project-id. + * @param {Object} [request.jobTrigger] + * The JobTrigger to create. + * + * This object should have the same structure as [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger} + * @param {string} [request.triggerId] + * The trigger 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. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * + * const dlp = require('@google-cloud/dlp'); + * + * var client = new dlp.v2.DlpServiceClient({ + * // optional auth parameters. + * }); + * + * var formattedParent = client.projectPath('[PROJECT]'); + * client.createJobTrigger({parent: formattedParent}) + * .then(responses => { + * var response = responses[0]; + * // doThingsWith(response) + * }) + * .catch(err => { + * console.error(err); + * }); + */ + createJobTrigger(request, options, callback) { + if (options instanceof Function && callback === undefined) { + callback = options; + options = {}; + } + options = options || {}; + + return this._innerApiCalls.createJobTrigger(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified organization resource name string. + * + * @param {String} organization + * @returns {String} + */ + organizationPath(organization) { + return this._pathTemplates.organizationPathTemplate.render({ + organization: organization, + }); + } + + /** + * Return a fully-qualified organization_deidentify_template resource name string. + * + * @param {String} organization + * @param {String} deidentifyTemplate + * @returns {String} + */ + organizationDeidentifyTemplatePath(organization, deidentifyTemplate) { + return this._pathTemplates.organizationDeidentifyTemplatePathTemplate.render( + { + organization: organization, + deidentify_template: deidentifyTemplate, + } + ); + } + + /** + * Return a fully-qualified project_deidentify_template resource name string. + * + * @param {String} project + * @param {String} deidentifyTemplate + * @returns {String} + */ + projectDeidentifyTemplatePath(project, deidentifyTemplate) { + return this._pathTemplates.projectDeidentifyTemplatePathTemplate.render({ + project: project, + deidentify_template: deidentifyTemplate, + }); + } + + /** + * Return a fully-qualified organization_inspect_template resource name string. + * + * @param {String} organization + * @param {String} inspectTemplate + * @returns {String} + */ + organizationInspectTemplatePath(organization, inspectTemplate) { + return this._pathTemplates.organizationInspectTemplatePathTemplate.render({ + organization: organization, + inspect_template: inspectTemplate, + }); + } + + /** + * Return a fully-qualified project_inspect_template resource name string. + * + * @param {String} project + * @param {String} inspectTemplate + * @returns {String} + */ + projectInspectTemplatePath(project, inspectTemplate) { + return this._pathTemplates.projectInspectTemplatePathTemplate.render({ + project: project, + inspect_template: inspectTemplate, + }); + } + + /** + * Return a fully-qualified project_job_trigger resource name string. + * + * @param {String} project + * @param {String} jobTrigger + * @returns {String} + */ + projectJobTriggerPath(project, jobTrigger) { + return this._pathTemplates.projectJobTriggerPathTemplate.render({ + project: project, + job_trigger: jobTrigger, + }); + } + + /** + * Return a fully-qualified project resource name string. + * + * @param {String} project + * @returns {String} + */ + projectPath(project) { + return this._pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Return a fully-qualified dlp_job resource name string. + * + * @param {String} project + * @param {String} dlpJob + * @returns {String} + */ + dlpJobPath(project, dlpJob) { + return this._pathTemplates.dlpJobPathTemplate.render({ + project: project, + dlp_job: dlpJob, + }); + } + + /** + * Parse the organizationName from a organization resource. + * + * @param {String} organizationName + * A fully-qualified path representing a organization resources. + * @returns {String} - A string representing the organization. + */ + matchOrganizationFromOrganizationName(organizationName) { + return this._pathTemplates.organizationPathTemplate.match(organizationName) + .organization; + } + + /** + * Parse the organizationDeidentifyTemplateName from a organization_deidentify_template resource. + * + * @param {String} organizationDeidentifyTemplateName + * A fully-qualified path representing a organization_deidentify_template resources. + * @returns {String} - A string representing the organization. + */ + matchOrganizationFromOrganizationDeidentifyTemplateName( + organizationDeidentifyTemplateName + ) { + return this._pathTemplates.organizationDeidentifyTemplatePathTemplate.match( + organizationDeidentifyTemplateName + ).organization; + } + + /** + * Parse the organizationDeidentifyTemplateName from a organization_deidentify_template resource. + * + * @param {String} organizationDeidentifyTemplateName + * A fully-qualified path representing a organization_deidentify_template resources. + * @returns {String} - A string representing the deidentify_template. + */ + matchDeidentifyTemplateFromOrganizationDeidentifyTemplateName( + organizationDeidentifyTemplateName + ) { + return this._pathTemplates.organizationDeidentifyTemplatePathTemplate.match( + organizationDeidentifyTemplateName + ).deidentify_template; + } + + /** + * Parse the projectDeidentifyTemplateName from a project_deidentify_template resource. + * + * @param {String} projectDeidentifyTemplateName + * A fully-qualified path representing a project_deidentify_template resources. + * @returns {String} - A string representing the project. + */ + matchProjectFromProjectDeidentifyTemplateName(projectDeidentifyTemplateName) { + return this._pathTemplates.projectDeidentifyTemplatePathTemplate.match( + projectDeidentifyTemplateName + ).project; + } + + /** + * Parse the projectDeidentifyTemplateName from a project_deidentify_template resource. + * + * @param {String} projectDeidentifyTemplateName + * A fully-qualified path representing a project_deidentify_template resources. + * @returns {String} - A string representing the deidentify_template. + */ + matchDeidentifyTemplateFromProjectDeidentifyTemplateName( + projectDeidentifyTemplateName + ) { + return this._pathTemplates.projectDeidentifyTemplatePathTemplate.match( + projectDeidentifyTemplateName + ).deidentify_template; + } + + /** + * Parse the organizationInspectTemplateName from a organization_inspect_template resource. + * + * @param {String} organizationInspectTemplateName + * A fully-qualified path representing a organization_inspect_template resources. + * @returns {String} - A string representing the organization. + */ + matchOrganizationFromOrganizationInspectTemplateName( + organizationInspectTemplateName + ) { + return this._pathTemplates.organizationInspectTemplatePathTemplate.match( + organizationInspectTemplateName + ).organization; + } + + /** + * Parse the organizationInspectTemplateName from a organization_inspect_template resource. + * + * @param {String} organizationInspectTemplateName + * A fully-qualified path representing a organization_inspect_template resources. + * @returns {String} - A string representing the inspect_template. + */ + matchInspectTemplateFromOrganizationInspectTemplateName( + organizationInspectTemplateName + ) { + return this._pathTemplates.organizationInspectTemplatePathTemplate.match( + organizationInspectTemplateName + ).inspect_template; + } + + /** + * Parse the projectInspectTemplateName from a project_inspect_template resource. + * + * @param {String} projectInspectTemplateName + * A fully-qualified path representing a project_inspect_template resources. + * @returns {String} - A string representing the project. + */ + matchProjectFromProjectInspectTemplateName(projectInspectTemplateName) { + return this._pathTemplates.projectInspectTemplatePathTemplate.match( + projectInspectTemplateName + ).project; + } + + /** + * Parse the projectInspectTemplateName from a project_inspect_template resource. + * + * @param {String} projectInspectTemplateName + * A fully-qualified path representing a project_inspect_template resources. + * @returns {String} - A string representing the inspect_template. + */ + matchInspectTemplateFromProjectInspectTemplateName( + projectInspectTemplateName + ) { + return this._pathTemplates.projectInspectTemplatePathTemplate.match( + projectInspectTemplateName + ).inspect_template; + } + + /** + * Parse the projectJobTriggerName from a project_job_trigger resource. + * + * @param {String} projectJobTriggerName + * A fully-qualified path representing a project_job_trigger resources. + * @returns {String} - A string representing the project. + */ + matchProjectFromProjectJobTriggerName(projectJobTriggerName) { + return this._pathTemplates.projectJobTriggerPathTemplate.match( + projectJobTriggerName + ).project; + } + + /** + * Parse the projectJobTriggerName from a project_job_trigger resource. + * + * @param {String} projectJobTriggerName + * A fully-qualified path representing a project_job_trigger resources. + * @returns {String} - A string representing the job_trigger. + */ + matchJobTriggerFromProjectJobTriggerName(projectJobTriggerName) { + return this._pathTemplates.projectJobTriggerPathTemplate.match( + projectJobTriggerName + ).job_trigger; + } + + /** + * Parse the projectName from a project resource. + * + * @param {String} projectName + * A fully-qualified path representing a project resources. + * @returns {String} - A string representing the project. + */ + matchProjectFromProjectName(projectName) { + return this._pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Parse the dlpJobName from a dlp_job resource. + * + * @param {String} dlpJobName + * A fully-qualified path representing a dlp_job resources. + * @returns {String} - A string representing the project. + */ + matchProjectFromDlpJobName(dlpJobName) { + return this._pathTemplates.dlpJobPathTemplate.match(dlpJobName).project; + } + + /** + * Parse the dlpJobName from a dlp_job resource. + * + * @param {String} dlpJobName + * A fully-qualified path representing a dlp_job resources. + * @returns {String} - A string representing the dlp_job. + */ + matchDlpJobFromDlpJobName(dlpJobName) { + return this._pathTemplates.dlpJobPathTemplate.match(dlpJobName).dlp_job; + } +} + +module.exports = DlpServiceClient; diff --git a/packages/google-privacy-dlp/src/v2/dlp_service_client_config.json b/packages/google-privacy-dlp/src/v2/dlp_service_client_config.json new file mode 100644 index 00000000000..d6bfad74981 --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/dlp_service_client_config.json @@ -0,0 +1,151 @@ +{ + "interfaces": { + "google.privacy.dlp.v2.DlpService": { + "retry_codes": { + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "non_idempotent": [] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 20000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 20000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "InspectContent": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "RedactImage": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeidentifyContent": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ReidentifyContent": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListInfoTypes": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateInspectTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateInspectTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetInspectTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListInspectTemplates": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteInspectTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateDeidentifyTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateDeidentifyTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetDeidentifyTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "ListDeidentifyTemplates": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteDeidentifyTemplate": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CreateDlpJob": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListDlpJobs": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetDlpJob": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteDlpJob": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "CancelDlpJob": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListJobTriggers": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "GetJobTrigger": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "DeleteJobTrigger": { + "timeout_millis": 300000, + "retry_codes_name": "idempotent", + "retry_params_name": "default" + }, + "UpdateJobTrigger": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateJobTrigger": { + "timeout_millis": 300000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} 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 new file mode 100644 index 00000000000..ed960d18813 --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/doc/google/privacy/dlp/v2/doc_dlp.js @@ -0,0 +1,3605 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * Configuration description of the scanning process. + * When used with redactContent only info_types and min_likelihood are currently + * used. + * + * @property {Object[]} infoTypes + * Restricts what info_types to look for. The values must correspond to + * InfoType values returned by ListInfoTypes or found in documentation. + * Empty info_types runs all enabled detectors. + * + * This object should have the same structure as [InfoType]{@link google.privacy.dlp.v2.InfoType} + * + * @property {number} minLikelihood + * Only returns findings equal or above this threshold. The default is + * POSSIBLE. + * + * The number should be among the values of [Likelihood]{@link google.privacy.dlp.v2.Likelihood} + * + * @property {Object} limits + * This object should have the same structure as [FindingLimits]{@link google.privacy.dlp.v2.FindingLimits} + * + * @property {boolean} includeQuote + * When true, a contextual quote from the data that triggered a finding is + * included in the response; see Finding.quote. + * + * @property {boolean} excludeInfoTypes + * When true, excludes type information of the findings. + * + * @property {Object[]} customInfoTypes + * Custom infoTypes provided by the user. + * + * This object should have the same structure as [CustomInfoType]{@link google.privacy.dlp.v2.CustomInfoType} + * + * @property {number[]} contentOptions + * List of options defining data content to scan. + * If empty, text, images, and other content will be included. + * + * The number should be among the values of [ContentOption]{@link google.privacy.dlp.v2.ContentOption} + * + * @typedef InspectConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InspectConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var InspectConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * @property {number} maxFindingsPerItem + * Max number of findings that will be returned for each item scanned. + * When set within `InspectDataSourceRequest`, + * the maximum returned is 1000 regardless if this is set higher. + * When set within `InspectContentRequest`, this field is ignored. + * + * @property {number} maxFindingsPerRequest + * Max number of findings that will be returned per request/job. + * When set within `InspectContentRequest`, the maximum returned is 1000 + * regardless if this is set higher. + * + * @property {Object[]} maxFindingsPerInfoType + * Configuration of findings limit given for specified infoTypes. + * + * This object should have the same structure as [InfoTypeLimit]{@link google.privacy.dlp.v2.InfoTypeLimit} + * + * @typedef FindingLimits + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InspectConfig.FindingLimits definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + FindingLimits: { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * Max findings configuration per infoType, per content item or long + * running DlpJob. + * + * @property {Object} infoType + * Type of information the findings limit applies to. Only one limit per + * info_type should be provided. If InfoTypeLimit does not have an + * info_type, the DLP API applies the limit against all info_types that + * are found but not specified in another InfoTypeLimit. + * + * This object should have the same structure as [InfoType]{@link google.privacy.dlp.v2.InfoType} + * + * @property {number} maxFindings + * Max findings limit for the given infoType. + * + * @typedef InfoTypeLimit + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InspectConfig.FindingLimits.InfoTypeLimit definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + InfoTypeLimit: { + // This is for documentation. Actual contents will be loaded by gRPC. + } + } +}; + +/** + * Container for bytes to inspect or redact. + * + * @property {number} type + * The type of data stored in the bytes string. Default will be TEXT_UTF8. + * + * The number should be among the values of [BytesType]{@link google.privacy.dlp.v2.BytesType} + * + * @property {string} data + * Content data to inspect or redact. + * + * @typedef ByteContentItem + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ByteContentItem definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ByteContentItem = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ + BytesType: { + BYTES_TYPE_UNSPECIFIED: 0, + IMAGE_JPEG: 1, + IMAGE_BMP: 2, + IMAGE_PNG: 3, + IMAGE_SVG: 4, + TEXT_UTF8: 5 + } +}; + +/** + * Container structure for the content to inspect. + * + * @property {string} value + * String data to inspect or redact. + * + * @property {Object} table + * Structured content for inspection. + * + * This object should have the same structure as [Table]{@link google.privacy.dlp.v2.Table} + * + * @property {Object} byteItem + * Content data to inspect or redact. Replaces `type` and `data`. + * + * This object should have the same structure as [ByteContentItem]{@link google.privacy.dlp.v2.ByteContentItem} + * + * @typedef ContentItem + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ContentItem definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ContentItem = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Structured content to inspect. Up to 50,000 `Value`s per request allowed. + * + * @property {Object[]} headers + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @property {Object[]} rows + * This object should have the same structure as [Row]{@link google.privacy.dlp.v2.Row} + * + * @typedef Table + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Table definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var Table = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * @property {Object[]} values + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @typedef Row + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Table.Row definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + Row: { + // This is for documentation. Actual contents will be loaded by gRPC. + } +}; + +/** + * All the findings for a single scanned item. + * + * @property {Object[]} findings + * List of findings for an item. + * + * This object should have the same structure as [Finding]{@link google.privacy.dlp.v2.Finding} + * + * @property {boolean} findingsTruncated + * If true, then this item might have more findings than were returned, + * and the findings returned are an arbitrary subset of all findings. + * The findings list might be truncated because the input items were too + * large, or because the server reached the maximum amount of resources + * allowed for a single API call. For best results, divide the input into + * smaller batches. + * + * @typedef InspectResult + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InspectResult definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var InspectResult = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Represents a piece of potentially sensitive content. + * + * @property {string} quote + * The content that was found. Even if the content is not textual, it + * may be converted to a textual representation here. + * Provided if requested by the `InspectConfig` and the finding is + * less than or equal to 4096 bytes long. If the finding exceeds 4096 bytes + * in length, the quote may be omitted. + * + * @property {Object} infoType + * The type of content that might have been found. + * Provided if requested by the `InspectConfig`. + * + * This object should have the same structure as [InfoType]{@link google.privacy.dlp.v2.InfoType} + * + * @property {number} likelihood + * Estimate of how likely it is that the `info_type` is correct. + * + * The number should be among the values of [Likelihood]{@link google.privacy.dlp.v2.Likelihood} + * + * @property {Object} location + * Where the content was found. + * + * This object should have the same structure as [Location]{@link google.privacy.dlp.v2.Location} + * + * @property {Object} createTime + * Timestamp when finding was detected. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {Object} quoteInfo + * Contains data parsed from quotes. Only populated if include_quote was set + * to true and a supported infoType was requested. Currently supported + * infoTypes: DATE, DATE_OF_BIRTH and TIME. + * + * This object should have the same structure as [QuoteInfo]{@link google.privacy.dlp.v2.QuoteInfo} + * + * @typedef Finding + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Finding definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var Finding = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Specifies the location of the finding. + * + * @property {Object} byteRange + * Zero-based byte offsets delimiting the finding. + * These are relative to the finding's containing element. + * Note that when the content is not textual, this references + * the UTF-8 encoded textual representation of the content. + * Omitted if content is an image. + * + * This object should have the same structure as [Range]{@link google.privacy.dlp.v2.Range} + * + * @property {Object} codepointRange + * Unicode character offsets delimiting the finding. + * These are relative to the finding's containing element. + * Provided when the content is text. + * + * This object should have the same structure as [Range]{@link google.privacy.dlp.v2.Range} + * + * @property {Object[]} contentLocations + * List of nested objects pointing to the precise location of the finding + * within the file or record. + * + * This object should have the same structure as [ContentLocation]{@link google.privacy.dlp.v2.ContentLocation} + * + * @typedef Location + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Location definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var Location = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Findings container location data. + * + * @property {string} containerName + * Name of the container where the finding is located. + * The top level name is the source file name or table name. Nested names + * could be absent if the embedded object has no string identifier + * (for an example an image contained within a document). + * + * @property {Object} recordLocation + * Location within a row or record of a database table. + * + * This object should have the same structure as [RecordLocation]{@link google.privacy.dlp.v2.RecordLocation} + * + * @property {Object} imageLocation + * Location within an image's pixels. + * + * This object should have the same structure as [ImageLocation]{@link google.privacy.dlp.v2.ImageLocation} + * + * @property {Object} documentLocation + * Location data for document files. + * + * This object should have the same structure as [DocumentLocation]{@link google.privacy.dlp.v2.DocumentLocation} + * + * @property {Object} containerTimestamp + * Findings container modification timestamp, if applicable. + * For Google Cloud Storage contains last file modification timestamp. + * For BigQuery table contains last_modified_time property. + * For Datastore - not populated. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {string} containerVersion + * Findings container version, if available + * ("generation" for Google Cloud Storage). + * + * @typedef ContentLocation + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ContentLocation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ContentLocation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Location of a finding within a document. + * + * @property {number} fileOffset + * Offset of the line, from the beginning of the file, where the finding + * is located. + * + * @typedef DocumentLocation + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DocumentLocation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DocumentLocation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Location of a finding within a row or record. + * + * @property {Object} recordKey + * Key of the finding. + * + * This object should have the same structure as [RecordKey]{@link google.privacy.dlp.v2.RecordKey} + * + * @property {Object} fieldId + * Field id of the field containing the finding. + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @property {Object} tableLocation + * Location within a `ContentItem.Table`. + * + * This object should have the same structure as [TableLocation]{@link google.privacy.dlp.v2.TableLocation} + * + * @typedef RecordLocation + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RecordLocation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var RecordLocation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Location of a finding within a table. + * + * @property {number} rowIndex + * The zero-based index of the row where the finding is located. + * + * @typedef TableLocation + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.TableLocation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var TableLocation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Generic half-open interval [start, end) + * + * @property {number} start + * Index of the first character of the range (inclusive). + * + * @property {number} end + * Index of the last character of the range (exclusive). + * + * @typedef Range + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Range definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var Range = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Location of the finding within an image. + * + * @property {Object[]} boundingBoxes + * Bounding boxes locating the pixels within the image containing the finding. + * + * This object should have the same structure as [BoundingBox]{@link google.privacy.dlp.v2.BoundingBox} + * + * @typedef ImageLocation + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ImageLocation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ImageLocation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Bounding box encompassing detected text within an image. + * + * @property {number} top + * Top coordinate of the bounding box. (0,0) is upper left. + * + * @property {number} left + * Left coordinate of the bounding box. (0,0) is upper left. + * + * @property {number} width + * Width of the bounding box in pixels. + * + * @property {number} height + * Height of the bounding box in pixels. + * + * @typedef BoundingBox + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.BoundingBox definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var BoundingBox = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request to search for potentially sensitive info in a list of items + * and replace it with a default or provided content. + * + * @property {string} parent + * The parent resource name, for example projects/my-project-id. + * + * @property {Object} inspectConfig + * Configuration for the inspector. + * + * This object should have the same structure as [InspectConfig]{@link google.privacy.dlp.v2.InspectConfig} + * + * @property {Object[]} imageRedactionConfigs + * The configuration for specifying what content to redact from images. + * + * This object should have the same structure as [ImageRedactionConfig]{@link google.privacy.dlp.v2.ImageRedactionConfig} + * + * @property {Object} byteItem + * The content must be PNG, JPEG, SVG or BMP. + * + * This object should have the same structure as [ByteContentItem]{@link google.privacy.dlp.v2.ByteContentItem} + * + * @typedef RedactImageRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RedactImageRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var RedactImageRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * Configuration for determining how redaction of images should occur. + * + * @property {Object} infoType + * Only one per info_type should be provided per request. If not + * specified, and redact_all_text is false, the DLP API will redact all + * text that it matches against all info_types that are found, but not + * specified in another ImageRedactionConfig. + * + * This object should have the same structure as [InfoType]{@link google.privacy.dlp.v2.InfoType} + * + * @property {boolean} redactAllText + * If true, all text found in the image, regardless whether it matches an + * info_type, is redacted. + * + * @property {Object} redactionColor + * The color to use when redacting content from an image. If not specified, + * the default is black. + * + * This object should have the same structure as [Color]{@link google.privacy.dlp.v2.Color} + * + * @typedef ImageRedactionConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RedactImageRequest.ImageRedactionConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + ImageRedactionConfig: { + // This is for documentation. Actual contents will be loaded by gRPC. + } +}; + +/** + * Represents a color in the RGB color space. + * + * @property {number} red + * The amount of red in the color as a value in the interval [0, 1]. + * + * @property {number} green + * The amount of green in the color as a value in the interval [0, 1]. + * + * @property {number} blue + * The amount of blue in the color as a value in the interval [0, 1]. + * + * @typedef Color + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Color definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var Color = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Results of redacting an image. + * + * @property {string} redactedImage + * The redacted image. The type will be the same as the original image. + * + * @property {string} extractedText + * If an image was being inspected and the InspectConfig's include_quote was + * set to true, then this field will include all text, if any, that was found + * in the image. + * + * @typedef RedactImageResponse + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RedactImageResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var RedactImageResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request to de-identify a list of items. + * + * @property {string} parent + * The parent resource name, for example projects/my-project-id. + * + * @property {Object} deidentifyConfig + * Configuration for the de-identification of the content item. + * Items specified here will override the template referenced by the + * deidentify_template_name argument. + * + * This object should have the same structure as [DeidentifyConfig]{@link google.privacy.dlp.v2.DeidentifyConfig} + * + * @property {Object} inspectConfig + * Configuration for the inspector. + * Items specified here will override the template referenced by the + * inspect_template_name argument. + * + * This object should have the same structure as [InspectConfig]{@link google.privacy.dlp.v2.InspectConfig} + * + * @property {Object} item + * The item to de-identify. Will be treated as text. + * + * This object should have the same structure as [ContentItem]{@link google.privacy.dlp.v2.ContentItem} + * + * @property {string} inspectTemplateName + * Optional template to use. Any configuration directly specified in + * inspect_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * + * @property {string} deidentifyTemplateName + * Optional template to use. Any configuration directly specified in + * deidentify_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * + * @typedef DeidentifyContentRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DeidentifyContentRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DeidentifyContentRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Results of de-identifying a ContentItem. + * + * @property {Object} item + * The de-identified item. + * + * This object should have the same structure as [ContentItem]{@link google.privacy.dlp.v2.ContentItem} + * + * @property {Object} overview + * An overview of the changes that were made on the `item`. + * + * This object should have the same structure as [TransformationOverview]{@link google.privacy.dlp.v2.TransformationOverview} + * + * @typedef DeidentifyContentResponse + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DeidentifyContentResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DeidentifyContentResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request to re-identify an item. + * + * @property {string} parent + * The parent resource name. + * + * @property {Object} reidentifyConfig + * Configuration for the re-identification of the content item. + * This field shares the same proto message type that is used for + * de-identification, however its usage here is for the reversal of the + * previous de-identification. Re-identification is performed by examining + * the transformations used to de-identify the items and executing the + * reverse. This requires that only reversible transformations + * be provided here. The reversible transformations are: + * + * - `CryptoReplaceFfxFpeConfig` + * + * This object should have the same structure as [DeidentifyConfig]{@link google.privacy.dlp.v2.DeidentifyConfig} + * + * @property {Object} inspectConfig + * Configuration for the inspector. + * + * This object should have the same structure as [InspectConfig]{@link google.privacy.dlp.v2.InspectConfig} + * + * @property {Object} item + * The item to re-identify. Will be treated as text. + * + * This object should have the same structure as [ContentItem]{@link google.privacy.dlp.v2.ContentItem} + * + * @property {string} inspectTemplateName + * Optional template to use. Any configuration directly specified in + * `inspect_config` will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * + * @property {string} reidentifyTemplateName + * Optional template to use. References an instance of `DeidentifyTemplate`. + * Any configuration directly specified in `reidentify_config` or + * `inspect_config` will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * + * @typedef ReidentifyContentRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ReidentifyContentRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ReidentifyContentRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Results of re-identifying a item. + * + * @property {Object} item + * The re-identified item. + * + * This object should have the same structure as [ContentItem]{@link google.privacy.dlp.v2.ContentItem} + * + * @property {Object} overview + * An overview of the changes that were made to the `item`. + * + * This object should have the same structure as [TransformationOverview]{@link google.privacy.dlp.v2.TransformationOverview} + * + * @typedef ReidentifyContentResponse + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ReidentifyContentResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ReidentifyContentResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request to search for potentially sensitive info in a ContentItem. + * + * @property {string} parent + * The parent resource name, for example projects/my-project-id. + * + * @property {Object} inspectConfig + * Configuration for the inspector. What specified here will override + * the template referenced by the inspect_template_name argument. + * + * This object should have the same structure as [InspectConfig]{@link google.privacy.dlp.v2.InspectConfig} + * + * @property {Object} item + * The item to inspect. + * + * This object should have the same structure as [ContentItem]{@link google.privacy.dlp.v2.ContentItem} + * + * @property {string} inspectTemplateName + * Optional template to use. Any configuration directly specified in + * inspect_config will override those set in the template. Singular fields + * that are set in this request will replace their corresponding fields in the + * template. Repeated fields are appended. Singular sub-messages and groups + * are recursively merged. + * + * @typedef InspectContentRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InspectContentRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var InspectContentRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Results of inspecting an item. + * + * @property {Object} result + * The findings. + * + * This object should have the same structure as [InspectResult]{@link google.privacy.dlp.v2.InspectResult} + * + * @typedef InspectContentResponse + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InspectContentResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var InspectContentResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Cloud repository for storing output. + * + * @property {Object} table + * Store findings in an existing table or a new table in an existing + * dataset. Each column in an existing table must have the same name, type, + * and mode of a field in the `Finding` object. If table_id is not set a new + * one will be generated for you with the following format: + * dlp_googleapis_yyyy_mm_dd_[dlp_job_id]. Pacific timezone will be used for + * generating the date details. + * + * This object should have the same structure as [BigQueryTable]{@link google.privacy.dlp.v2.BigQueryTable} + * + * @property {number} outputSchema + * Schema used for writing the findings. Columns are derived from the + * `Finding` object. If appending to an existing table, any columns from the + * predefined schema that are missing will be added. No columns in the + * existing table will be deleted. + * + * If unspecified, then all available columns will be used for a new table, + * and no changes will be made to an existing table. + * + * The number should be among the values of [OutputSchema]{@link google.privacy.dlp.v2.OutputSchema} + * + * @typedef OutputStorageConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.OutputStorageConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var OutputStorageConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * Predefined schemas for storing findings. + * + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ + OutputSchema: { + OUTPUT_SCHEMA_UNSPECIFIED: 0, + + /** + * Basic schema including only `info_type`, `quote`, `certainty`, and + * `timestamp`. + */ + BASIC_COLUMNS: 1, + + /** + * Schema tailored to findings from scanning Google Cloud Storage. + */ + GCS_COLUMNS: 2, + + /** + * Schema tailored to findings from scanning Google Datastore. + */ + DATASTORE_COLUMNS: 3, + + /** + * Schema tailored to findings from scanning Google BigQuery. + */ + BIG_QUERY_COLUMNS: 4, + + /** + * Schema containing all columns. + */ + ALL_COLUMNS: 5 + } +}; + +/** + * Statistics regarding a specific InfoType. + * + * @property {Object} infoType + * The type of finding this stat is for. + * + * This object should have the same structure as [InfoType]{@link google.privacy.dlp.v2.InfoType} + * + * @property {number} count + * Number of findings for this infoType. + * + * @typedef InfoTypeStats + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InfoTypeStats definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var InfoTypeStats = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The results of an inspect DataSource job. + * + * @property {Object} requestedOptions + * The configuration used for this job. + * + * This object should have the same structure as [RequestedOptions]{@link google.privacy.dlp.v2.RequestedOptions} + * + * @property {Object} result + * A summary of the outcome of this inspect job. + * + * This object should have the same structure as [Result]{@link google.privacy.dlp.v2.Result} + * + * @typedef InspectDataSourceDetails + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InspectDataSourceDetails definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var InspectDataSourceDetails = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * @property {Object} snapshotInspectTemplate + * If run with an inspect template, a snapshot of it's state at the time of + * this run. + * + * This object should have the same structure as [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate} + * + * @property {Object} jobConfig + * This object should have the same structure as [InspectJobConfig]{@link google.privacy.dlp.v2.InspectJobConfig} + * + * @typedef RequestedOptions + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InspectDataSourceDetails.RequestedOptions definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + RequestedOptions: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * @property {number} processedBytes + * Total size in bytes that were processed. + * + * @property {number} totalEstimatedBytes + * Estimate of the number of bytes to process. + * + * @property {Object[]} infoTypeStats + * Statistics of how many instances of each info type were found during + * inspect job. + * + * This object should have the same structure as [InfoTypeStats]{@link google.privacy.dlp.v2.InfoTypeStats} + * + * @typedef Result + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InspectDataSourceDetails.Result definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + Result: { + // This is for documentation. Actual contents will be loaded by gRPC. + } +}; + +/** + * InfoType description. + * + * @property {string} name + * Internal name of the infoType. + * + * @property {string} displayName + * Human readable form of the infoType name. + * + * @property {number[]} supportedBy + * Which parts of the API supports this InfoType. + * + * The number should be among the values of [InfoTypeSupportedBy]{@link google.privacy.dlp.v2.InfoTypeSupportedBy} + * + * @typedef InfoTypeDescription + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InfoTypeDescription definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var InfoTypeDescription = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request for the list of infoTypes. + * + * @property {string} languageCode + * Optional BCP-47 language code for localized infoType friendly + * names. If omitted, or if localized strings are not available, + * en-US strings will be returned. + * + * @property {string} filter + * Optional filter to only return infoTypes supported by certain parts of the + * API. Defaults to supported_by=INSPECT. + * + * @typedef ListInfoTypesRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ListInfoTypesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ListInfoTypesRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Response to the ListInfoTypes request. + * + * @property {Object[]} infoTypes + * Set of sensitive infoTypes. + * + * This object should have the same structure as [InfoTypeDescription]{@link google.privacy.dlp.v2.InfoTypeDescription} + * + * @typedef ListInfoTypesResponse + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ListInfoTypesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ListInfoTypesResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Configuration for a risk analysis job. + * + * @property {Object} privacyMetric + * Privacy metric to compute. + * + * This object should have the same structure as [PrivacyMetric]{@link google.privacy.dlp.v2.PrivacyMetric} + * + * @property {Object} sourceTable + * Input dataset to compute metrics over. + * + * This object should have the same structure as [BigQueryTable]{@link google.privacy.dlp.v2.BigQueryTable} + * + * @property {Object[]} actions + * Actions to execute at the completion of the job. Are executed in the order + * provided. + * + * This object should have the same structure as [Action]{@link google.privacy.dlp.v2.Action} + * + * @typedef RiskAnalysisJobConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RiskAnalysisJobConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var RiskAnalysisJobConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Privacy metric to compute for reidentification risk analysis. + * + * @property {Object} numericalStatsConfig + * This object should have the same structure as [NumericalStatsConfig]{@link google.privacy.dlp.v2.NumericalStatsConfig} + * + * @property {Object} categoricalStatsConfig + * This object should have the same structure as [CategoricalStatsConfig]{@link google.privacy.dlp.v2.CategoricalStatsConfig} + * + * @property {Object} kAnonymityConfig + * This object should have the same structure as [KAnonymityConfig]{@link google.privacy.dlp.v2.KAnonymityConfig} + * + * @property {Object} lDiversityConfig + * This object should have the same structure as [LDiversityConfig]{@link google.privacy.dlp.v2.LDiversityConfig} + * + * @property {Object} kMapEstimationConfig + * This object should have the same structure as [KMapEstimationConfig]{@link google.privacy.dlp.v2.KMapEstimationConfig} + * + * @typedef PrivacyMetric + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.PrivacyMetric definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var PrivacyMetric = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * Compute numerical stats over an individual column, including + * min, max, and quantiles. + * + * @property {Object} field + * Field to compute numerical stats on. Supported types are + * integer, float, date, datetime, timestamp, time. + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @typedef NumericalStatsConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.PrivacyMetric.NumericalStatsConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + NumericalStatsConfig: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * Compute numerical stats over an individual column, including + * number of distinct values and value count distribution. + * + * @property {Object} field + * Field to compute categorical stats on. All column types are + * supported except for arrays and structs. However, it may be more + * informative to use NumericalStats when the field type is supported, + * depending on the data. + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @typedef CategoricalStatsConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.PrivacyMetric.CategoricalStatsConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + CategoricalStatsConfig: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * k-anonymity metric, used for analysis of reidentification risk. + * + * @property {Object[]} quasiIds + * Set of fields to compute k-anonymity over. When multiple fields are + * specified, they are considered a single composite key. Structs and + * repeated data types are not supported; however, nested fields are + * supported so long as they are not structs themselves or nested within + * a repeated field. + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @typedef KAnonymityConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.PrivacyMetric.KAnonymityConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + KAnonymityConfig: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * l-diversity metric, used for analysis of reidentification risk. + * + * @property {Object[]} quasiIds + * Set of quasi-identifiers indicating how equivalence classes are + * defined for the l-diversity computation. When multiple fields are + * specified, they are considered a single composite key. + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @property {Object} sensitiveAttribute + * Sensitive field for computing the l-value. + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @typedef LDiversityConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.PrivacyMetric.LDiversityConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + LDiversityConfig: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * Reidentifiability metric. This corresponds to a risk model similar to what + * is called "journalist risk" in the literature, except the attack dataset is + * statistically modeled instead of being perfectly known. This can be done + * using publicly available data (like the US Census), or using a custom + * statistical model (indicated as one or several BigQuery tables), or by + * extrapolating from the distribution of values in the input dataset. + * + * @property {Object[]} quasiIds + * Fields considered to be quasi-identifiers. No two columns can have the + * same tag. [required] + * + * This object should have the same structure as [TaggedField]{@link google.privacy.dlp.v2.TaggedField} + * + * @property {string} regionCode + * ISO 3166-1 alpha-2 region code to use in the statistical modeling. + * Required if no column is tagged with a region-specific InfoType (like + * US_ZIP_5) or a region code. + * + * @property {Object[]} auxiliaryTables + * Several auxiliary tables can be used in the analysis. Each custom_tag + * used to tag a quasi-identifiers column must appear in exactly one column + * of one auxiliary table. + * + * This object should have the same structure as [AuxiliaryTable]{@link google.privacy.dlp.v2.AuxiliaryTable} + * + * @typedef KMapEstimationConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.PrivacyMetric.KMapEstimationConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + KMapEstimationConfig: { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * A column with a semantic tag attached. + * + * @property {Object} field + * Identifies the column. [required] + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @property {Object} infoType + * A column can be tagged with a InfoType to use the relevant public + * dataset as a statistical model of population, if available. We + * currently support US ZIP codes, region codes, ages and genders. + * To programmatically obtain the list of supported InfoTypes, use + * ListInfoTypes with the supported_by=RISK_ANALYSIS filter. + * + * This object should have the same structure as [InfoType]{@link google.privacy.dlp.v2.InfoType} + * + * @property {string} customTag + * A column can be tagged with a custom tag. In this case, the user must + * indicate an auxiliary table that contains statistical information on + * the possible values of this column (below). + * + * @property {Object} inferred + * If no semantic tag is indicated, we infer the statistical model from + * the distribution of values in the input data + * + * This object should have the same structure as [Empty]{@link google.protobuf.Empty} + * + * @typedef TaggedField + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.PrivacyMetric.KMapEstimationConfig.TaggedField definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + TaggedField: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * An auxiliary table contains statistical information on the relative + * frequency of different quasi-identifiers values. It has one or several + * quasi-identifiers columns, and one column that indicates the relative + * frequency of each quasi-identifier tuple. + * If a tuple is present in the data but not in the auxiliary table, the + * corresponding relative frequency is assumed to be zero (and thus, the + * tuple is highly reidentifiable). + * + * @property {Object} table + * Auxiliary table location. [required] + * + * This object should have the same structure as [BigQueryTable]{@link google.privacy.dlp.v2.BigQueryTable} + * + * @property {Object[]} quasiIds + * Quasi-identifier columns. [required] + * + * This object should have the same structure as [QuasiIdField]{@link google.privacy.dlp.v2.QuasiIdField} + * + * @property {Object} relativeFrequency + * The relative frequency column must contain a floating-point number + * between 0 and 1 (inclusive). Null values are assumed to be zero. + * [required] + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @typedef AuxiliaryTable + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.PrivacyMetric.KMapEstimationConfig.AuxiliaryTable definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + AuxiliaryTable: { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * A quasi-identifier column has a custom_tag, used to know which column + * in the data corresponds to which column in the statistical model. + * + * @property {Object} field + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @property {string} customTag + * + * @typedef QuasiIdField + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.PrivacyMetric.KMapEstimationConfig.AuxiliaryTable.QuasiIdField definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + QuasiIdField: { + // This is for documentation. Actual contents will be loaded by gRPC. + } + } + } +}; + +/** + * Result of a risk analysis operation request. + * + * @property {Object} requestedPrivacyMetric + * Privacy metric to compute. + * + * This object should have the same structure as [PrivacyMetric]{@link google.privacy.dlp.v2.PrivacyMetric} + * + * @property {Object} requestedSourceTable + * Input dataset to compute metrics over. + * + * This object should have the same structure as [BigQueryTable]{@link google.privacy.dlp.v2.BigQueryTable} + * + * @property {Object} numericalStatsResult + * This object should have the same structure as [NumericalStatsResult]{@link google.privacy.dlp.v2.NumericalStatsResult} + * + * @property {Object} categoricalStatsResult + * This object should have the same structure as [CategoricalStatsResult]{@link google.privacy.dlp.v2.CategoricalStatsResult} + * + * @property {Object} kAnonymityResult + * This object should have the same structure as [KAnonymityResult]{@link google.privacy.dlp.v2.KAnonymityResult} + * + * @property {Object} lDiversityResult + * This object should have the same structure as [LDiversityResult]{@link google.privacy.dlp.v2.LDiversityResult} + * + * @property {Object} kMapEstimationResult + * This object should have the same structure as [KMapEstimationResult]{@link google.privacy.dlp.v2.KMapEstimationResult} + * + * @typedef AnalyzeDataSourceRiskDetails + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var AnalyzeDataSourceRiskDetails = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * Result of the numerical stats computation. + * + * @property {Object} minValue + * Minimum value appearing in the column. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @property {Object} maxValue + * Maximum value appearing in the column. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @property {Object[]} quantileValues + * List of 99 values that partition the set of field values into 100 equal + * sized buckets. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @typedef NumericalStatsResult + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.NumericalStatsResult definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + NumericalStatsResult: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * Result of the categorical stats computation. + * + * @property {Object[]} valueFrequencyHistogramBuckets + * Histogram of value frequencies in the column. + * + * This object should have the same structure as [CategoricalStatsHistogramBucket]{@link google.privacy.dlp.v2.CategoricalStatsHistogramBucket} + * + * @typedef CategoricalStatsResult + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.CategoricalStatsResult definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + CategoricalStatsResult: { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * @property {number} valueFrequencyLowerBound + * Lower bound on the value frequency of the values in this bucket. + * + * @property {number} valueFrequencyUpperBound + * Upper bound on the value frequency of the values in this bucket. + * + * @property {number} bucketSize + * Total number of values in this bucket. + * + * @property {Object[]} bucketValues + * Sample of value frequencies in this bucket. The total number of + * values returned per bucket is capped at 20. + * + * This object should have the same structure as [ValueFrequency]{@link google.privacy.dlp.v2.ValueFrequency} + * + * @property {number} bucketValueCount + * Total number of distinct values in this bucket. + * + * @typedef CategoricalStatsHistogramBucket + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.CategoricalStatsResult.CategoricalStatsHistogramBucket definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + CategoricalStatsHistogramBucket: { + // This is for documentation. Actual contents will be loaded by gRPC. + } + }, + + /** + * Result of the k-anonymity computation. + * + * @property {Object[]} equivalenceClassHistogramBuckets + * Histogram of k-anonymity equivalence classes. + * + * This object should have the same structure as [KAnonymityHistogramBucket]{@link google.privacy.dlp.v2.KAnonymityHistogramBucket} + * + * @typedef KAnonymityResult + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.KAnonymityResult definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + KAnonymityResult: { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * The set of columns' values that share the same ldiversity value + * + * @property {Object[]} quasiIdsValues + * Set of values defining the equivalence class. One value per + * quasi-identifier column in the original KAnonymity metric message. + * The order is always the same as the original request. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @property {number} equivalenceClassSize + * Size of the equivalence class, for example number of rows with the + * above set of values. + * + * @typedef KAnonymityEquivalenceClass + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.KAnonymityResult.KAnonymityEquivalenceClass definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + KAnonymityEquivalenceClass: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * @property {number} equivalenceClassSizeLowerBound + * Lower bound on the size of the equivalence classes in this bucket. + * + * @property {number} equivalenceClassSizeUpperBound + * Upper bound on the size of the equivalence classes in this bucket. + * + * @property {number} bucketSize + * Total number of equivalence classes in this bucket. + * + * @property {Object[]} bucketValues + * Sample of equivalence classes in this bucket. The total number of + * classes returned per bucket is capped at 20. + * + * This object should have the same structure as [KAnonymityEquivalenceClass]{@link google.privacy.dlp.v2.KAnonymityEquivalenceClass} + * + * @property {number} bucketValueCount + * Total number of distinct equivalence classes in this bucket. + * + * @typedef KAnonymityHistogramBucket + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.KAnonymityResult.KAnonymityHistogramBucket definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + KAnonymityHistogramBucket: { + // This is for documentation. Actual contents will be loaded by gRPC. + } + }, + + /** + * Result of the l-diversity computation. + * + * @property {Object[]} sensitiveValueFrequencyHistogramBuckets + * Histogram of l-diversity equivalence class sensitive value frequencies. + * + * This object should have the same structure as [LDiversityHistogramBucket]{@link google.privacy.dlp.v2.LDiversityHistogramBucket} + * + * @typedef LDiversityResult + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.LDiversityResult definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + LDiversityResult: { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * The set of columns' values that share the same ldiversity value. + * + * @property {Object[]} quasiIdsValues + * Quasi-identifier values defining the k-anonymity equivalence + * class. The order is always the same as the original request. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @property {number} equivalenceClassSize + * Size of the k-anonymity equivalence class. + * + * @property {number} numDistinctSensitiveValues + * Number of distinct sensitive values in this equivalence class. + * + * @property {Object[]} topSensitiveValues + * Estimated frequencies of top sensitive values. + * + * This object should have the same structure as [ValueFrequency]{@link google.privacy.dlp.v2.ValueFrequency} + * + * @typedef LDiversityEquivalenceClass + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.LDiversityResult.LDiversityEquivalenceClass definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + LDiversityEquivalenceClass: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * @property {number} sensitiveValueFrequencyLowerBound + * Lower bound on the sensitive value frequencies of the equivalence + * classes in this bucket. + * + * @property {number} sensitiveValueFrequencyUpperBound + * Upper bound on the sensitive value frequencies of the equivalence + * classes in this bucket. + * + * @property {number} bucketSize + * Total number of equivalence classes in this bucket. + * + * @property {Object[]} bucketValues + * Sample of equivalence classes in this bucket. The total number of + * classes returned per bucket is capped at 20. + * + * This object should have the same structure as [LDiversityEquivalenceClass]{@link google.privacy.dlp.v2.LDiversityEquivalenceClass} + * + * @property {number} bucketValueCount + * Total number of distinct equivalence classes in this bucket. + * + * @typedef LDiversityHistogramBucket + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.LDiversityResult.LDiversityHistogramBucket definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + LDiversityHistogramBucket: { + // This is for documentation. Actual contents will be loaded by gRPC. + } + }, + + /** + * Result of the reidentifiability analysis. Note that these results are an + * estimation, not exact values. + * + * @property {Object[]} kMapEstimationHistogram + * The intervals [min_anonymity, max_anonymity] do not overlap. If a value + * doesn't correspond to any such interval, the associated frequency is + * zero. For example, the following records: + * {min_anonymity: 1, max_anonymity: 1, frequency: 17} + * {min_anonymity: 2, max_anonymity: 3, frequency: 42} + * {min_anonymity: 5, max_anonymity: 10, frequency: 99} + * mean that there are no record with an estimated anonymity of 4, 5, or + * larger than 10. + * + * This object should have the same structure as [KMapEstimationHistogramBucket]{@link google.privacy.dlp.v2.KMapEstimationHistogramBucket} + * + * @typedef KMapEstimationResult + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.KMapEstimationResult definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + KMapEstimationResult: { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * A tuple of values for the quasi-identifier columns. + * + * @property {Object[]} quasiIdsValues + * The quasi-identifier values. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @property {number} estimatedAnonymity + * The estimated anonymity for these quasi-identifier values. + * + * @typedef KMapEstimationQuasiIdValues + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.KMapEstimationResult.KMapEstimationQuasiIdValues definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + KMapEstimationQuasiIdValues: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * A KMapEstimationHistogramBucket message with the following values: + * min_anonymity: 3 + * max_anonymity: 5 + * frequency: 42 + * means that there are 42 records whose quasi-identifier values correspond + * to 3, 4 or 5 people in the overlying population. An important particular + * case is when min_anonymity = max_anonymity = 1: the frequency field then + * corresponds to the number of uniquely identifiable records. + * + * @property {number} minAnonymity + * Always positive. + * + * @property {number} maxAnonymity + * Always greater than or equal to min_anonymity. + * + * @property {number} bucketSize + * Number of records within these anonymity bounds. + * + * @property {Object[]} bucketValues + * Sample of quasi-identifier tuple values in this bucket. The total + * number of classes returned per bucket is capped at 20. + * + * This object should have the same structure as [KMapEstimationQuasiIdValues]{@link google.privacy.dlp.v2.KMapEstimationQuasiIdValues} + * + * @property {number} bucketValueCount + * Total number of distinct quasi-identifier tuple values in this bucket. + * + * @typedef KMapEstimationHistogramBucket + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails.KMapEstimationResult.KMapEstimationHistogramBucket definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + KMapEstimationHistogramBucket: { + // This is for documentation. Actual contents will be loaded by gRPC. + } + } +}; + +/** + * A value of a field, including its frequency. + * + * @property {Object} value + * A value contained in the field in question. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @property {number} count + * How many times the value is contained in the field. + * + * @typedef ValueFrequency + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ValueFrequency definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ValueFrequency = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Set of primitive values supported by the system. + * Note that for the purposes of inspection or transformation, the number + * of bytes considered to comprise a 'Value' is based on its representation + * as a UTF-8 encoded string. For example, if 'integer_value' is set to + * 123456789, the number of bytes would be counted as 9, even though an + * int64 only holds up to 8 bytes of data. + * + * @property {number} integerValue + * + * @property {number} floatValue + * + * @property {string} stringValue + * + * @property {boolean} booleanValue + * + * @property {Object} timestampValue + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {Object} timeValue + * This object should have the same structure as [TimeOfDay]{@link google.type.TimeOfDay} + * + * @property {Object} dateValue + * This object should have the same structure as [Date]{@link google.type.Date} + * + * @property {number} dayOfWeekValue + * The number should be among the values of [DayOfWeek]{@link google.type.DayOfWeek} + * + * @typedef Value + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Value definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var Value = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Message for infoType-dependent details parsed from quote. + * + * @property {Object} dateTime + * This object should have the same structure as [DateTime]{@link google.privacy.dlp.v2.DateTime} + * + * @typedef QuoteInfo + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.QuoteInfo definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var QuoteInfo = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Message for a date time object. + * + * @property {Object} date + * One or more of the following must be set. All fields are optional, but + * when set must be valid date or time values. + * + * This object should have the same structure as [Date]{@link google.type.Date} + * + * @property {number} dayOfWeek + * The number should be among the values of [DayOfWeek]{@link google.type.DayOfWeek} + * + * @property {Object} time + * This object should have the same structure as [TimeOfDay]{@link google.type.TimeOfDay} + * + * @property {Object} timeZone + * This object should have the same structure as [TimeZone]{@link google.privacy.dlp.v2.TimeZone} + * + * @typedef DateTime + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DateTime definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DateTime = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * @property {number} offsetMinutes + * Set only if the offset can be determined. Positive for time ahead of UTC. + * E.g. For "UTC-9", this value is -540. + * + * @typedef TimeZone + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DateTime.TimeZone definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + TimeZone: { + // This is for documentation. Actual contents will be loaded by gRPC. + } +}; + +/** + * The configuration that controls how the data will change. + * + * @property {Object} infoTypeTransformations + * Treat the dataset as free-form text and apply the same free text + * transformation everywhere. + * + * This object should have the same structure as [InfoTypeTransformations]{@link google.privacy.dlp.v2.InfoTypeTransformations} + * + * @property {Object} recordTransformations + * Treat the dataset as structured. Transformations can be applied to + * specific locations within structured datasets, such as transforming + * a column within a table. + * + * This object should have the same structure as [RecordTransformations]{@link google.privacy.dlp.v2.RecordTransformations} + * + * @typedef DeidentifyConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DeidentifyConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DeidentifyConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A rule for transforming a value. + * + * @property {Object} replaceConfig + * This object should have the same structure as [ReplaceValueConfig]{@link google.privacy.dlp.v2.ReplaceValueConfig} + * + * @property {Object} redactConfig + * This object should have the same structure as [RedactConfig]{@link google.privacy.dlp.v2.RedactConfig} + * + * @property {Object} characterMaskConfig + * This object should have the same structure as [CharacterMaskConfig]{@link google.privacy.dlp.v2.CharacterMaskConfig} + * + * @property {Object} cryptoReplaceFfxFpeConfig + * This object should have the same structure as [CryptoReplaceFfxFpeConfig]{@link google.privacy.dlp.v2.CryptoReplaceFfxFpeConfig} + * + * @property {Object} fixedSizeBucketingConfig + * This object should have the same structure as [FixedSizeBucketingConfig]{@link google.privacy.dlp.v2.FixedSizeBucketingConfig} + * + * @property {Object} bucketingConfig + * This object should have the same structure as [BucketingConfig]{@link google.privacy.dlp.v2.BucketingConfig} + * + * @property {Object} replaceWithInfoTypeConfig + * This object should have the same structure as [ReplaceWithInfoTypeConfig]{@link google.privacy.dlp.v2.ReplaceWithInfoTypeConfig} + * + * @property {Object} timePartConfig + * This object should have the same structure as [TimePartConfig]{@link google.privacy.dlp.v2.TimePartConfig} + * + * @property {Object} cryptoHashConfig + * This object should have the same structure as [CryptoHashConfig]{@link google.privacy.dlp.v2.CryptoHashConfig} + * + * @property {Object} dateShiftConfig + * This object should have the same structure as [DateShiftConfig]{@link google.privacy.dlp.v2.DateShiftConfig} + * + * @typedef PrimitiveTransformation + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.PrimitiveTransformation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var PrimitiveTransformation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * For use with `Date`, `Timestamp`, and `TimeOfDay`, extract or preserve a + * portion of the value. + * + * @property {number} partToExtract + * The number should be among the values of [TimePart]{@link google.privacy.dlp.v2.TimePart} + * + * @typedef TimePartConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.TimePartConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var TimePartConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ + TimePart: { + TIME_PART_UNSPECIFIED: 0, + + /** + * [0-9999] + */ + YEAR: 1, + + /** + * [1-12] + */ + MONTH: 2, + + /** + * [1-31] + */ + DAY_OF_MONTH: 3, + + /** + * [1-7] + */ + DAY_OF_WEEK: 4, + + /** + * [1-52] + */ + WEEK_OF_YEAR: 5, + + /** + * [0-23] + */ + HOUR_OF_DAY: 6 + } +}; + +/** + * Pseudonymization method that generates surrogates via cryptographic hashing. + * Uses SHA-256. + * The key size must be either 32 or 64 bytes. + * Outputs a 32 byte digest as an uppercase hex string + * (for example, 41D1567F7F99F1DC2A5FAB886DEE5BEE). + * Currently, only string and integer values can be hashed. + * + * @property {Object} cryptoKey + * The key used by the hash function. + * + * This object should have the same structure as [CryptoKey]{@link google.privacy.dlp.v2.CryptoKey} + * + * @typedef CryptoHashConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CryptoHashConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var CryptoHashConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Replace each input value with a given `Value`. + * + * @property {Object} newValue + * Value to replace it with. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @typedef ReplaceValueConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ReplaceValueConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ReplaceValueConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Replace each matching finding with the name of the info_type. + * @typedef ReplaceWithInfoTypeConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ReplaceWithInfoTypeConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ReplaceWithInfoTypeConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Redact a given value. For example, if used with an `InfoTypeTransformation` + * transforming PHONE_NUMBER, and input 'My phone number is 206-555-0123', the + * output would be 'My phone number is '. + * @typedef RedactConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RedactConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var RedactConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Characters to skip when doing deidentification of a value. These will be left + * alone and skipped. + * + * @property {string} charactersToSkip + * + * @property {number} commonCharactersToIgnore + * The number should be among the values of [CommonCharsToIgnore]{@link google.privacy.dlp.v2.CommonCharsToIgnore} + * + * @typedef CharsToIgnore + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CharsToIgnore definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var CharsToIgnore = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ + CommonCharsToIgnore: { + COMMON_CHARS_TO_IGNORE_UNSPECIFIED: 0, + + /** + * 0-9 + */ + NUMERIC: 1, + + /** + * A-Z + */ + ALPHA_UPPER_CASE: 2, + + /** + * a-z + */ + ALPHA_LOWER_CASE: 3, + + /** + * US Punctuation, one of !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ + */ + PUNCTUATION: 4, + + /** + * Whitespace character, one of [ \t\n\x0B\f\r] + */ + WHITESPACE: 5 + } +}; + +/** + * Partially mask a string by replacing a given number of characters with a + * fixed character. Masking can start from the beginning or end of the string. + * This can be used on data of any type (numbers, longs, and so on) and when + * de-identifying structured data we'll attempt to preserve the original data's + * type. (This allows you to take a long like 123 and modify it to a string like + * **3. + * + * @property {string} maskingCharacter + * Character to mask the sensitive values—for example, "*" for an + * alphabetic string such as name, or "0" for a numeric string such as ZIP + * code or credit card number. String must have length 1. If not supplied, we + * will default to "*" for strings, 0 for digits. + * + * @property {number} numberToMask + * Number of characters to mask. If not set, all matching chars will be + * masked. Skipped characters do not count towards this tally. + * + * @property {boolean} reverseOrder + * Mask characters in reverse order. For example, if `masking_character` is + * '0', number_to_mask is 14, and `reverse_order` is false, then + * 1234-5678-9012-3456 -> 00000000000000-3456 + * If `masking_character` is '*', `number_to_mask` is 3, and `reverse_order` + * is true, then 12345 -> 12*** + * + * @property {Object[]} charactersToIgnore + * When masking a string, items in this list will be skipped when replacing. + * For example, if your string is 555-555-5555 and you ask us to skip `-` and + * mask 5 chars with * we would produce ***-*55-5555. + * + * This object should have the same structure as [CharsToIgnore]{@link google.privacy.dlp.v2.CharsToIgnore} + * + * @typedef CharacterMaskConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CharacterMaskConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var CharacterMaskConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Buckets values based on fixed size ranges. The + * Bucketing transformation can provide all of this functionality, + * but requires more configuration. This message is provided as a convenience to + * the user for simple bucketing strategies. + * + * The transformed value will be a hyphenated string of + * -, i.e if lower_bound = 10 and upper_bound = 20 + * all values that are within this bucket will be replaced with "10-20". + * + * This can be used on data of type: double, long. + * + * If the bound Value type differs from the type of data + * being transformed, we will first attempt converting the type of the data to + * be transformed to match the type of the bound before comparing. + * + * @property {Object} lowerBound + * Lower bound value of buckets. All values less than `lower_bound` are + * grouped together into a single bucket; for example if `lower_bound` = 10, + * then all values less than 10 are replaced with the value “-10”. [Required]. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @property {Object} upperBound + * Upper bound value of buckets. All values greater than upper_bound are + * grouped together into a single bucket; for example if `upper_bound` = 89, + * then all values greater than 89 are replaced with the value “89+”. + * [Required]. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @property {number} bucketSize + * Size of each bucket (except for minimum and maximum buckets). So if + * `lower_bound` = 10, `upper_bound` = 89, and `bucket_size` = 10, then the + * following buckets would be used: -10, 10-20, 20-30, 30-40, 40-50, 50-60, + * 60-70, 70-80, 80-89, 89+. Precision up to 2 decimals works. [Required]. + * + * @typedef FixedSizeBucketingConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.FixedSizeBucketingConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var FixedSizeBucketingConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Generalization function that buckets values based on ranges. The ranges and + * replacement values are dynamically provided by the user for custom behavior, + * such as 1-30 -> LOW 31-65 -> MEDIUM 66-100 -> HIGH + * This can be used on + * data of type: number, long, string, timestamp. + * If the bound `Value` type differs from the type of data being transformed, we + * will first attempt converting the type of the data to be transformed to match + * the type of the bound before comparing. + * + * @property {Object[]} buckets + * Set of buckets. Ranges must be non-overlapping. + * + * This object should have the same structure as [Bucket]{@link google.privacy.dlp.v2.Bucket} + * + * @typedef BucketingConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.BucketingConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var BucketingConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * Bucket is represented as a range, along with replacement values. + * + * @property {Object} min + * Lower bound of the range, inclusive. Type should be the same as max if + * used. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @property {Object} max + * Upper bound of the range, exclusive; type must match min. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @property {Object} replacementValue + * Replacement value for this bucket. If not provided + * the default behavior will be to hyphenate the min-max range. + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @typedef Bucket + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.BucketingConfig.Bucket definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + Bucket: { + // This is for documentation. Actual contents will be loaded by gRPC. + } +}; + +/** + * Replaces an identifier with a surrogate using FPE with the FFX + * mode of operation; however when used in the `ReidentifyContent` API method, + * it serves the opposite function by reversing the surrogate back into + * the original identifier. + * The identifier must be encoded as ASCII. + * For a given crypto key and context, the same identifier will be + * replaced with the same surrogate. + * Identifiers must be at least two characters long. + * In the case that the identifier is the empty string, it will be skipped. + * See [Pseudonymization](https://cloud.google.com/dlp/docs/pseudonymization) for example usage. + * + * @property {Object} cryptoKey + * The key used by the encryption algorithm. [required] + * + * This object should have the same structure as [CryptoKey]{@link google.privacy.dlp.v2.CryptoKey} + * + * @property {Object} context + * The 'tweak', a context may be used for higher security since the same + * identifier in two different contexts won't be given the same surrogate. If + * the context is not set, a default tweak will be used. + * + * If the context is set but: + * + * 1. there is no record present when transforming a given value or + * 1. the field is not present when transforming a given value, + * + * a default tweak will be used. + * + * Note that case (1) is expected when an `InfoTypeTransformation` is + * applied to both structured and non-structured `ContentItem`s. + * Currently, the referenced field may be of value type integer or string. + * + * The tweak is constructed as a sequence of bytes in big endian byte order + * such that: + * + * - a 64 bit integer is encoded followed by a single byte of value 1 + * - a string is encoded in UTF-8 format followed by a single byte of value + * å 2 + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @property {number} commonAlphabet + * The number should be among the values of [FfxCommonNativeAlphabet]{@link google.privacy.dlp.v2.FfxCommonNativeAlphabet} + * + * @property {string} customAlphabet + * This is supported by mapping these to the alphanumeric characters + * that the FFX mode natively supports. This happens before/after + * encryption/decryption. + * Each character listed must appear only once. + * Number of characters must be in the range [2, 62]. + * This must be encoded as ASCII. + * The order of characters does not matter. + * + * @property {number} radix + * The native way to select the alphabet. Must be in the range [2, 62]. + * + * @property {Object} surrogateInfoType + * The custom infoType to annotate the surrogate with. + * This annotation will be applied to the surrogate by prefixing it with + * the name of the custom infoType followed by the number of + * characters comprising the surrogate. The following scheme defines the + * format: info_type_name(surrogate_character_count):surrogate + * + * For example, if the name of custom infoType is 'MY_TOKEN_INFO_TYPE' and + * the surrogate is 'abc', the full replacement value + * will be: 'MY_TOKEN_INFO_TYPE(3):abc' + * + * This annotation identifies the surrogate when inspecting content using the + * custom infoType + * [`SurrogateType`](https://cloud.google.com/dlp/docs/reference/rest/v2/InspectConfig#surrogatetype). + * This facilitates reversal of the surrogate when it occurs in free text. + * + * In order for inspection to work properly, the name of this infoType must + * not occur naturally anywhere in your data; otherwise, inspection may + * find a surrogate that does not correspond to an actual identifier. + * Therefore, choose your custom infoType name carefully after considering + * what your data looks like. One way to select a name that has a high chance + * of yielding reliable detection is to include one or more unicode characters + * that are highly improbable to exist in your data. + * For example, assuming your data is entered from a regular ASCII keyboard, + * the symbol with the hex code point 29DD might be used like so: + * ⧝MY_TOKEN_TYPE + * + * This object should have the same structure as [InfoType]{@link google.privacy.dlp.v2.InfoType} + * + * @typedef CryptoReplaceFfxFpeConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CryptoReplaceFfxFpeConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var CryptoReplaceFfxFpeConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * These are commonly used subsets of the alphabet that the FFX mode + * natively supports. In the algorithm, the alphabet is selected using + * the "radix". Therefore each corresponds to particular radix. + * + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ + FfxCommonNativeAlphabet: { + FFX_COMMON_NATIVE_ALPHABET_UNSPECIFIED: 0, + + /** + * [0-9] (radix of 10) + */ + NUMERIC: 1, + + /** + * [0-9A-F] (radix of 16) + */ + HEXADECIMAL: 2, + + /** + * [0-9A-Z] (radix of 36) + */ + UPPER_CASE_ALPHA_NUMERIC: 3, + + /** + * [0-9A-Za-z] (radix of 62) + */ + ALPHA_NUMERIC: 4 + } +}; + +/** + * This is a data encryption key (DEK) (as opposed to + * a key encryption key (KEK) stored by KMS). + * When using KMS to wrap/unwrap DEKs, be sure to set an appropriate + * IAM policy on the KMS CryptoKey (KEK) to ensure an attacker cannot + * unwrap the data crypto key. + * + * @property {Object} transient + * This object should have the same structure as [TransientCryptoKey]{@link google.privacy.dlp.v2.TransientCryptoKey} + * + * @property {Object} unwrapped + * This object should have the same structure as [UnwrappedCryptoKey]{@link google.privacy.dlp.v2.UnwrappedCryptoKey} + * + * @property {Object} kmsWrapped + * This object should have the same structure as [KmsWrappedCryptoKey]{@link google.privacy.dlp.v2.KmsWrappedCryptoKey} + * + * @typedef CryptoKey + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CryptoKey definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var CryptoKey = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Use this to have a random data crypto key generated. + * It will be discarded after the request finishes. + * + * @property {string} name + * Name of the key. [required] + * This is an arbitrary string used to differentiate different keys. + * A unique key is generated per name: two separate `TransientCryptoKey` + * protos share the same generated key if their names are the same. + * When the data crypto key is generated, this name is not used in any way + * (repeating the api call will result in a different key being generated). + * + * @typedef TransientCryptoKey + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.TransientCryptoKey definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var TransientCryptoKey = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Using raw keys is prone to security risks due to accidentally + * leaking the key. Choose another type of key if possible. + * + * @property {string} key + * The AES 128/192/256 bit key. [required] + * + * @typedef UnwrappedCryptoKey + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.UnwrappedCryptoKey definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var UnwrappedCryptoKey = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Include to use an existing data crypto key wrapped by KMS. + * Authorization requires the following IAM permissions when sending a request + * to perform a crypto transformation using a kms-wrapped crypto key: + * dlp.kms.encrypt + * + * @property {string} wrappedKey + * The wrapped data crypto key. [required] + * + * @property {string} cryptoKeyName + * The resource name of the KMS CryptoKey to use for unwrapping. [required] + * + * @typedef KmsWrappedCryptoKey + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.KmsWrappedCryptoKey definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var KmsWrappedCryptoKey = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Shifts dates by random number of days, with option to be consistent for the + * same context. + * + * @property {number} upperBoundDays + * Range of shift in days. Actual shift will be selected at random within this + * range (inclusive ends). Negative means shift to earlier in time. Must not + * be more than 365250 days (1000 years) each direction. + * + * For example, 3 means shift date to at most 3 days into the future. + * [Required] + * + * @property {number} lowerBoundDays + * For example, -5 means shift date to at most 5 days back in the past. + * [Required] + * + * @property {Object} context + * Points to the field that contains the context, for example, an entity id. + * If set, must also set method. If set, shift will be consistent for the + * given context. + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @property {Object} cryptoKey + * Causes the shift to be computed based on this key and the context. This + * results in the same shift for the same context and crypto_key. + * + * This object should have the same structure as [CryptoKey]{@link google.privacy.dlp.v2.CryptoKey} + * + * @typedef DateShiftConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DateShiftConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DateShiftConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A type of transformation that will scan unstructured text and + * apply various `PrimitiveTransformation`s to each finding, where the + * transformation is applied to only values that were identified as a specific + * info_type. + * + * @property {Object[]} transformations + * Transformation for each infoType. Cannot specify more than one + * for a given infoType. [required] + * + * This object should have the same structure as [InfoTypeTransformation]{@link google.privacy.dlp.v2.InfoTypeTransformation} + * + * @typedef InfoTypeTransformations + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InfoTypeTransformations definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var InfoTypeTransformations = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * A transformation to apply to text that is identified as a specific + * info_type. + * + * @property {Object[]} infoTypes + * InfoTypes to apply the transformation to. Empty list will match all + * available infoTypes for this transformation. + * + * This object should have the same structure as [InfoType]{@link google.privacy.dlp.v2.InfoType} + * + * @property {Object} primitiveTransformation + * Primitive transformation to apply to the infoType. [required] + * + * This object should have the same structure as [PrimitiveTransformation]{@link google.privacy.dlp.v2.PrimitiveTransformation} + * + * @typedef InfoTypeTransformation + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InfoTypeTransformations.InfoTypeTransformation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + InfoTypeTransformation: { + // This is for documentation. Actual contents will be loaded by gRPC. + } +}; + +/** + * The transformation to apply to the field. + * + * @property {Object[]} fields + * Input field(s) to apply the transformation to. [required] + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @property {Object} condition + * Only apply the transformation if the condition evaluates to true for the + * given `RecordCondition`. The conditions are allowed to reference fields + * that are not used in the actual transformation. [optional] + * + * Example Use Cases: + * + * - Apply a different bucket transformation to an age column if the zip code + * column for the same record is within a specific range. + * - Redact a field if the date of birth field is greater than 85. + * + * This object should have the same structure as [RecordCondition]{@link google.privacy.dlp.v2.RecordCondition} + * + * @property {Object} primitiveTransformation + * Apply the transformation to the entire field. + * + * This object should have the same structure as [PrimitiveTransformation]{@link google.privacy.dlp.v2.PrimitiveTransformation} + * + * @property {Object} infoTypeTransformations + * Treat the contents of the field as free text, and selectively + * transform content that matches an `InfoType`. + * + * This object should have the same structure as [InfoTypeTransformations]{@link google.privacy.dlp.v2.InfoTypeTransformations} + * + * @typedef FieldTransformation + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.FieldTransformation definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var FieldTransformation = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A type of transformation that is applied over structured data such as a + * table. + * + * @property {Object[]} fieldTransformations + * Transform the record by applying various field transformations. + * + * This object should have the same structure as [FieldTransformation]{@link google.privacy.dlp.v2.FieldTransformation} + * + * @property {Object[]} recordSuppressions + * Configuration defining which records get suppressed entirely. Records that + * match any suppression rule are omitted from the output [optional]. + * + * This object should have the same structure as [RecordSuppression]{@link google.privacy.dlp.v2.RecordSuppression} + * + * @typedef RecordTransformations + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RecordTransformations definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var RecordTransformations = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Configuration to suppress records whose suppression conditions evaluate to + * true. + * + * @property {Object} condition + * A condition that when it evaluates to true will result in the record being + * evaluated to be suppressed from the transformed content. + * + * This object should have the same structure as [RecordCondition]{@link google.privacy.dlp.v2.RecordCondition} + * + * @typedef RecordSuppression + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RecordSuppression definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var RecordSuppression = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A condition for determining whether a transformation should be applied to + * a field. + * + * @property {Object} expressions + * An expression. + * + * This object should have the same structure as [Expressions]{@link google.privacy.dlp.v2.Expressions} + * + * @typedef RecordCondition + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RecordCondition definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var RecordCondition = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * The field type of `value` and `field` do not need to match to be + * considered equal, but not all comparisons are possible. + * + * A `value` of type: + * + * - `string` can be compared against all other types + * - `boolean` can only be compared against other booleans + * - `integer` can be compared against doubles or a string if the string value + * can be parsed as an integer. + * - `double` can be compared against integers or a string if the string can + * be parsed as a double. + * - `Timestamp` can be compared against strings in RFC 3339 date string + * format. + * - `TimeOfDay` can be compared against timestamps and strings in the format + * of 'HH:mm:ss'. + * + * If we fail to compare do to type mismatch, a warning will be given and + * the condition will evaluate to false. + * + * @property {Object} field + * Field within the record this condition is evaluated against. [required] + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @property {number} operator + * Operator used to compare the field or infoType to the value. [required] + * + * The number should be among the values of [RelationalOperator]{@link google.privacy.dlp.v2.RelationalOperator} + * + * @property {Object} value + * Value to compare against. [Required, except for `EXISTS` tests.] + * + * This object should have the same structure as [Value]{@link google.privacy.dlp.v2.Value} + * + * @typedef Condition + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RecordCondition.Condition definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + Condition: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * A collection of conditions. + * + * @property {Object[]} conditions + * This object should have the same structure as [Condition]{@link google.privacy.dlp.v2.Condition} + * + * @typedef Conditions + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RecordCondition.Conditions definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + Conditions: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * An expression, consisting or an operator and conditions. + * + * @property {number} logicalOperator + * The operator to apply to the result of conditions. Default and currently + * only supported value is `AND`. + * + * The number should be among the values of [LogicalOperator]{@link google.privacy.dlp.v2.LogicalOperator} + * + * @property {Object} conditions + * This object should have the same structure as [Conditions]{@link google.privacy.dlp.v2.Conditions} + * + * @typedef Expressions + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RecordCondition.Expressions definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + Expressions: { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ + LogicalOperator: { + LOGICAL_OPERATOR_UNSPECIFIED: 0, + AND: 1 + } + } +}; + +/** + * Overview of the modifications that occurred. + * + * @property {number} transformedBytes + * Total size in bytes that were transformed in some way. + * + * @property {Object[]} transformationSummaries + * Transformations applied to the dataset. + * + * This object should have the same structure as [TransformationSummary]{@link google.privacy.dlp.v2.TransformationSummary} + * + * @typedef TransformationOverview + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.TransformationOverview definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var TransformationOverview = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Summary of a single tranformation. + * Only one of 'transformation', 'field_transformation', or 'record_suppress' + * will be set. + * + * @property {Object} infoType + * Set if the transformation was limited to a specific info_type. + * + * This object should have the same structure as [InfoType]{@link google.privacy.dlp.v2.InfoType} + * + * @property {Object} field + * Set if the transformation was limited to a specific FieldId. + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @property {Object} transformation + * The specific transformation these stats apply to. + * + * This object should have the same structure as [PrimitiveTransformation]{@link google.privacy.dlp.v2.PrimitiveTransformation} + * + * @property {Object[]} fieldTransformations + * The field transformation that was applied. + * If multiple field transformations are requested for a single field, + * this list will contain all of them; otherwise, only one is supplied. + * + * This object should have the same structure as [FieldTransformation]{@link google.privacy.dlp.v2.FieldTransformation} + * + * @property {Object} recordSuppress + * The specific suppression option these stats apply to. + * + * This object should have the same structure as [RecordSuppression]{@link google.privacy.dlp.v2.RecordSuppression} + * + * @property {Object[]} results + * This object should have the same structure as [SummaryResult]{@link google.privacy.dlp.v2.SummaryResult} + * + * @property {number} transformedBytes + * Total size in bytes that were transformed in some way. + * + * @typedef TransformationSummary + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.TransformationSummary definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var TransformationSummary = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * A collection that informs the user the number of times a particular + * `TransformationResultCode` and error details occurred. + * + * @property {number} count + * + * @property {number} code + * The number should be among the values of [TransformationResultCode]{@link google.privacy.dlp.v2.TransformationResultCode} + * + * @property {string} details + * A place for warnings or errors to show up if a transformation didn't + * work as expected. + * + * @typedef SummaryResult + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.TransformationSummary.SummaryResult definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + SummaryResult: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * Possible outcomes of transformations. + * + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ + TransformationResultCode: { + TRANSFORMATION_RESULT_CODE_UNSPECIFIED: 0, + SUCCESS: 1, + ERROR: 2 + } +}; + +/** + * Schedule for triggeredJobs. + * + * @property {Object} recurrencePeriodDuration + * With this option a job is started a regular periodic basis. For + * example: every 10 minutes. + * + * A scheduled start time will be skipped if the previous + * execution has not ended when its scheduled time occurs. + * + * This value must be set to a time duration greater than or equal + * to 60 minutes and can be no longer than 60 days. + * + * This object should have the same structure as [Duration]{@link google.protobuf.Duration} + * + * @typedef Schedule + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Schedule definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var Schedule = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The inspectTemplate contains a configuration (set of types of sensitive data + * to be detected) to be used anywhere you otherwise would normally specify + * InspectConfig. + * + * @property {string} name + * The template name. Output only. + * + * The template will have one of the following formats: + * `projects/PROJECT_ID/inspectTemplates/TEMPLATE_ID` OR + * `organizations/ORGANIZATION_ID/inspectTemplates/TEMPLATE_ID` + * + * @property {string} displayName + * Display name (max 256 chars). + * + * @property {string} description + * Short description (max 256 chars). + * + * @property {Object} createTime + * The creation timestamp of a inspectTemplate, output only field. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {Object} updateTime + * The last update timestamp of a inspectTemplate, output only field. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {Object} inspectConfig + * The core content of the template. Configuration of the scanning process. + * + * This object should have the same structure as [InspectConfig]{@link google.privacy.dlp.v2.InspectConfig} + * + * @typedef InspectTemplate + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InspectTemplate definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var InspectTemplate = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The DeidentifyTemplates contains instructions on how to deidentify content. + * + * @property {string} name + * The template name. Output only. + * + * The template will have one of the following formats: + * `projects/PROJECT_ID/deidentifyTemplates/TEMPLATE_ID` OR + * `organizations/ORGANIZATION_ID/deidentifyTemplates/TEMPLATE_ID` + * + * @property {string} displayName + * Display name (max 256 chars). + * + * @property {string} description + * Short description (max 256 chars). + * + * @property {Object} createTime + * The creation timestamp of a inspectTemplate, output only field. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {Object} updateTime + * The last update timestamp of a inspectTemplate, output only field. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {Object} deidentifyConfig + * ///////////// // The core content of the template // /////////////// + * + * This object should have the same structure as [DeidentifyConfig]{@link google.privacy.dlp.v2.DeidentifyConfig} + * + * @typedef DeidentifyTemplate + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DeidentifyTemplate definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DeidentifyTemplate = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Details information about an error encountered during job execution or + * the results of an unsuccessful activation of the JobTrigger. + * Output only field. + * + * @property {Object} details + * This object should have the same structure as [Status]{@link google.rpc.Status} + * + * @property {Object[]} timestamps + * The times the error occurred. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @typedef Error + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Error definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var Error = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Contains a configuration to make dlp api calls on a repeating basis. + * + * @property {string} name + * Unique resource name for the triggeredJob, assigned by the service when the + * triggeredJob is created, for example + * `projects/dlp-test-project/triggeredJobs/53234423`. + * + * @property {string} displayName + * Display name (max 100 chars) + * + * @property {string} description + * User provided description (max 256 chars) + * + * @property {Object} inspectJob + * This object should have the same structure as [InspectJobConfig]{@link google.privacy.dlp.v2.InspectJobConfig} + * + * @property {Object[]} triggers + * A list of triggers which will be OR'ed together. Only one in the list + * needs to trigger for a job to be started. The list may contain only + * a single Schedule trigger and must have at least one object. + * + * This object should have the same structure as [Trigger]{@link google.privacy.dlp.v2.Trigger} + * + * @property {Object[]} errors + * A stream of errors encountered when the trigger was activated. Repeated + * errors may result in the JobTrigger automaticaly being paused. + * Will return the last 100 errors. Whenever the JobTrigger is modified + * this list will be cleared. Output only field. + * + * This object should have the same structure as [Error]{@link google.privacy.dlp.v2.Error} + * + * @property {Object} createTime + * The creation timestamp of a triggeredJob, output only field. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {Object} updateTime + * The last update timestamp of a triggeredJob, output only field. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {Object} lastRunTime + * The timestamp of the last time this trigger executed, output only field. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {number} status + * A status for this trigger. [required] + * + * The number should be among the values of [Status]{@link google.privacy.dlp.v2.Status} + * + * @typedef JobTrigger + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.JobTrigger definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var JobTrigger = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * What event needs to occur for a new job to be started. + * + * @property {Object} schedule + * Create a job on a repeating basis based on the elapse of time. + * + * This object should have the same structure as [Schedule]{@link google.privacy.dlp.v2.Schedule} + * + * @typedef Trigger + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.JobTrigger.Trigger definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + Trigger: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * Whether the trigger is currently active. If PAUSED or CANCELLED, no jobs + * will be created with this configuration. The service may automatically + * pause triggers experiencing frequent errors. To restart a job, set the + * status to HEALTHY after correcting user errors. + * + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ + Status: { + STATUS_UNSPECIFIED: 0, + + /** + * Trigger is healthy. + */ + HEALTHY: 1, + + /** + * Trigger is temporarily paused. + */ + PAUSED: 2, + + /** + * Trigger is cancelled and can not be resumed. + */ + CANCELLED: 3 + } +}; + +/** + * A task to execute on the completion of a job. + * + * @property {Object} saveFindings + * Save resulting findings in a provided location. + * + * This object should have the same structure as [SaveFindings]{@link google.privacy.dlp.v2.SaveFindings} + * + * @property {Object} pubSub + * Publish a notification to a pubsub topic. + * + * This object should have the same structure as [PublishToPubSub]{@link google.privacy.dlp.v2.PublishToPubSub} + * + * @typedef Action + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Action definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var Action = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * If set, the detailed findings will be persisted to the specified + * OutputStorageConfig. Compatible with: Inspect + * + * @property {Object} outputConfig + * This object should have the same structure as [OutputStorageConfig]{@link google.privacy.dlp.v2.OutputStorageConfig} + * + * @typedef SaveFindings + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Action.SaveFindings definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + SaveFindings: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * Publish the results of a DlpJob to a pub sub channel. + * Compatible with: Inpect, Risk + * + * @property {string} topic + * Cloud Pub/Sub topic to send notifications to. The topic must have given + * publishing access rights to the DLP API service account executing + * the long running DlpJob sending the notifications. + * Format is projects/{project}/topics/{topic}. + * + * @typedef PublishToPubSub + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Action.PublishToPubSub definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ + PublishToPubSub: { + // This is for documentation. Actual contents will be loaded by gRPC. + } +}; + +/** + * Request message for CreateInspectTemplate. + * + * @property {string} parent + * The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * + * @property {Object} inspectTemplate + * The InspectTemplate to create. + * + * This object should have the same structure as [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate} + * + * @property {string} templateId + * The template 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 CreateInspectTemplateRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CreateInspectTemplateRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var CreateInspectTemplateRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for UpdateInspectTemplate. + * + * @property {string} name + * Resource name of organization and inspectTemplate to be updated, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + * + * @property {Object} inspectTemplate + * New InspectTemplate value. + * + * This object should have the same structure as [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate} + * + * @property {Object} updateMask + * Mask to control which fields get updated. + * + * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} + * + * @typedef UpdateInspectTemplateRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.UpdateInspectTemplateRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var UpdateInspectTemplateRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for GetInspectTemplate. + * + * @property {string} name + * Resource name of the organization and inspectTemplate to be read, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + * + * @typedef GetInspectTemplateRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.GetInspectTemplateRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var GetInspectTemplateRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for ListInspectTemplates. + * + * @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 `ListInspectTemplates`. + * + * @property {number} pageSize + * Optional size of the page, can be limited by server. If zero server returns + * a page of max size 100. + * + * @typedef ListInspectTemplatesRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ListInspectTemplatesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ListInspectTemplatesRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Response message for ListInspectTemplates. + * + * @property {Object[]} inspectTemplates + * List of inspectTemplates, up to page_size in ListInspectTemplatesRequest. + * + * This object should have the same structure as [InspectTemplate]{@link google.privacy.dlp.v2.InspectTemplate} + * + * @property {string} nextPageToken + * If the next page is available then the next page token to be used + * in following ListInspectTemplates request. + * + * @typedef ListInspectTemplatesResponse + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ListInspectTemplatesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ListInspectTemplatesResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for DeleteInspectTemplate. + * + * @property {string} name + * Resource name of the organization and inspectTemplate to be deleted, for + * example `organizations/433245324/inspectTemplates/432452342` or + * projects/project-id/inspectTemplates/432452342. + * + * @typedef DeleteInspectTemplateRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DeleteInspectTemplateRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DeleteInspectTemplateRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for CreateJobTrigger. + * + * @property {string} parent + * The parent resource name, for example projects/my-project-id. + * + * @property {Object} jobTrigger + * The JobTrigger to create. + * + * This object should have the same structure as [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger} + * + * @property {string} triggerId + * The trigger 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 CreateJobTriggerRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CreateJobTriggerRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var CreateJobTriggerRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for UpdateJobTrigger. + * + * @property {string} name + * Resource name of the project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + * + * @property {Object} jobTrigger + * New JobTrigger value. + * + * This object should have the same structure as [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger} + * + * @property {Object} updateMask + * Mask to control which fields get updated. + * + * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} + * + * @typedef UpdateJobTriggerRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.UpdateJobTriggerRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var UpdateJobTriggerRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for GetJobTrigger. + * + * @property {string} name + * Resource name of the project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + * + * @typedef GetJobTriggerRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.GetJobTriggerRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var GetJobTriggerRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for CreateDlpJobRequest. Used to initiate long running + * jobs such as calculating risk metrics or inspecting Google Cloud + * Storage. + * + * @property {string} parent + * The parent resource name, for example projects/my-project-id. + * + * @property {Object} inspectJob + * This object should have the same structure as [InspectJobConfig]{@link google.privacy.dlp.v2.InspectJobConfig} + * + * @property {Object} riskJob + * This object should have the same structure as [RiskAnalysisJobConfig]{@link google.privacy.dlp.v2.RiskAnalysisJobConfig} + * + * @property {string} jobId + * The job 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 CreateDlpJobRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CreateDlpJobRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var CreateDlpJobRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for ListJobTriggers. + * + * @property {string} parent + * The parent resource name, for example projects/my-project-id. + * + * @property {string} pageToken + * Optional page token to continue retrieval. Comes from previous call + * to ListJobTriggers. `order_by` and `filter` should not change for + * subsequent calls, but can be omitted if token is specified. + * + * @property {number} pageSize + * Optional size of the page, can be limited by a server. + * + * @property {string} orderBy + * Optional comma separated list of triggeredJob fields to order by, + * followed by 'asc/desc' postfix, i.e. + * `"create_time asc,name desc,schedule_mode asc"`. This list is + * case-insensitive. + * + * Example: `"name asc,schedule_mode desc, status desc"` + * + * Supported filters keys and values are: + * + * - `create_time`: corresponds to time the triggeredJob was created. + * - `update_time`: corresponds to time the triggeredJob was last updated. + * - `name`: corresponds to JobTrigger's display name. + * - `status`: corresponds to the triggeredJob status. + * + * @typedef ListJobTriggersRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ListJobTriggersRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ListJobTriggersRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Response message for ListJobTriggers. + * + * @property {Object[]} jobTriggers + * List of triggeredJobs, up to page_size in ListJobTriggersRequest. + * + * This object should have the same structure as [JobTrigger]{@link google.privacy.dlp.v2.JobTrigger} + * + * @property {string} nextPageToken + * If the next page is available then the next page token to be used + * in following ListJobTriggers request. + * + * @typedef ListJobTriggersResponse + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ListJobTriggersResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ListJobTriggersResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for DeleteJobTrigger. + * + * @property {string} name + * Resource name of the project and the triggeredJob, for example + * `projects/dlp-test-project/jobTriggers/53234423`. + * + * @typedef DeleteJobTriggerRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DeleteJobTriggerRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DeleteJobTriggerRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * @property {Object} storageConfig + * The data to scan. + * + * This object should have the same structure as [StorageConfig]{@link google.privacy.dlp.v2.StorageConfig} + * + * @property {Object} inspectConfig + * How and what to scan for. + * + * This object should have the same structure as [InspectConfig]{@link google.privacy.dlp.v2.InspectConfig} + * + * @property {string} inspectTemplateName + * If provided, will be used as the default for all values in InspectConfig. + * `inspect_config` will be merged into the values persisted as part of the + * template. + * + * @property {Object[]} actions + * Actions to execute at the completion of the job. Are executed in the order + * provided. + * + * This object should have the same structure as [Action]{@link google.privacy.dlp.v2.Action} + * + * @typedef InspectJobConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InspectJobConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var InspectJobConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Combines all of the information about a DLP job. + * + * @property {string} name + * The server-assigned name. + * + * @property {number} type + * The type of job. + * + * The number should be among the values of [DlpJobType]{@link google.privacy.dlp.v2.DlpJobType} + * + * @property {number} state + * State of a job. + * + * The number should be among the values of [JobState]{@link google.privacy.dlp.v2.JobState} + * + * @property {Object} riskDetails + * Results from analyzing risk of a data source. + * + * This object should have the same structure as [AnalyzeDataSourceRiskDetails]{@link google.privacy.dlp.v2.AnalyzeDataSourceRiskDetails} + * + * @property {Object} inspectDetails + * Results from inspecting a data source. + * + * This object should have the same structure as [InspectDataSourceDetails]{@link google.privacy.dlp.v2.InspectDataSourceDetails} + * + * @property {Object} createTime + * Time when the job was created. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {Object} startTime + * Time when the job started. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {Object} endTime + * Time when the job finished. + * + * This object should have the same structure as [Timestamp]{@link google.protobuf.Timestamp} + * + * @property {string} jobTriggerName + * If created by a job trigger, the resource name of the trigger that + * instantiated the job. + * + * @property {Object[]} errors + * A stream of errors encountered running the job. + * + * This object should have the same structure as [Error]{@link google.privacy.dlp.v2.Error} + * + * @typedef DlpJob + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DlpJob definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DlpJob = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ + JobState: { + JOB_STATE_UNSPECIFIED: 0, + + /** + * The job has not yet started. + */ + PENDING: 1, + + /** + * The job is currently running. + */ + RUNNING: 2, + + /** + * The job is no longer running. + */ + DONE: 3, + + /** + * The job was canceled before it could complete. + */ + CANCELED: 4, + + /** + * The job had an error and did not complete. + */ + FAILED: 5 + } +}; + +/** + * The request message for DlpJobs.GetDlpJob. + * + * @property {string} name + * The name of the DlpJob resource. + * + * @typedef GetDlpJobRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.GetDlpJobRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var GetDlpJobRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The request message for listing DLP jobs. + * + * @property {string} parent + * The parent resource name, for example projects/my-project-id. + * + * @property {string} filter + * Optional. Allows filtering. + * + * Supported syntax: + * + * * Filter expressions are made up of one or more restrictions. + * * Restrictions can be combined by `AND` or `OR` logical operators. A + * sequence of restrictions implicitly uses `AND`. + * * A restriction has the form of ` `. + * * Supported fields/values for inspect jobs: + * - `state` - PENDING|RUNNING|CANCELED|FINISHED|FAILED + * - `inspected_storage` - DATASTORE|CLOUD_STORAGE|BIGQUERY + * - `trigger_name` - The resource name of the trigger that created job. + * * Supported fields for risk analysis jobs: + * - `state` - RUNNING|CANCELED|FINISHED|FAILED + * * The operator must be `=` or `!=`. + * + * Examples: + * + * * inspected_storage = cloud_storage AND state = done + * * inspected_storage = cloud_storage OR inspected_storage = bigquery + * * inspected_storage = cloud_storage AND (state = done OR state = canceled) + * + * The length of this field should be no more than 500 characters. + * + * @property {number} pageSize + * The standard list page size. + * + * @property {string} pageToken + * The standard list page token. + * + * @property {number} type + * The type of job. Defaults to `DlpJobType.INSPECT` + * + * The number should be among the values of [DlpJobType]{@link google.privacy.dlp.v2.DlpJobType} + * + * @typedef ListDlpJobsRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ListDlpJobsRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ListDlpJobsRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The response message for listing DLP jobs. + * + * @property {Object[]} jobs + * A list of DlpJobs that matches the specified filter in the request. + * + * This object should have the same structure as [DlpJob]{@link google.privacy.dlp.v2.DlpJob} + * + * @property {string} nextPageToken + * The standard List next-page token. + * + * @typedef ListDlpJobsResponse + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ListDlpJobsResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ListDlpJobsResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The request message for canceling a DLP job. + * + * @property {string} name + * The name of the DlpJob resource to be cancelled. + * + * @typedef CancelDlpJobRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CancelDlpJobRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var CancelDlpJobRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * The request message for deleting a DLP job. + * + * @property {string} name + * The name of the DlpJob resource to be deleted. + * + * @typedef DeleteDlpJobRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DeleteDlpJobRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DeleteDlpJobRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for CreateDeidentifyTemplate. + * + * @property {string} parent + * The parent resource name, for example projects/my-project-id or + * organizations/my-org-id. + * + * @property {Object} deidentifyTemplate + * The DeidentifyTemplate to create. + * + * This object should have the same structure as [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate} + * + * @property {string} templateId + * The template 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 CreateDeidentifyTemplateRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CreateDeidentifyTemplateRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var CreateDeidentifyTemplateRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for UpdateDeidentifyTemplate. + * + * @property {string} name + * Resource name of organization and deidentify template to be updated, for + * example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + * + * @property {Object} deidentifyTemplate + * New DeidentifyTemplate value. + * + * This object should have the same structure as [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate} + * + * @property {Object} updateMask + * Mask to control which fields get updated. + * + * This object should have the same structure as [FieldMask]{@link google.protobuf.FieldMask} + * + * @typedef UpdateDeidentifyTemplateRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.UpdateDeidentifyTemplateRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var UpdateDeidentifyTemplateRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for GetDeidentifyTemplate. + * + * @property {string} name + * Resource name of the organization and deidentify template to be read, for + * example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + * + * @typedef GetDeidentifyTemplateRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.GetDeidentifyTemplateRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var GetDeidentifyTemplateRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for ListDeidentifyTemplates. + * + * @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 `ListDeidentifyTemplates`. + * + * @property {number} pageSize + * Optional size of the page, can be limited by server. If zero server returns + * a page of max size 100. + * + * @typedef ListDeidentifyTemplatesRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ListDeidentifyTemplatesRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ListDeidentifyTemplatesRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Response message for ListDeidentifyTemplates. + * + * @property {Object[]} deidentifyTemplates + * List of deidentify templates, up to page_size in + * ListDeidentifyTemplatesRequest. + * + * This object should have the same structure as [DeidentifyTemplate]{@link google.privacy.dlp.v2.DeidentifyTemplate} + * + * @property {string} nextPageToken + * If the next page is available then the next page token to be used + * in following ListDeidentifyTemplates request. + * + * @typedef ListDeidentifyTemplatesResponse + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.ListDeidentifyTemplatesResponse definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var ListDeidentifyTemplatesResponse = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Request message for DeleteDeidentifyTemplate. + * + * @property {string} name + * Resource name of the organization and deidentify template to be deleted, + * for example `organizations/433245324/deidentifyTemplates/432452342` or + * projects/project-id/deidentifyTemplates/432452342. + * + * @typedef DeleteDeidentifyTemplateRequest + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DeleteDeidentifyTemplateRequest definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/dlp.proto} + */ +var DeleteDeidentifyTemplateRequest = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Options describing which parts of the provided content should be scanned. + * + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ +var ContentOption = { + + /** + * Includes entire content of a file or a data stream. + */ + CONTENT_UNSPECIFIED: 0, + + /** + * Text content within the data, excluding any metadata. + */ + CONTENT_TEXT: 1, + + /** + * Images found in the data. + */ + CONTENT_IMAGE: 2 +}; + +/** + * Parts of the APIs which use certain infoTypes. + * + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ +var InfoTypeSupportedBy = { + ENUM_TYPE_UNSPECIFIED: 0, + + /** + * Supported by the inspect operations. + */ + INSPECT: 1, + + /** + * Supported by the risk analysis operations. + */ + RISK_ANALYSIS: 2 +}; + +/** + * Operators available for comparing the value of fields. + * + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ +var RelationalOperator = { + RELATIONAL_OPERATOR_UNSPECIFIED: 0, + + /** + * Equal. + */ + EQUAL_TO: 1, + + /** + * Not equal to. + */ + NOT_EQUAL_TO: 2, + + /** + * Greater than. + */ + GREATER_THAN: 3, + + /** + * Less than. + */ + LESS_THAN: 4, + + /** + * Greater than or equals. + */ + GREATER_THAN_OR_EQUALS: 5, + + /** + * Less than or equals. + */ + LESS_THAN_OR_EQUALS: 6, + + /** + * Exists + */ + EXISTS: 7 +}; + +/** + * An enum to represent the various type of DLP jobs. + * + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ +var DlpJobType = { + DLP_JOB_TYPE_UNSPECIFIED: 0, + + /** + * The job inspected Google Cloud for sensitive data. + */ + INSPECT_JOB: 1, + + /** + * The job executed a Risk Analysis computation. + */ + RISK_ANALYSIS_JOB: 2 +}; \ 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 new file mode 100644 index 00000000000..e723ee944b0 --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/doc/google/privacy/dlp/v2/doc_storage.js @@ -0,0 +1,627 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * Type of information detected by the API. + * + * @property {string} name + * Name of the information type. + * + * @typedef InfoType + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.InfoType definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var InfoType = { + // 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. + * + * @property {Object} infoType + * Info type configuration. All custom info types must have configurations + * that do not conflict with built-in info types or other custom info types. + * + * This object should have the same structure as [InfoType]{@link google.privacy.dlp.v2.InfoType} + * + * @property {number} likelihood + * Likelihood to return for this custom info type. This base value can be + * altered by a detection rule if the finding meets the criteria specified by + * the rule. Defaults to `VERY_LIKELY` if not specified. + * + * The number should be among the values of [Likelihood]{@link google.privacy.dlp.v2.Likelihood} + * + * @property {Object} dictionary + * Dictionary-based custom info type. + * + * This object should have the same structure as [Dictionary]{@link google.privacy.dlp.v2.Dictionary} + * + * @property {Object} regex + * Regex-based custom info type. + * + * This object should have the same structure as [Regex]{@link google.privacy.dlp.v2.Regex} + * + * @property {Object} surrogateType + * Surrogate info type. + * + * This object should have the same structure as [SurrogateType]{@link google.privacy.dlp.v2.SurrogateType} + * + * @property {Object[]} detectionRules + * Set of detection rules to apply to all findings of this custom info type. + * Rules are applied in order that they are specified. Not supported for the + * `surrogate_type` custom info type. + * + * This object should have the same structure as [DetectionRule]{@link google.privacy.dlp.v2.DetectionRule} + * + * @typedef CustomInfoType + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CustomInfoType definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var CustomInfoType = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * Custom information type based on a dictionary of words or phrases. This can + * be used to match sensitive information specific to the data, such as a list + * of employee IDs or job titles. + * + * Dictionary words are case-insensitive and all characters other than letters + * and digits in the unicode [Basic Multilingual + * Plane](https://en.wikipedia.org/wiki/Plane_%28Unicode%29#Basic_Multilingual_Plane) + * will be replaced with whitespace when scanning for matches, so the + * dictionary phrase "Sam Johnson" will match all three phrases "sam johnson", + * "Sam, Johnson", and "Sam (Johnson)". Additionally, the characters + * surrounding any match must be of a different type than the adjacent + * characters within the word, so letters must be next to non-letters and + * digits next to non-digits. For example, the dictionary word "jen" will + * match the first three letters of the text "jen123" but will return no + * matches for "jennifer". + * + * 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. + * + * @property {Object} wordList + * List of words or phrases to search for. + * + * This object should have the same structure as [WordList]{@link google.privacy.dlp.v2.WordList} + * + * @typedef Dictionary + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CustomInfoType.Dictionary definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ + Dictionary: { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * Message defining a list of words or phrases to search for in the data. + * + * @property {string[]} words + * Words or phrases defining the dictionary. The dictionary must contain + * at least one phrase and every phrase must contain at least 2 characters + * that are letters or digits. [required] + * + * @typedef WordList + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CustomInfoType.Dictionary.WordList definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ + WordList: { + // This is for documentation. Actual contents will be loaded by gRPC. + } + }, + + /** + * Message defining a custom regular expression. + * + * @property {string} pattern + * Pattern defining the regular expression. + * + * @typedef Regex + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CustomInfoType.Regex definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ + Regex: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * Message for detecting output from deidentification transformations + * such as + * [`CryptoReplaceFfxFpeConfig`](https://cloud.google.com/dlp/docs/reference/rest/v2/content/deidentify#CryptoReplaceFfxFpeConfig). + * These types of transformations are + * those that perform pseudonymization, thereby producing a "surrogate" as + * output. This should be used in conjunction with a field on the + * transformation such as `surrogate_info_type`. This custom info type does + * not support the use of `detection_rules`. + * @typedef SurrogateType + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CustomInfoType.SurrogateType definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ + SurrogateType: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * Rule for modifying a custom info type to alter behavior under certain + * circumstances, depending on the specific details of the rule. Not supported + * for the `surrogate_type` custom info type. + * + * @property {Object} hotwordRule + * Hotword-based detection rule. + * + * This object should have the same structure as [HotwordRule]{@link google.privacy.dlp.v2.HotwordRule} + * + * @typedef DetectionRule + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CustomInfoType.DetectionRule definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ + DetectionRule: { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * Message for specifying a window around a finding to apply a detection + * rule. + * + * @property {number} windowBefore + * Number of characters before the finding to consider. + * + * @property {number} windowAfter + * Number of characters after the finding to consider. + * + * @typedef Proximity + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CustomInfoType.DetectionRule.Proximity definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ + Proximity: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * Message for specifying an adjustment to the likelihood of a finding as + * part of a detection rule. + * + * @property {number} fixedLikelihood + * Set the likelihood of a finding to a fixed value. + * + * The number should be among the values of [Likelihood]{@link google.privacy.dlp.v2.Likelihood} + * + * @property {number} relativeLikelihood + * Increase or decrease the likelihood by the specified number of + * levels. For example, if a finding would be `POSSIBLE` without the + * detection rule and `relative_likelihood` is 1, then it is upgraded to + * `LIKELY`, while a value of -1 would downgrade it to `UNLIKELY`. + * Likelihood may never drop below `VERY_UNLIKELY` or exceed + * `VERY_LIKELY`, so applying an adjustment of 1 followed by an + * adjustment of -1 when base likelihood is `VERY_LIKELY` will result in + * a final likelihood of `LIKELY`. + * + * @typedef LikelihoodAdjustment + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CustomInfoType.DetectionRule.LikelihoodAdjustment definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ + LikelihoodAdjustment: { + // This is for documentation. Actual contents will be loaded by gRPC. + }, + + /** + * Detection rule that adjusts the likelihood of findings within a certain + * proximity of hotwords. + * + * @property {Object} hotwordRegex + * Regex pattern defining what qualifies as a hotword. + * + * This object should have the same structure as [Regex]{@link google.privacy.dlp.v2.Regex} + * + * @property {Object} proximity + * Proximity of the finding within which the entire hotword must reside. + * The total length of the window cannot exceed 1000 characters. Note that + * the finding itself will be included in the window, so that hotwords may + * be used to match substrings of the finding itself. For example, the + * certainty of a phone number regex "\(\d{3}\) \d{3}-\d{4}" could be + * adjusted upwards if the area code is known to be the local area code of + * a company office using the hotword regex "\(xxx\)", where "xxx" + * is the area code in question. + * + * This object should have the same structure as [Proximity]{@link google.privacy.dlp.v2.Proximity} + * + * @property {Object} likelihoodAdjustment + * Likelihood adjustment to apply to all matching findings. + * + * This object should have the same structure as [LikelihoodAdjustment]{@link google.privacy.dlp.v2.LikelihoodAdjustment} + * + * @typedef HotwordRule + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CustomInfoType.DetectionRule.HotwordRule definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ + HotwordRule: { + // This is for documentation. Actual contents will be loaded by gRPC. + } + } +}; + +/** + * General identifier of a data field in a storage service. + * + * @property {string} name + * Name describing the field. + * + * @typedef FieldId + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.FieldId definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var FieldId = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Datastore partition ID. + * A partition ID identifies a grouping of entities. The grouping is always + * by project and namespace, however the namespace ID may be empty. + * + * A partition ID contains several dimensions: + * project ID and namespace ID. + * + * @property {string} projectId + * The ID of the project to which the entities belong. + * + * @property {string} namespaceId + * If not empty, the ID of the namespace to which the entities belong. + * + * @typedef PartitionId + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.PartitionId definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var PartitionId = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A representation of a Datastore kind. + * + * @property {string} name + * The name of the kind. + * + * @typedef KindExpression + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.KindExpression definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var KindExpression = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Options defining a data set within Google Cloud Datastore. + * + * @property {Object} partitionId + * A partition ID identifies a grouping of entities. The grouping is always + * by project and namespace, however the namespace ID may be empty. + * + * This object should have the same structure as [PartitionId]{@link google.privacy.dlp.v2.PartitionId} + * + * @property {Object} kind + * The kind to process. + * + * This object should have the same structure as [KindExpression]{@link google.privacy.dlp.v2.KindExpression} + * + * @typedef DatastoreOptions + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DatastoreOptions definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var DatastoreOptions = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Options defining a file or a set of files (path ending with *) within + * a Google Cloud Storage bucket. + * + * @property {Object} fileSet + * This object should have the same structure as [FileSet]{@link google.privacy.dlp.v2.FileSet} + * + * @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. + * + * @typedef CloudStorageOptions + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CloudStorageOptions definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var CloudStorageOptions = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * Set of files to scan. + * + * @property {string} url + * The url, in the format `gs:///`. Trailing wildcard in the + * path is allowed. + * + * @typedef FileSet + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.CloudStorageOptions.FileSet definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ + FileSet: { + // This is for documentation. Actual contents will be loaded by gRPC. + } +}; + +/** + * Options defining BigQuery table and row identifiers. + * + * @property {Object} tableReference + * Complete BigQuery table reference. + * + * This object should have the same structure as [BigQueryTable]{@link google.privacy.dlp.v2.BigQueryTable} + * + * @property {Object[]} identifyingFields + * References to fields uniquely identifying rows within the table. + * Nested fields in the format, like `person.birthdate.year`, are allowed. + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @typedef BigQueryOptions + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.BigQueryOptions definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var BigQueryOptions = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Shared message indicating Cloud storage type. + * + * @property {Object} datastoreOptions + * Google Cloud Datastore options specification. + * + * This object should have the same structure as [DatastoreOptions]{@link google.privacy.dlp.v2.DatastoreOptions} + * + * @property {Object} cloudStorageOptions + * Google Cloud Storage options specification. + * + * This object should have the same structure as [CloudStorageOptions]{@link google.privacy.dlp.v2.CloudStorageOptions} + * + * @property {Object} bigQueryOptions + * BigQuery options specification. + * + * This object should have the same structure as [BigQueryOptions]{@link google.privacy.dlp.v2.BigQueryOptions} + * + * @property {Object} timespanConfig + * This object should have the same structure as [TimespanConfig]{@link google.privacy.dlp.v2.TimespanConfig} + * + * @typedef StorageConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.StorageConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var StorageConfig = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * Configuration of the timespan of the items to include in scanning. + * Currently only supported when inspecting Google Cloud Storage and BigQuery. + * + * @property {Object} startTime + * Exclude files 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. + * 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. + * The valid data types of the timestamp field are: + * for BigQuery - timestamp, date, datetime; + * for Datastore - timestamp. + * Datastore entity will be scanned if the timestamp property does not exist + * or its value is empty or invalid. + * + * This object should have the same structure as [FieldId]{@link google.privacy.dlp.v2.FieldId} + * + * @property {boolean} enableAutoPopulationOfTimespanConfig + * When the job is started by a JobTrigger we will automatically figure out + * a valid start_time to avoid scanning files that have not been modified + * since the last time the JobTrigger executed. This will be based on the + * time of the execution of the last run of the JobTrigger. + * + * @typedef TimespanConfig + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.StorageConfig.TimespanConfig definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ + TimespanConfig: { + // This is for documentation. Actual contents will be loaded by gRPC. + } +}; + +/** + * Row key for identifying a record in BigQuery table. + * + * @property {Object} tableReference + * Complete BigQuery table reference. + * + * This object should have the same structure as [BigQueryTable]{@link google.privacy.dlp.v2.BigQueryTable} + * + * @property {number} rowNumber + * Absolute number of the row from the beginning of the table at the time + * of scanning. + * + * @typedef BigQueryKey + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.BigQueryKey definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var BigQueryKey = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Record key for a finding in Cloud Datastore. + * + * @property {Object} entityKey + * Datastore entity key. + * + * This object should have the same structure as [Key]{@link google.privacy.dlp.v2.Key} + * + * @typedef DatastoreKey + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.DatastoreKey definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var DatastoreKey = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * A unique identifier for a Datastore entity. + * If a key's partition ID or any of its path kinds or names are + * reserved/read-only, the key is reserved/read-only. + * A reserved/read-only key is forbidden in certain documented contexts. + * + * @property {Object} partitionId + * Entities are partitioned into subsets, currently identified by a project + * ID and namespace ID. + * Queries are scoped to a single partition. + * + * This object should have the same structure as [PartitionId]{@link google.privacy.dlp.v2.PartitionId} + * + * @property {Object[]} path + * The entity path. + * An entity path consists of one or more elements composed of a kind and a + * string or numerical identifier, which identify entities. The first + * element identifies a _root entity_, the second element identifies + * a _child_ of the root entity, the third element identifies a child of the + * second entity, and so forth. The entities identified by all prefixes of + * the path are called the element's _ancestors_. + * + * A path can never be empty, and a path can have at most 100 elements. + * + * This object should have the same structure as [PathElement]{@link google.privacy.dlp.v2.PathElement} + * + * @typedef Key + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Key definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var Key = { + // This is for documentation. Actual contents will be loaded by gRPC. + + /** + * A (kind, ID/name) pair used to construct a key path. + * + * If either name or ID is set, the element is complete. + * If neither is set, the element is incomplete. + * + * @property {string} kind + * The kind of the entity. + * A kind matching regex `__.*__` is reserved/read-only. + * A kind must not contain more than 1500 bytes when UTF-8 encoded. + * Cannot be `""`. + * + * @property {number} id + * The auto-allocated ID of the entity. + * Never equal to zero. Values less than zero are discouraged and may not + * be supported in the future. + * + * @property {string} name + * The name of the entity. + * A name matching regex `__.*__` is reserved/read-only. + * A name must not be more than 1500 bytes when UTF-8 encoded. + * Cannot be `""`. + * + * @typedef PathElement + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.Key.PathElement definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ + PathElement: { + // This is for documentation. Actual contents will be loaded by gRPC. + } +}; + +/** + * Message for a unique key indicating a record that contains a finding. + * + * @property {Object} datastoreKey + * This object should have the same structure as [DatastoreKey]{@link google.privacy.dlp.v2.DatastoreKey} + * + * @property {Object} bigQueryKey + * This object should have the same structure as [BigQueryKey]{@link google.privacy.dlp.v2.BigQueryKey} + * + * @typedef RecordKey + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.RecordKey definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var RecordKey = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Message defining the location of a BigQuery table. A table is uniquely + * identified by its project_id, dataset_id, and table_name. Within a query + * a table is often referenced with a string in the format of: + * `:.` or + * `..`. + * + * @property {string} projectId + * The Google Cloud Platform project ID of the project containing the table. + * If omitted, project ID is inferred from the API call. + * + * @property {string} datasetId + * Dataset ID of the table. + * + * @property {string} tableId + * Name of the table. + * + * @typedef BigQueryTable + * @memberof google.privacy.dlp.v2 + * @see [google.privacy.dlp.v2.BigQueryTable definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2/storage.proto} + */ +var BigQueryTable = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; + +/** + * Categorization of results based on how likely they are to represent a match, + * based on the number of elements they contain which imply a match. + * + * @enum {number} + * @memberof google.privacy.dlp.v2 + */ +var Likelihood = { + + /** + * Default value; information with all likelihoods is included. + */ + LIKELIHOOD_UNSPECIFIED: 0, + + /** + * Few matching elements. + */ + VERY_UNLIKELY: 1, + UNLIKELY: 2, + + /** + * Some matching elements. + */ + POSSIBLE: 3, + LIKELY: 4, + + /** + * Many matching elements. + */ + VERY_LIKELY: 5 +}; \ No newline at end of file diff --git a/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_any.js b/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_any.js new file mode 100644 index 00000000000..f55fa17ff12 --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_any.js @@ -0,0 +1,131 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * + * # JSON + * + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message google.protobuf.Duration): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + * + * @property {string} typeUrl + * A URL/resource name whose content describes the type of the + * serialized protocol buffer message. + * + * For URLs which use the scheme `http`, `https`, or no scheme, the + * following restrictions and interpretations apply: + * + * * If no scheme is provided, `https` is assumed. + * * The last segment of the URL's path must represent the fully + * qualified name of the type (as in `path/google.protobuf.Duration`). + * The name should be in a canonical form (e.g., leading "." is + * not accepted). + * * An HTTP GET on the URL must yield a google.protobuf.Type + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + * + * @property {string} value + * Must be a valid serialized protocol buffer of the above specified type. + * + * @typedef Any + * @memberof google.protobuf + * @see [google.protobuf.Any definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/any.proto} + */ +var Any = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_duration.js b/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_duration.js new file mode 100644 index 00000000000..3ea5c376abb --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_duration.js @@ -0,0 +1,97 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (durations.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + * + * @property {number} seconds + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + * + * @property {number} nanos + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + * + * @typedef Duration + * @memberof google.protobuf + * @see [google.protobuf.Duration definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/duration.proto} + */ +var Duration = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_empty.js b/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_empty.js new file mode 100644 index 00000000000..5e3640e90d8 --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_empty.js @@ -0,0 +1,34 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * A generic empty message that you can re-use to avoid defining duplicated + * empty messages in your APIs. A typical example is to use it as the request + * or the response type of an API method. For instance: + * + * service Foo { + * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + * } + * + * The JSON representation for `Empty` is empty JSON object `{}`. + * @typedef Empty + * @memberof google.protobuf + * @see [google.protobuf.Empty definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/empty.proto} + */ +var Empty = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_field_mask.js b/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_field_mask.js new file mode 100644 index 00000000000..c82c2b33949 --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_field_mask.js @@ -0,0 +1,230 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * `FieldMask` represents a set of symbolic field paths, for example: + * + * paths: "f.a" + * paths: "f.b.d" + * + * Here `f` represents a field in some root message, `a` and `b` + * fields in the message found in `f`, and `d` a field found in the + * message in `f.b`. + * + * Field masks are used to specify a subset of fields that should be + * returned by a get operation or modified by an update operation. + * Field masks also have a custom JSON encoding (see below). + * + * # Field Masks in Projections + * + * When used in the context of a projection, a response message or + * sub-message is filtered by the API to only contain those fields as + * specified in the mask. For example, if the mask in the previous + * example is applied to a response message as follows: + * + * f { + * a : 22 + * b { + * d : 1 + * x : 2 + * } + * y : 13 + * } + * z: 8 + * + * The result will not contain specific values for fields x,y and z + * (their value will be set to the default, and omitted in proto text + * output): + * + * + * f { + * a : 22 + * b { + * d : 1 + * } + * } + * + * A repeated field is not allowed except at the last position of a + * paths string. + * + * If a FieldMask object is not present in a get operation, the + * operation applies to all fields (as if a FieldMask of all fields + * had been specified). + * + * Note that a field mask does not necessarily apply to the + * top-level response message. In case of a REST get operation, the + * field mask applies directly to the response, but in case of a REST + * list operation, the mask instead applies to each individual message + * in the returned resource list. In case of a REST custom method, + * other definitions may be used. Where the mask applies will be + * clearly documented together with its declaration in the API. In + * any case, the effect on the returned resource/resources is required + * behavior for APIs. + * + * # Field Masks in Update Operations + * + * A field mask in update operations specifies which fields of the + * targeted resource are going to be updated. The API is required + * to only change the values of the fields as specified in the mask + * and leave the others untouched. If a resource is passed in to + * describe the updated values, the API ignores the values of all + * fields not covered by the mask. + * + * If a repeated field is specified for an update operation, the existing + * repeated values in the target resource will be overwritten by the new values. + * Note that a repeated field is only allowed in the last position of a `paths` + * string. + * + * If a sub-message is specified in the last position of the field mask for an + * update operation, then the existing sub-message in the target resource is + * overwritten. Given the target message: + * + * f { + * b { + * d : 1 + * x : 2 + * } + * c : 1 + * } + * + * And an update message: + * + * f { + * b { + * d : 10 + * } + * } + * + * then if the field mask is: + * + * paths: "f.b" + * + * then the result will be: + * + * f { + * b { + * d : 10 + * } + * c : 1 + * } + * + * However, if the update mask was: + * + * paths: "f.b.d" + * + * then the result would be: + * + * f { + * b { + * d : 10 + * x : 2 + * } + * c : 1 + * } + * + * In order to reset a field's value to the default, the field must + * be in the mask and set to the default value in the provided resource. + * Hence, in order to reset all fields of a resource, provide a default + * instance of the resource and set all fields in the mask, or do + * not provide a mask as described below. + * + * If a field mask is not present on update, the operation applies to + * all fields (as if a field mask of all fields has been specified). + * Note that in the presence of schema evolution, this may mean that + * fields the client does not know and has therefore not filled into + * the request will be reset to their default. If this is unwanted + * behavior, a specific service may require a client to always specify + * a field mask, producing an error if not. + * + * As with get operations, the location of the resource which + * describes the updated values in the request message depends on the + * operation kind. In any case, the effect of the field mask is + * required to be honored by the API. + * + * ## Considerations for HTTP REST + * + * The HTTP kind of an update operation which uses a field mask must + * be set to PATCH instead of PUT in order to satisfy HTTP semantics + * (PUT must only be used for full updates). + * + * # JSON Encoding of Field Masks + * + * In JSON, a field mask is encoded as a single string where paths are + * separated by a comma. Fields name in each path are converted + * to/from lower-camel naming conventions. + * + * As an example, consider the following message declarations: + * + * message Profile { + * User user = 1; + * Photo photo = 2; + * } + * message User { + * string display_name = 1; + * string address = 2; + * } + * + * In proto a field mask for `Profile` may look as such: + * + * mask { + * paths: "user.display_name" + * paths: "photo" + * } + * + * In JSON, the same mask is represented as below: + * + * { + * mask: "user.displayName,photo" + * } + * + * # Field Masks and Oneof Fields + * + * Field masks treat fields in oneofs just as regular fields. Consider the + * following message: + * + * message SampleMessage { + * oneof test_oneof { + * string name = 4; + * SubMessage sub_message = 9; + * } + * } + * + * The field mask can be: + * + * mask { + * paths: "name" + * } + * + * Or: + * + * mask { + * paths: "sub_message" + * } + * + * Note that oneof type names ("test_oneof" in this case) cannot be used in + * paths. + * + * @property {string[]} paths + * The set of field mask paths. + * + * @typedef FieldMask + * @memberof google.protobuf + * @see [google.protobuf.FieldMask definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/field_mask.proto} + */ +var FieldMask = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_timestamp.js b/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_timestamp.js new file mode 100644 index 00000000000..a02db52bdeb --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/doc/google/protobuf/doc_timestamp.js @@ -0,0 +1,113 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * A Timestamp represents a point in time independent of any time zone + * or calendar, represented as seconds and fractions of seconds at + * nanosecond resolution in UTC Epoch time. It is encoded using the + * Proleptic Gregorian Calendar which extends the Gregorian calendar + * backwards to year one. It is encoded assuming all minutes are 60 + * seconds long, i.e. leap seconds are "smeared" so that no leap second + * table is needed for interpretation. Range is from + * 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. + * By restricting to that range, we ensure that we can convert to + * and from RFC 3339 date strings. + * See [https://www.ietf.org/rfc/rfc3339.txt](https://www.ietf.org/rfc/rfc3339.txt). + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * + * Example 5: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required, though only UTC (as indicated by "Z") is presently supported. + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString] + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) + * with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one + * can use the Joda Time's [`ISODateTimeFormat.dateTime()`](https://cloud.google.com + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime()) + * to obtain a formatter capable of generating timestamps in this format. + * + * @property {number} seconds + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + * + * @property {number} nanos + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + * + * @typedef Timestamp + * @memberof google.protobuf + * @see [google.protobuf.Timestamp definition in proto format]{@link https://github.com/google/protobuf/blob/master/src/google/protobuf/timestamp.proto} + */ +var Timestamp = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-privacy-dlp/src/v2/doc/google/rpc/doc_status.js b/packages/google-privacy-dlp/src/v2/doc/google/rpc/doc_status.js new file mode 100644 index 00000000000..7122f1682e0 --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/doc/google/rpc/doc_status.js @@ -0,0 +1,92 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * The `Status` type defines a logical error model that is suitable for different + * programming environments, including REST APIs and RPC APIs. It is used by + * [gRPC](https://github.com/grpc). The error model is designed to be: + * + * - Simple to use and understand for most users + * - Flexible enough to meet unexpected needs + * + * # Overview + * + * The `Status` message contains three pieces of data: error code, error message, + * and error details. The error code should be an enum value of + * google.rpc.Code, but it may accept additional error codes if needed. The + * error message should be a developer-facing English message that helps + * developers *understand* and *resolve* the error. If a localized user-facing + * error message is needed, put the localized message in the error details or + * localize it in the client. The optional error details may contain arbitrary + * information about the error. There is a predefined set of error detail types + * in the package `google.rpc` that can be used for common error conditions. + * + * # Language mapping + * + * The `Status` message is the logical representation of the error model, but it + * is not necessarily the actual wire format. When the `Status` message is + * exposed in different client libraries and different wire protocols, it can be + * mapped differently. For example, it will likely be mapped to some exceptions + * in Java, but more likely mapped to some error codes in C. + * + * # Other uses + * + * The error model and the `Status` message can be used in a variety of + * environments, either with or without APIs, to provide a + * consistent developer experience across different environments. + * + * Example uses of this error model include: + * + * - Partial errors. If a service needs to return partial errors to the client, + * it may embed the `Status` in the normal response to indicate the partial + * errors. + * + * - Workflow errors. A typical workflow has multiple steps. Each step may + * have a `Status` message for error reporting. + * + * - Batch operations. If a client uses batch request and batch response, the + * `Status` message should be used directly inside batch response, one for + * each error sub-response. + * + * - Asynchronous operations. If an API call embeds asynchronous operation + * results in its response, the status of those operations should be + * represented directly using the `Status` message. + * + * - Logging. If some API errors are stored in logs, the message `Status` could + * be used directly after any stripping needed for security/privacy reasons. + * + * @property {number} code + * The status code, which should be an enum value of google.rpc.Code. + * + * @property {string} message + * A developer-facing error message, which should be in English. Any + * user-facing error message should be localized and sent in the + * google.rpc.Status.details field, or localized by the client. + * + * @property {Object[]} details + * A list of messages that carry the error details. There is a common set of + * message types for APIs to use. + * + * This object should have the same structure as [Any]{@link google.protobuf.Any} + * + * @typedef Status + * @memberof google.rpc + * @see [google.rpc.Status definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto} + */ +var Status = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-privacy-dlp/src/v2/doc/google/type/doc_date.js b/packages/google-privacy-dlp/src/v2/doc/google/type/doc_date.js new file mode 100644 index 00000000000..1cda326c1b9 --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/doc/google/type/doc_date.js @@ -0,0 +1,44 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * Represents a whole calendar date, e.g. date of birth. The time of day and + * time zone are either specified elsewhere or are not significant. The date + * is relative to the Proleptic Gregorian Calendar. The day may be 0 to + * represent a year and month where the day is not significant, e.g. credit card + * expiration date. The year may be 0 to represent a month and day independent + * of year, e.g. anniversary date. Related types are google.type.TimeOfDay + * and `google.protobuf.Timestamp`. + * + * @property {number} year + * Year of date. Must be from 1 to 9999, or 0 if specifying a date without + * a year. + * + * @property {number} month + * Month of year. Must be from 1 to 12. + * + * @property {number} day + * Day of month. Must be from 1 to 31 and valid for the year and month, or 0 + * if specifying a year/month where the day is not significant. + * + * @typedef Date + * @memberof google.type + * @see [google.type.Date definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/type/date.proto} + */ +var Date = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-privacy-dlp/src/v2/doc/google/type/doc_timeofday.js b/packages/google-privacy-dlp/src/v2/doc/google/type/doc_timeofday.js new file mode 100644 index 00000000000..bc918fe8db0 --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/doc/google/type/doc_timeofday.js @@ -0,0 +1,43 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +// Note: this file is purely for documentation. Any contents are not expected +// to be loaded as the JS file. + +/** + * Represents a time of day. The date and time zone are either not significant + * or are specified elsewhere. An API may chose to allow leap seconds. Related + * types are google.type.Date and `google.protobuf.Timestamp`. + * + * @property {number} hours + * Hours of day in 24 hour format. Should be from 0 to 23. An API may choose + * to allow the value "24:00:00" for scenarios like business closing time. + * + * @property {number} minutes + * Minutes of hour of day. Must be from 0 to 59. + * + * @property {number} seconds + * Seconds of minutes of the time. Must normally be from 0 to 59. An API may + * allow the value 60 if it allows leap-seconds. + * + * @property {number} nanos + * Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. + * + * @typedef TimeOfDay + * @memberof google.type + * @see [google.type.TimeOfDay definition in proto format]{@link https://github.com/googleapis/googleapis/blob/master/google/type/timeofday.proto} + */ +var TimeOfDay = { + // This is for documentation. Actual contents will be loaded by gRPC. +}; \ No newline at end of file diff --git a/packages/google-privacy-dlp/src/v2/index.js b/packages/google-privacy-dlp/src/v2/index.js new file mode 100644 index 00000000000..b0f2d1263d0 --- /dev/null +++ b/packages/google-privacy-dlp/src/v2/index.js @@ -0,0 +1,19 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +'use strict'; + +const DlpServiceClient = require('./dlp_service_client'); + +module.exports.DlpServiceClient = DlpServiceClient; diff --git a/packages/google-privacy-dlp/system-test/dlp_service_smoke_test.js b/packages/google-privacy-dlp/system-test/dlp_service_smoke_test.js index 349cd16e98d..9f1615883e1 100644 --- a/packages/google-privacy-dlp/system-test/dlp_service_smoke_test.js +++ b/packages/google-privacy-dlp/system-test/dlp_service_smoke_test.js @@ -1,10 +1,10 @@ -// Copyright 2017, Google Inc. All rights reserved. +// Copyright 2017 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, @@ -18,24 +18,23 @@ describe('DlpServiceSmokeTest', () => { it('successfully makes a call to the service', done => { const dlp = require('../src'); - var client = new dlp.v2beta1.DlpServiceClient({ - // optional auth parameters. - }); + var projectId = process.env['GCLOUD_PROJECT']; + var client = new dlp.v2.DlpServiceClient({}); - var minLikelihood = 'POSSIBLE'; var inspectConfig = { - minLikelihood: minLikelihood, + infoTypes: [{name: 'PHONE_NUMBER'}], + minLikelihood: 'POSSIBLE', }; var type = 'text/plain'; var value = 'my phone number is 215-512-1212'; - var itemsElement = { + var item = { type: type, value: value, }; - var items = [itemsElement]; var request = { inspectConfig: inspectConfig, - items: items, + item: item, + parent: client.projectPath(projectId), }; client .inspectContent(request) diff --git a/packages/google-privacy-dlp/test/gapic-v2.js b/packages/google-privacy-dlp/test/gapic-v2.js new file mode 100644 index 00000000000..afb7d708e2d --- /dev/null +++ b/packages/google-privacy-dlp/test/gapic-v2.js @@ -0,0 +1,1575 @@ +// 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. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// 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. + +'use strict'; + +const assert = require('assert'); + +const dlpModule = require('../src'); + +var FAKE_STATUS_CODE = 1; +var error = new Error(); +error.code = FAKE_STATUS_CODE; + +describe('DlpServiceClient', () => { + describe('inspectContent', () => { + it('invokes inspectContent without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock response + var expectedResponse = {}; + + // Mock Grpc layer + client._innerApiCalls.inspectContent = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.inspectContent(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes inspectContent with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.inspectContent = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.inspectContent(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('redactImage', () => { + it('invokes redactImage without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock response + var redactedImage = '28'; + var extractedText = 'extractedText998260012'; + var expectedResponse = { + redactedImage: redactedImage, + extractedText: extractedText, + }; + + // Mock Grpc layer + client._innerApiCalls.redactImage = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.redactImage(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes redactImage with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.redactImage = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.redactImage(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('deidentifyContent', () => { + it('invokes deidentifyContent without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock response + var expectedResponse = {}; + + // Mock Grpc layer + client._innerApiCalls.deidentifyContent = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.deidentifyContent(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes deidentifyContent with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.deidentifyContent = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.deidentifyContent(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('reidentifyContent', () => { + it('invokes reidentifyContent without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock response + var expectedResponse = {}; + + // Mock Grpc layer + client._innerApiCalls.reidentifyContent = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.reidentifyContent(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes reidentifyContent with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.reidentifyContent = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.reidentifyContent(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('listInfoTypes', () => { + it('invokes listInfoTypes without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var request = {}; + + // Mock response + var expectedResponse = {}; + + // Mock Grpc layer + client._innerApiCalls.listInfoTypes = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.listInfoTypes(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes listInfoTypes with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var request = {}; + + // Mock Grpc layer + client._innerApiCalls.listInfoTypes = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.listInfoTypes(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('createInspectTemplate', () => { + it('invokes createInspectTemplate without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.organizationPath('[ORGANIZATION]'); + var request = { + parent: formattedParent, + }; + + // Mock response + var name = 'name3373707'; + var displayName = 'displayName1615086568'; + var description = 'description-1724546052'; + var expectedResponse = { + name: name, + displayName: displayName, + description: description, + }; + + // Mock Grpc layer + client._innerApiCalls.createInspectTemplate = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.createInspectTemplate(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createInspectTemplate with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.organizationPath('[ORGANIZATION]'); + var request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.createInspectTemplate = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.createInspectTemplate(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('updateInspectTemplate', () => { + it('invokes updateInspectTemplate without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.organizationInspectTemplatePath( + '[ORGANIZATION]', + '[INSPECT_TEMPLATE]' + ); + var request = { + name: formattedName, + }; + + // Mock response + var name2 = 'name2-1052831874'; + var displayName = 'displayName1615086568'; + var description = 'description-1724546052'; + var expectedResponse = { + name: name2, + displayName: displayName, + description: description, + }; + + // Mock Grpc layer + client._innerApiCalls.updateInspectTemplate = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.updateInspectTemplate(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateInspectTemplate with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.organizationInspectTemplatePath( + '[ORGANIZATION]', + '[INSPECT_TEMPLATE]' + ); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.updateInspectTemplate = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.updateInspectTemplate(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('getInspectTemplate', () => { + it('invokes getInspectTemplate without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var request = {}; + + // Mock response + var name = 'name3373707'; + var displayName = 'displayName1615086568'; + var description = 'description-1724546052'; + var expectedResponse = { + name: name, + displayName: displayName, + description: description, + }; + + // Mock Grpc layer + client._innerApiCalls.getInspectTemplate = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.getInspectTemplate(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getInspectTemplate with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var request = {}; + + // Mock Grpc layer + client._innerApiCalls.getInspectTemplate = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.getInspectTemplate(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('listInspectTemplates', () => { + it('invokes listInspectTemplates without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.organizationPath('[ORGANIZATION]'); + var request = { + parent: formattedParent, + }; + + // Mock response + var nextPageToken = ''; + var inspectTemplatesElement = {}; + var inspectTemplates = [inspectTemplatesElement]; + var expectedResponse = { + nextPageToken: nextPageToken, + inspectTemplates: inspectTemplates, + }; + + // Mock Grpc layer + client._innerApiCalls.listInspectTemplates = ( + actualRequest, + options, + callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse.inspectTemplates); + }; + + client.listInspectTemplates(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse.inspectTemplates); + done(); + }); + }); + + it('invokes listInspectTemplates with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.organizationPath('[ORGANIZATION]'); + var request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.listInspectTemplates = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.listInspectTemplates(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('deleteInspectTemplate', () => { + it('invokes deleteInspectTemplate without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.organizationInspectTemplatePath( + '[ORGANIZATION]', + '[INSPECT_TEMPLATE]' + ); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.deleteInspectTemplate = mockSimpleGrpcMethod( + request + ); + + client.deleteInspectTemplate(request, err => { + assert.ifError(err); + done(); + }); + }); + + it('invokes deleteInspectTemplate with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.organizationInspectTemplatePath( + '[ORGANIZATION]', + '[INSPECT_TEMPLATE]' + ); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.deleteInspectTemplate = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.deleteInspectTemplate(request, err => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + + describe('createDeidentifyTemplate', () => { + it('invokes createDeidentifyTemplate without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.organizationPath('[ORGANIZATION]'); + var request = { + parent: formattedParent, + }; + + // Mock response + var name = 'name3373707'; + var displayName = 'displayName1615086568'; + var description = 'description-1724546052'; + var expectedResponse = { + name: name, + displayName: displayName, + description: description, + }; + + // Mock Grpc layer + client._innerApiCalls.createDeidentifyTemplate = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.createDeidentifyTemplate(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createDeidentifyTemplate with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.organizationPath('[ORGANIZATION]'); + var request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.createDeidentifyTemplate = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.createDeidentifyTemplate(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('updateDeidentifyTemplate', () => { + it('invokes updateDeidentifyTemplate without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.organizationDeidentifyTemplatePath( + '[ORGANIZATION]', + '[DEIDENTIFY_TEMPLATE]' + ); + var request = { + name: formattedName, + }; + + // Mock response + var name2 = 'name2-1052831874'; + var displayName = 'displayName1615086568'; + var description = 'description-1724546052'; + var expectedResponse = { + name: name2, + displayName: displayName, + description: description, + }; + + // Mock Grpc layer + client._innerApiCalls.updateDeidentifyTemplate = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.updateDeidentifyTemplate(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateDeidentifyTemplate with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.organizationDeidentifyTemplatePath( + '[ORGANIZATION]', + '[DEIDENTIFY_TEMPLATE]' + ); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.updateDeidentifyTemplate = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.updateDeidentifyTemplate(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('getDeidentifyTemplate', () => { + it('invokes getDeidentifyTemplate without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.organizationDeidentifyTemplatePath( + '[ORGANIZATION]', + '[DEIDENTIFY_TEMPLATE]' + ); + var request = { + name: formattedName, + }; + + // Mock response + var name2 = 'name2-1052831874'; + var displayName = 'displayName1615086568'; + var description = 'description-1724546052'; + var expectedResponse = { + name: name2, + displayName: displayName, + description: description, + }; + + // Mock Grpc layer + client._innerApiCalls.getDeidentifyTemplate = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.getDeidentifyTemplate(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getDeidentifyTemplate with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.organizationDeidentifyTemplatePath( + '[ORGANIZATION]', + '[DEIDENTIFY_TEMPLATE]' + ); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.getDeidentifyTemplate = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.getDeidentifyTemplate(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('listDeidentifyTemplates', () => { + it('invokes listDeidentifyTemplates without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.organizationPath('[ORGANIZATION]'); + var request = { + parent: formattedParent, + }; + + // Mock response + var nextPageToken = ''; + var deidentifyTemplatesElement = {}; + var deidentifyTemplates = [deidentifyTemplatesElement]; + var expectedResponse = { + nextPageToken: nextPageToken, + deidentifyTemplates: deidentifyTemplates, + }; + + // Mock Grpc layer + client._innerApiCalls.listDeidentifyTemplates = ( + actualRequest, + options, + callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse.deidentifyTemplates); + }; + + client.listDeidentifyTemplates(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse.deidentifyTemplates); + done(); + }); + }); + + it('invokes listDeidentifyTemplates with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.organizationPath('[ORGANIZATION]'); + var request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.listDeidentifyTemplates = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.listDeidentifyTemplates(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('deleteDeidentifyTemplate', () => { + it('invokes deleteDeidentifyTemplate without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.organizationDeidentifyTemplatePath( + '[ORGANIZATION]', + '[DEIDENTIFY_TEMPLATE]' + ); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.deleteDeidentifyTemplate = mockSimpleGrpcMethod( + request + ); + + client.deleteDeidentifyTemplate(request, err => { + assert.ifError(err); + done(); + }); + }); + + it('invokes deleteDeidentifyTemplate with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.organizationDeidentifyTemplatePath( + '[ORGANIZATION]', + '[DEIDENTIFY_TEMPLATE]' + ); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.deleteDeidentifyTemplate = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.deleteDeidentifyTemplate(request, err => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + + describe('createDlpJob', () => { + it('invokes createDlpJob without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock response + var name = 'name3373707'; + var jobTriggerName = 'jobTriggerName1819490804'; + var expectedResponse = { + name: name, + jobTriggerName: jobTriggerName, + }; + + // Mock Grpc layer + client._innerApiCalls.createDlpJob = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.createDlpJob(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createDlpJob with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.createDlpJob = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.createDlpJob(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('listDlpJobs', () => { + it('invokes listDlpJobs without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock response + var nextPageToken = ''; + var jobsElement = {}; + var jobs = [jobsElement]; + var expectedResponse = { + nextPageToken: nextPageToken, + jobs: jobs, + }; + + // Mock Grpc layer + client._innerApiCalls.listDlpJobs = ( + actualRequest, + options, + callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse.jobs); + }; + + client.listDlpJobs(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse.jobs); + done(); + }); + }); + + it('invokes listDlpJobs with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.listDlpJobs = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.listDlpJobs(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('getDlpJob', () => { + it('invokes getDlpJob without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.dlpJobPath('[PROJECT]', '[DLP_JOB]'); + var request = { + name: formattedName, + }; + + // Mock response + var name2 = 'name2-1052831874'; + var jobTriggerName = 'jobTriggerName1819490804'; + var expectedResponse = { + name: name2, + jobTriggerName: jobTriggerName, + }; + + // Mock Grpc layer + client._innerApiCalls.getDlpJob = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.getDlpJob(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getDlpJob with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.dlpJobPath('[PROJECT]', '[DLP_JOB]'); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.getDlpJob = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.getDlpJob(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('deleteDlpJob', () => { + it('invokes deleteDlpJob without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.dlpJobPath('[PROJECT]', '[DLP_JOB]'); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.deleteDlpJob = mockSimpleGrpcMethod(request); + + client.deleteDlpJob(request, err => { + assert.ifError(err); + done(); + }); + }); + + it('invokes deleteDlpJob with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.dlpJobPath('[PROJECT]', '[DLP_JOB]'); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.deleteDlpJob = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.deleteDlpJob(request, err => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + + describe('cancelDlpJob', () => { + it('invokes cancelDlpJob without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.dlpJobPath('[PROJECT]', '[DLP_JOB]'); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.cancelDlpJob = mockSimpleGrpcMethod(request); + + client.cancelDlpJob(request, err => { + assert.ifError(err); + done(); + }); + }); + + it('invokes cancelDlpJob with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.dlpJobPath('[PROJECT]', '[DLP_JOB]'); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.cancelDlpJob = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.cancelDlpJob(request, err => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + + describe('listJobTriggers', () => { + it('invokes listJobTriggers without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock response + var nextPageToken = ''; + var jobTriggersElement = {}; + var jobTriggers = [jobTriggersElement]; + var expectedResponse = { + nextPageToken: nextPageToken, + jobTriggers: jobTriggers, + }; + + // Mock Grpc layer + client._innerApiCalls.listJobTriggers = ( + actualRequest, + options, + callback + ) => { + assert.deepStrictEqual(actualRequest, request); + callback(null, expectedResponse.jobTriggers); + }; + + client.listJobTriggers(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse.jobTriggers); + done(); + }); + }); + + it('invokes listJobTriggers with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.listJobTriggers = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.listJobTriggers(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('getJobTrigger', () => { + it('invokes getJobTrigger without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.projectJobTriggerPath( + '[PROJECT]', + '[JOB_TRIGGER]' + ); + var request = { + name: formattedName, + }; + + // Mock response + var name2 = 'name2-1052831874'; + var displayName = 'displayName1615086568'; + var description = 'description-1724546052'; + var expectedResponse = { + name: name2, + displayName: displayName, + description: description, + }; + + // Mock Grpc layer + client._innerApiCalls.getJobTrigger = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.getJobTrigger(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes getJobTrigger with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.projectJobTriggerPath( + '[PROJECT]', + '[JOB_TRIGGER]' + ); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.getJobTrigger = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.getJobTrigger(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('deleteJobTrigger', () => { + it('invokes deleteJobTrigger without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var name = 'name3373707'; + var request = { + name: name, + }; + + // Mock Grpc layer + client._innerApiCalls.deleteJobTrigger = mockSimpleGrpcMethod(request); + + client.deleteJobTrigger(request, err => { + assert.ifError(err); + done(); + }); + }); + + it('invokes deleteJobTrigger with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var name = 'name3373707'; + var request = { + name: name, + }; + + // Mock Grpc layer + client._innerApiCalls.deleteJobTrigger = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.deleteJobTrigger(request, err => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + done(); + }); + }); + }); + + describe('updateJobTrigger', () => { + it('invokes updateJobTrigger without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.projectJobTriggerPath( + '[PROJECT]', + '[JOB_TRIGGER]' + ); + var request = { + name: formattedName, + }; + + // Mock response + var name2 = 'name2-1052831874'; + var displayName = 'displayName1615086568'; + var description = 'description-1724546052'; + var expectedResponse = { + name: name2, + displayName: displayName, + description: description, + }; + + // Mock Grpc layer + client._innerApiCalls.updateJobTrigger = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.updateJobTrigger(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes updateJobTrigger with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedName = client.projectJobTriggerPath( + '[PROJECT]', + '[JOB_TRIGGER]' + ); + var request = { + name: formattedName, + }; + + // Mock Grpc layer + client._innerApiCalls.updateJobTrigger = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.updateJobTrigger(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); + + describe('createJobTrigger', () => { + it('invokes createJobTrigger without error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock response + var name = 'name3373707'; + var displayName = 'displayName1615086568'; + var description = 'description-1724546052'; + var expectedResponse = { + name: name, + displayName: displayName, + description: description, + }; + + // Mock Grpc layer + client._innerApiCalls.createJobTrigger = mockSimpleGrpcMethod( + request, + expectedResponse + ); + + client.createJobTrigger(request, (err, response) => { + assert.ifError(err); + assert.deepStrictEqual(response, expectedResponse); + done(); + }); + }); + + it('invokes createJobTrigger with error', done => { + var client = new dlpModule.v2.DlpServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + + // Mock request + var formattedParent = client.projectPath('[PROJECT]'); + var request = { + parent: formattedParent, + }; + + // Mock Grpc layer + client._innerApiCalls.createJobTrigger = mockSimpleGrpcMethod( + request, + null, + error + ); + + client.createJobTrigger(request, (err, response) => { + assert(err instanceof Error); + assert.equal(err.code, FAKE_STATUS_CODE); + assert(typeof response === 'undefined'); + done(); + }); + }); + }); +}); + +function mockSimpleGrpcMethod(expectedRequest, response, error) { + return function(actualRequest, options, callback) { + assert.deepStrictEqual(actualRequest, expectedRequest); + if (error) { + callback(error); + } else if (response) { + callback(null, response); + } else { + callback(null); + } + }; +}