| 1 |
// Copyright 2017 Google Inc. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
syntax = "proto3"; |
| 16 |
|
| 17 |
package google.privacy.dlp.v2beta1; |
| 18 |
|
| 19 |
import "google/api/annotations.proto"; |
| 20 |
import "google/longrunning/operations.proto"; |
| 21 |
import "google/privacy/dlp/v2beta1/storage.proto"; |
| 22 |
import "google/protobuf/timestamp.proto"; |
| 23 |
|
| 24 |
option go_package = "google.golang.org/genproto/googleapis/privacy/dlp/v2beta1;dlp"; |
| 25 |
option java_multiple_files = true; |
| 26 |
option java_outer_classname = "DlpProto"; |
| 27 |
option java_package = "com.google.privacy.dlp.v2beta1"; |
| 28 |
|
| 29 |
|
| 30 |
// The DLP API is a service that allows clients |
| 31 |
// to detect the presence of Personally Identifiable Information (PII) and other |
| 32 |
// privacy-sensitive data in user-supplied, unstructured data streams, like text |
| 33 |
// blocks or images. |
| 34 |
// The service also includes methods for sensitive data redaction and |
| 35 |
// scheduling of data scans on Google Cloud Platform based data sets. |
| 36 |
service DlpService { |
| 37 |
// Find potentially sensitive info in a list of strings. |
| 38 |
// This method has limits on input size, processing time, and output size. |
| 39 |
rpc InspectContent(InspectContentRequest) returns (InspectContentResponse) { |
| 40 |
option (google.api.http) = { post: "/v2beta1/content:inspect" body: "*" }; |
| 41 |
} |
| 42 |
|
| 43 |
// Redact potentially sensitive info from a list of strings. |
| 44 |
// This method has limits on input size, processing time, and output size. |
| 45 |
rpc RedactContent(RedactContentRequest) returns (RedactContentResponse) { |
| 46 |
option (google.api.http) = { post: "/v2beta1/content:redact" body: "*" }; |
| 47 |
} |
| 48 |
|
| 49 |
// Schedule a job scanning content in a Google Cloud Platform data repository. |
| 50 |
rpc CreateInspectOperation(CreateInspectOperationRequest) returns (google.longrunning.Operation) { |
| 51 |
option (google.api.http) = { post: "/v2beta1/inspect/operations" body: "*" }; |
| 52 |
} |
| 53 |
|
| 54 |
// Returns list of results for given inspect operation result set id. |
| 55 |
rpc ListInspectFindings(ListInspectFindingsRequest) returns (ListInspectFindingsResponse) { |
| 56 |
option (google.api.http) = { get: "/v2beta1/{name=inspect/results/*}/findings" }; |
| 57 |
} |
| 58 |
|
| 59 |
// Returns sensitive information types for given category. |
| 60 |
rpc ListInfoTypes(ListInfoTypesRequest) returns (ListInfoTypesResponse) { |
| 61 |
option (google.api.http) = { get: "/v2beta1/rootCategories/{category=*}/infoTypes" }; |
| 62 |
} |
| 63 |
|
| 64 |
// Returns the list of root categories of sensitive information. |
| 65 |
rpc ListRootCategories(ListRootCategoriesRequest) returns (ListRootCategoriesResponse) { |
| 66 |
option (google.api.http) = { get: "/v2beta1/rootCategories" }; |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
// Configuration description of the scanning process. |
| 71 |
// When used with redactContent only info_types and min_likelihood are currently |
| 72 |
// used. |
| 73 |
message InspectConfig { |
| 74 |
// Restrict what info_types to look for. The values must correspond to |
| 75 |
// InfoType values returned by ListInfoTypes or found in documentation. |
| 76 |
// Empty info_types runs all enabled detectors. |
| 77 |
repeated InfoType info_types = 1; |
| 78 |
|
| 79 |
// Only return findings equal or above this threshold. |
| 80 |
Likelihood min_likelihood = 2; |
| 81 |
|
| 82 |
// Limit the number of findings per content item. |
| 83 |
int32 max_findings = 3; |
| 84 |
|
| 85 |
// When true, a contextual quote from the data that triggered a finding will |
| 86 |
// be included in the response; see Finding.quote. |
| 87 |
bool include_quote = 4; |
| 88 |
|
| 89 |
// When true, exclude type information of the findings. |
| 90 |
bool exclude_types = 6; |
| 91 |
} |
| 92 |
|
| 93 |
// Container structure for the content to inspect. |
| 94 |
message ContentItem { |
| 95 |
// Type of the content, as defined in Content-Type HTTP header. |
| 96 |
// Supported types are: all "text" types, octet streams, PNG images, |
| 97 |
// JPEG images. |
| 98 |
string type = 1; |
| 99 |
|
| 100 |
// Data of the item either in the byte array or UTF-8 string form. |
| 101 |
oneof data_item { |
| 102 |
// Content data to inspect or redact. |
| 103 |
bytes data = 2; |
| 104 |
|
| 105 |
// String data to inspect or redact. |
| 106 |
string value = 3; |
| 107 |
} |
| 108 |
} |
| 109 |
|
| 110 |
// All the findings for a single scanned item. |
| 111 |
message InspectResult { |
| 112 |
// List of findings for an item. |
| 113 |
repeated Finding findings = 1; |
| 114 |
|
| 115 |
// If true, then this item might have more findings than were returned, |
| 116 |
// and the findings returned are an arbitrary subset of all findings. |
| 117 |
// The findings list might be truncated because the input items were too |
| 118 |
// large, or because the server reached the maximum amount of resources |
| 119 |
// allowed for a single API call. For best results, divide the input into |
| 120 |
// smaller batches. |
| 121 |
bool findings_truncated = 2; |
| 122 |
} |
| 123 |
|
| 124 |
// Container structure describing a single finding within a string or image. |
| 125 |
message Finding { |
| 126 |
// The specific string that may be potentially sensitive info. |
| 127 |
string quote = 1; |
| 128 |
|
| 129 |
// The specific type of info the string might be. |
| 130 |
InfoType info_type = 2; |
| 131 |
|
| 132 |
// Estimate of how likely it is that the info_type is correct. |
| 133 |
Likelihood likelihood = 3; |
| 134 |
|
| 135 |
// Location of the info found. |
| 136 |
Location location = 4; |
| 137 |
|
| 138 |
// Timestamp when finding was detected. |
| 139 |
google.protobuf.Timestamp create_time = 6; |
| 140 |
} |
| 141 |
|
| 142 |
// Specifies the location of a finding within its source item. |
| 143 |
message Location { |
| 144 |
// Zero-based byte offsets within a content item. |
| 145 |
Range byte_range = 1; |
| 146 |
|
| 147 |
// Character offsets within a content item, included when content type |
| 148 |
// is a text. Default charset assumed to be UTF-8. |
| 149 |
Range codepoint_range = 2; |
| 150 |
|
| 151 |
// Location within an image's pixels. |
| 152 |
repeated ImageLocation image_boxes = 3; |
| 153 |
|
| 154 |
// Key of the finding. |
| 155 |
RecordKey record_key = 4; |
| 156 |
|
| 157 |
// Field id of the field containing the finding. |
| 158 |
FieldId field_id = 5; |
| 159 |
} |
| 160 |
|
| 161 |
// Generic half-open interval [start, end) |
| 162 |
message Range { |
| 163 |
// Index of the first character of the range (inclusive). |
| 164 |
int64 start = 1; |
| 165 |
|
| 166 |
// Index of the last character of the range (exclusive). |
| 167 |
int64 end = 2; |
| 168 |
} |
| 169 |
|
| 170 |
// Bounding box encompassing detected text within an image. |
| 171 |
message ImageLocation { |
| 172 |
// Top coordinate of the bounding box. (0,0) is upper left. |
| 173 |
int32 top = 1; |
| 174 |
|
| 175 |
// Left coordinate of the bounding box. (0,0) is upper left. |
| 176 |
int32 left = 2; |
| 177 |
|
| 178 |
// Width of the bounding box in pixels. |
| 179 |
int32 width = 3; |
| 180 |
|
| 181 |
// Height of the bounding box in pixels. |
| 182 |
int32 height = 4; |
| 183 |
} |
| 184 |
|
| 185 |
// Request to search for potentially sensitive info in a list of items |
| 186 |
// and replace it with a default or provided content. |
| 187 |
message RedactContentRequest { |
| 188 |
message ReplaceConfig { |
| 189 |
// Type of information to replace. Only one ReplaceConfig per info_type |
| 190 |
// should be provided. If ReplaceConfig does not have an info_type, we'll |
| 191 |
// match it against all info_types that are found but not specified in |
| 192 |
// another ReplaceConfig. |
| 193 |
InfoType info_type = 1; |
| 194 |
|
| 195 |
// Content replacing sensitive information of given type. Max 256 chars. |
| 196 |
string replace_with = 2; |
| 197 |
} |
| 198 |
|
| 199 |
// Configuration for the inspector. |
| 200 |
InspectConfig inspect_config = 1; |
| 201 |
|
| 202 |
// The list of items to inspect. Up to 100 are allowed per request. |
| 203 |
repeated ContentItem items = 2; |
| 204 |
|
| 205 |
// The strings to replace findings with. Must specify at least one. |
| 206 |
repeated ReplaceConfig replace_configs = 3; |
| 207 |
} |
| 208 |
|
| 209 |
// Results of deidentifying a list of items. |
| 210 |
message RedactContentResponse { |
| 211 |
// The redacted content. |
| 212 |
repeated ContentItem items = 1; |
| 213 |
} |
| 214 |
|
| 215 |
// Request to search for potentially sensitive info in a list of items. |
| 216 |
message InspectContentRequest { |
| 217 |
// Configuration for the inspector. |
| 218 |
InspectConfig inspect_config = 1; |
| 219 |
|
| 220 |
// The list of items to inspect. Items in a single request are |
| 221 |
// considered "related" unless inspect_config.independent_inputs is true. |
| 222 |
// Up to 100 are allowed per request. |
| 223 |
repeated ContentItem items = 2; |
| 224 |
} |
| 225 |
|
| 226 |
// Results of inspecting a list of items. |
| 227 |
message InspectContentResponse { |
| 228 |
// Each content_item from the request will have a result in this list, in the |
| 229 |
// same order as the request. |
| 230 |
repeated InspectResult results = 1; |
| 231 |
} |
| 232 |
|
| 233 |
// Request for scheduling a scan of a data subset from a Google Platform data |
| 234 |
// repository. |
| 235 |
message CreateInspectOperationRequest { |
| 236 |
// Configuration for the inspector. |
| 237 |
InspectConfig inspect_config = 1; |
| 238 |
|
| 239 |
// Specification of the data set to process. |
| 240 |
StorageConfig storage_config = 2; |
| 241 |
|
| 242 |
// Optional location to store findings. The bucket must already exist and |
| 243 |
// the Google APIs service account for DLP must have write permission to |
| 244 |
// write to the given bucket. |
| 245 |
// Results will be split over multiple csv files with each file name matching |
| 246 |
// the pattern "[operation_id] + [count].csv". |
| 247 |
// The operation_id will match the identifier for the Operation, |
| 248 |
// and the [count] is a counter used for tracking the number of files written. |
| 249 |
// The CSV file(s) contain the following columns regardless of storage type |
| 250 |
// scanned: id, info_type, likelihood, byte size of finding, quote, time_stamp |
| 251 |
// For cloud storage the next two columns are: file_path, start_offset |
| 252 |
// For datastore the next two columns are: project_id, namespace_id, path, |
| 253 |
// column_name, offset. |
| 254 |
OutputStorageConfig output_config = 3; |
| 255 |
} |
| 256 |
|
| 257 |
// Cloud repository for storing output. |
| 258 |
message OutputStorageConfig { |
| 259 |
oneof type { |
| 260 |
// The path to a Google Storage location to store output. |
| 261 |
CloudStoragePath storage_path = 2; |
| 262 |
} |
| 263 |
} |
| 264 |
|
| 265 |
// Stats regarding a specific InfoType. |
| 266 |
message InfoTypeStatistics { |
| 267 |
// The type of finding this stat is for. |
| 268 |
InfoType info_type = 1; |
| 269 |
|
| 270 |
// Number of findings for this info type. |
| 271 |
int64 count = 2; |
| 272 |
} |
| 273 |
|
| 274 |
// Metadata returned within GetOperation for an inspect request. |
| 275 |
message InspectOperationMetadata { |
| 276 |
// Total size in bytes that were processed. |
| 277 |
int64 processed_bytes = 1; |
| 278 |
|
| 279 |
// Estimate of the number of bytes to process. |
| 280 |
int64 total_estimated_bytes = 4; |
| 281 |
|
| 282 |
repeated InfoTypeStatistics info_type_stats = 2; |
| 283 |
|
| 284 |
// The time which this request was started. |
| 285 |
google.protobuf.Timestamp create_time = 3; |
| 286 |
|
| 287 |
// The inspect config used to create the Operation. |
| 288 |
InspectConfig request_inspect_config = 5; |
| 289 |
|
| 290 |
// The storage config used to create the Operation. |
| 291 |
StorageConfig request_storage_config = 6; |
| 292 |
|
| 293 |
// Optional location to store findings. |
| 294 |
OutputStorageConfig request_output_config = 7; |
| 295 |
} |
| 296 |
|
| 297 |
// The operational data. |
| 298 |
message InspectOperationResult { |
| 299 |
// The server-assigned name, which is only unique within the same service that |
| 300 |
// originally returns it. If you use the default HTTP mapping, the |
| 301 |
// `name` should have the format of `inspect/results/{id}`. |
| 302 |
string name = 1; |
| 303 |
} |
| 304 |
|
| 305 |
// Request for the list of results in a given inspect operation. |
| 306 |
message ListInspectFindingsRequest { |
| 307 |
// Identifier of the results set returned as metadata of |
| 308 |
// the longrunning operation created by a call to CreateInspectOperation. |
| 309 |
// Should be in the format of `inspect/results/{id}. |
| 310 |
string name = 1; |
| 311 |
|
| 312 |
// Maximum number of results to return. |
| 313 |
// If 0, the implementation will select a reasonable value. |
| 314 |
int32 page_size = 2; |
| 315 |
|
| 316 |
// The value returned by the last `ListInspectFindingsResponse`; indicates |
| 317 |
// that this is a continuation of a prior `ListInspectFindings` call, and that |
| 318 |
// the system should return the next page of data. |
| 319 |
string page_token = 3; |
| 320 |
} |
| 321 |
|
| 322 |
// Response to the ListInspectFindings request. |
| 323 |
message ListInspectFindingsResponse { |
| 324 |
// The results. |
| 325 |
InspectResult result = 1; |
| 326 |
|
| 327 |
// If not empty, indicates that there may be more results that match the |
| 328 |
// request; this value should be passed in a new `ListInspectFindingsRequest`. |
| 329 |
string next_page_token = 2; |
| 330 |
} |
| 331 |
|
| 332 |
// Info type description. |
| 333 |
message InfoTypeDescription { |
| 334 |
// Internal name of the info type. |
| 335 |
string name = 1; |
| 336 |
|
| 337 |
// Human readable form of the info type name. |
| 338 |
string display_name = 2; |
| 339 |
|
| 340 |
// List of categories this info type belongs to. |
| 341 |
repeated CategoryDescription categories = 3; |
| 342 |
} |
| 343 |
|
| 344 |
// Request for the list of info types belonging to a given category, |
| 345 |
// or all supported info types if no category is specified. |
| 346 |
message ListInfoTypesRequest { |
| 347 |
// Category name as returned by ListRootCategories. |
| 348 |
string category = 1; |
| 349 |
|
| 350 |
// Optional BCP-47 language code for localized info type friendly |
| 351 |
// names. If omitted, or if localized strings are not available, |
| 352 |
// en-US strings will be returned. |
| 353 |
string language_code = 2; |
| 354 |
} |
| 355 |
|
| 356 |
// Response to the ListInfoTypes request. |
| 357 |
message ListInfoTypesResponse { |
| 358 |
// Set of sensitive info types belonging to a category. |
| 359 |
repeated InfoTypeDescription info_types = 1; |
| 360 |
} |
| 361 |
|
| 362 |
// Info Type Category description. |
| 363 |
message CategoryDescription { |
| 364 |
// Internal name of the category. |
| 365 |
string name = 1; |
| 366 |
|
| 367 |
// Human readable form of the category name. |
| 368 |
string display_name = 2; |
| 369 |
} |
| 370 |
|
| 371 |
// Request for root categories of Info Types supported by the API. |
| 372 |
// Example values might include "FINANCE", "HEALTH", "FAST", "DEFAULT". |
| 373 |
message ListRootCategoriesRequest { |
| 374 |
// Optional language code for localized friendly category names. |
| 375 |
// If omitted or if localized strings are not available, |
| 376 |
// en-US strings will be returned. |
| 377 |
string language_code = 1; |
| 378 |
} |
| 379 |
|
| 380 |
// Response for ListRootCategories request. |
| 381 |
message ListRootCategoriesResponse { |
| 382 |
// List of all into type categories supported by the API. |
| 383 |
repeated CategoryDescription categories = 1; |
| 384 |
} |
| 385 |
|
| 386 |
// Categorization of results based on how likely they are to represent a match, |
| 387 |
// based on the number of elements they contain which imply a match. |
| 388 |
enum Likelihood { |
| 389 |
// Default value; information with all likelihoods will be included. |
| 390 |
LIKELIHOOD_UNSPECIFIED = 0; |
| 391 |
|
| 392 |
// Few matching elements. |
| 393 |
VERY_UNLIKELY = 1; |
| 394 |
|
| 395 |
UNLIKELY = 2; |
| 396 |
|
| 397 |
// Some matching elements. |
| 398 |
POSSIBLE = 3; |
| 399 |
|
| 400 |
LIKELY = 4; |
| 401 |
|
| 402 |
// Many matching elements. |
| 403 |
VERY_LIKELY = 5; |
| 404 |
} |