google-cloud-dlp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,638 @@
1
+ # Copyright 2017 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # https://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
+ # EDITING INSTRUCTIONS
16
+ # This file was generated from the file
17
+ # https://github.com/googleapis/googleapis/blob/master/google/privacy/dlp/v2beta1/dlp.proto,
18
+ # and updates to that file get reflected here through a refresh process.
19
+ # For the short term, the refresh process will only be runnable by Google
20
+ # engineers.
21
+ #
22
+ # The only allowed edits are to method and file documentation. A 3-way
23
+ # merge preserves those additions if the generated source changes.
24
+
25
+ require "json"
26
+ require "pathname"
27
+
28
+ require "google/gax"
29
+ require "google/gax/operation"
30
+ require "google/longrunning/operations_client"
31
+
32
+ require "google/privacy/dlp/v2beta1/dlp_pb"
33
+ require "google/cloud/dlp/credentials"
34
+
35
+ module Google
36
+ module Cloud
37
+ module Dlp
38
+ module V2beta1
39
+ # The DLP API is a service that allows clients
40
+ # to detect the presence of Personally Identifiable Information (PII) and other
41
+ # privacy-sensitive data in user-supplied, unstructured data streams, like text
42
+ # blocks or images.
43
+ # The service also includes methods for sensitive data redaction and
44
+ # scheduling of data scans on Google Cloud Platform based data sets.
45
+ #
46
+ # @!attribute [r] dlp_service_stub
47
+ # @return [Google::Privacy::Dlp::V2beta1::DlpService::Stub]
48
+ class DlpServiceClient
49
+ attr_reader :dlp_service_stub
50
+
51
+ # The default address of the service.
52
+ SERVICE_ADDRESS = "dlp.googleapis.com".freeze
53
+
54
+ # The default port of the service.
55
+ DEFAULT_SERVICE_PORT = 443
56
+
57
+ DEFAULT_TIMEOUT = 30
58
+
59
+ # The scopes needed to make gRPC calls to all of the methods defined in
60
+ # this service.
61
+ ALL_SCOPES = [
62
+ "https://www.googleapis.com/auth/cloud-platform"
63
+ ].freeze
64
+
65
+ class OperationsClient < Google::Longrunning::OperationsClient
66
+ SERVICE_ADDRESS = SERVICE_ADDRESS
67
+ end
68
+
69
+ RESULT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
70
+ "inspect/results/{result}"
71
+ )
72
+
73
+ private_constant :RESULT_PATH_TEMPLATE
74
+
75
+ # Returns a fully-qualified result resource name string.
76
+ # @param result [String]
77
+ # @return [String]
78
+ def self.result_path result
79
+ RESULT_PATH_TEMPLATE.render(
80
+ :"result" => result
81
+ )
82
+ end
83
+
84
+ # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
85
+ # Provides the means for authenticating requests made by the client. This parameter can
86
+ # be many types.
87
+ # A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
88
+ # authenticating requests made by this client.
89
+ # A `String` will be treated as the path to the keyfile to be used for the construction of
90
+ # credentials for this client.
91
+ # A `Hash` will be treated as the contents of a keyfile to be used for the construction of
92
+ # credentials for this client.
93
+ # A `GRPC::Core::Channel` will be used to make calls through.
94
+ # A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
95
+ # should already be composed with a `GRPC::Core::CallCredentials` object.
96
+ # A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
97
+ # metadata for requests, generally, to give OAuth credentials.
98
+ # @param scopes [Array<String>]
99
+ # The OAuth scopes for this service. This parameter is ignored if
100
+ # an updater_proc is supplied.
101
+ # @param client_config [Hash]
102
+ # A Hash for call options for each method. See
103
+ # Google::Gax#construct_settings for the structure of
104
+ # this data. Falls back to the default config if not specified
105
+ # or the specified config is missing data points.
106
+ # @param timeout [Numeric]
107
+ # The default timeout, in seconds, for calls made through this client.
108
+ def initialize \
109
+ credentials: nil,
110
+ scopes: ALL_SCOPES,
111
+ client_config: {},
112
+ timeout: DEFAULT_TIMEOUT,
113
+ lib_name: nil,
114
+ lib_version: ""
115
+ # These require statements are intentionally placed here to initialize
116
+ # the gRPC module only when it's required.
117
+ # See https://github.com/googleapis/toolkit/issues/446
118
+ require "google/gax/grpc"
119
+ require "google/privacy/dlp/v2beta1/dlp_services_pb"
120
+
121
+ credentials ||= Google::Cloud::Dlp::Credentials.default
122
+
123
+ @operations_client = OperationsClient.new(
124
+ credentials: credentials,
125
+ scopes: scopes,
126
+ client_config: client_config,
127
+ timeout: timeout,
128
+ lib_name: lib_name,
129
+ lib_version: lib_version,
130
+ )
131
+
132
+ if credentials.is_a?(String) || credentials.is_a?(Hash)
133
+ updater_proc = Google::Cloud::Dlp::Credentials.new(credentials).updater_proc
134
+ end
135
+ if credentials.is_a?(GRPC::Core::Channel)
136
+ channel = credentials
137
+ end
138
+ if credentials.is_a?(GRPC::Core::ChannelCredentials)
139
+ chan_creds = credentials
140
+ end
141
+ if credentials.is_a?(Proc)
142
+ updater_proc = credentials
143
+ end
144
+ if credentials.is_a?(Google::Auth::Credentials)
145
+ updater_proc = credentials.updater_proc
146
+ end
147
+
148
+ package_version = Gem.loaded_specs['google-cloud-dlp'].version.version
149
+
150
+ google_api_client = "gl-ruby/#{RUBY_VERSION}"
151
+ google_api_client << " #{lib_name}/#{lib_version}" if lib_name
152
+ google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
153
+ google_api_client << " grpc/#{GRPC::VERSION}"
154
+ google_api_client.freeze
155
+
156
+ headers = { :"x-goog-api-client" => google_api_client }
157
+ client_config_file = Pathname.new(__dir__).join(
158
+ "dlp_service_client_config.json"
159
+ )
160
+ defaults = client_config_file.open do |f|
161
+ Google::Gax.construct_settings(
162
+ "google.privacy.dlp.v2beta1.DlpService",
163
+ JSON.parse(f.read),
164
+ client_config,
165
+ Google::Gax::Grpc::STATUS_CODE_NAMES,
166
+ timeout,
167
+ errors: Google::Gax::Grpc::API_ERRORS,
168
+ kwargs: headers
169
+ )
170
+ end
171
+
172
+ # Allow overriding the service path/port in subclasses.
173
+ service_path = self.class::SERVICE_ADDRESS
174
+ port = self.class::DEFAULT_SERVICE_PORT
175
+ @dlp_service_stub = Google::Gax::Grpc.create_stub(
176
+ service_path,
177
+ port,
178
+ chan_creds: chan_creds,
179
+ channel: channel,
180
+ updater_proc: updater_proc,
181
+ scopes: scopes,
182
+ &Google::Privacy::Dlp::V2beta1::DlpService::Stub.method(:new)
183
+ )
184
+
185
+ @inspect_content = Google::Gax.create_api_call(
186
+ @dlp_service_stub.method(:inspect_content),
187
+ defaults["inspect_content"]
188
+ )
189
+ @redact_content = Google::Gax.create_api_call(
190
+ @dlp_service_stub.method(:redact_content),
191
+ defaults["redact_content"]
192
+ )
193
+ @deidentify_content = Google::Gax.create_api_call(
194
+ @dlp_service_stub.method(:deidentify_content),
195
+ defaults["deidentify_content"]
196
+ )
197
+ @analyze_data_source_risk = Google::Gax.create_api_call(
198
+ @dlp_service_stub.method(:analyze_data_source_risk),
199
+ defaults["analyze_data_source_risk"]
200
+ )
201
+ @create_inspect_operation = Google::Gax.create_api_call(
202
+ @dlp_service_stub.method(:create_inspect_operation),
203
+ defaults["create_inspect_operation"]
204
+ )
205
+ @list_inspect_findings = Google::Gax.create_api_call(
206
+ @dlp_service_stub.method(:list_inspect_findings),
207
+ defaults["list_inspect_findings"]
208
+ )
209
+ @list_info_types = Google::Gax.create_api_call(
210
+ @dlp_service_stub.method(:list_info_types),
211
+ defaults["list_info_types"]
212
+ )
213
+ @list_root_categories = Google::Gax.create_api_call(
214
+ @dlp_service_stub.method(:list_root_categories),
215
+ defaults["list_root_categories"]
216
+ )
217
+ end
218
+
219
+ # Service calls
220
+
221
+ # Finds potentially sensitive info in a list of strings.
222
+ # This method has limits on input size, processing time, and output size.
223
+ #
224
+ # @param inspect_config [Google::Privacy::Dlp::V2beta1::InspectConfig | Hash]
225
+ # Configuration for the inspector.
226
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::InspectConfig`
227
+ # can also be provided.
228
+ # @param items [Array<Google::Privacy::Dlp::V2beta1::ContentItem | Hash>]
229
+ # The list of items to inspect. Items in a single request are
230
+ # considered "related" unless inspect_config.independent_inputs is true.
231
+ # Up to 100 are allowed per request.
232
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::ContentItem`
233
+ # can also be provided.
234
+ # @param options [Google::Gax::CallOptions]
235
+ # Overrides the default settings for this call, e.g, timeout,
236
+ # retries, etc.
237
+ # @return [Google::Privacy::Dlp::V2beta1::InspectContentResponse]
238
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
239
+ # @example
240
+ # require "google/cloud/dlp/v2beta1"
241
+ #
242
+ # dlp_service_client = Google::Cloud::Dlp::V2beta1.new
243
+ # name = "EMAIL_ADDRESS"
244
+ # info_types_element = { name: name }
245
+ # info_types = [info_types_element]
246
+ # inspect_config = { info_types: info_types }
247
+ # type = "text/plain"
248
+ # value = "My email is example@example.com."
249
+ # items_element = { type: type, value: value }
250
+ # items = [items_element]
251
+ # response = dlp_service_client.inspect_content(inspect_config, items)
252
+
253
+ def inspect_content \
254
+ inspect_config,
255
+ items,
256
+ options: nil
257
+ req = {
258
+ inspect_config: inspect_config,
259
+ items: items
260
+ }.delete_if { |_, v| v.nil? }
261
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::InspectContentRequest)
262
+ @inspect_content.call(req, options)
263
+ end
264
+
265
+ # Redacts potentially sensitive info from a list of strings.
266
+ # This method has limits on input size, processing time, and output size.
267
+ #
268
+ # @param inspect_config [Google::Privacy::Dlp::V2beta1::InspectConfig | Hash]
269
+ # Configuration for the inspector.
270
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::InspectConfig`
271
+ # can also be provided.
272
+ # @param items [Array<Google::Privacy::Dlp::V2beta1::ContentItem | Hash>]
273
+ # The list of items to inspect. Up to 100 are allowed per request.
274
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::ContentItem`
275
+ # can also be provided.
276
+ # @param replace_configs [Array<Google::Privacy::Dlp::V2beta1::RedactContentRequest::ReplaceConfig | Hash>]
277
+ # The strings to replace findings text findings with. Must specify at least
278
+ # one of these or one ImageRedactionConfig if redacting images.
279
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::RedactContentRequest::ReplaceConfig`
280
+ # can also be provided.
281
+ # @param image_redaction_configs [Array<Google::Privacy::Dlp::V2beta1::RedactContentRequest::ImageRedactionConfig | Hash>]
282
+ # The configuration for specifying what content to redact from images.
283
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::RedactContentRequest::ImageRedactionConfig`
284
+ # can also be provided.
285
+ # @param options [Google::Gax::CallOptions]
286
+ # Overrides the default settings for this call, e.g, timeout,
287
+ # retries, etc.
288
+ # @return [Google::Privacy::Dlp::V2beta1::RedactContentResponse]
289
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
290
+ # @example
291
+ # require "google/cloud/dlp/v2beta1"
292
+ #
293
+ # dlp_service_client = Google::Cloud::Dlp::V2beta1.new
294
+ # name = "EMAIL_ADDRESS"
295
+ # info_types_element = { name: name }
296
+ # info_types = [info_types_element]
297
+ # inspect_config = { info_types: info_types }
298
+ # type = "text/plain"
299
+ # value = "My email is example@example.com."
300
+ # items_element = { type: type, value: value }
301
+ # items = [items_element]
302
+ # response = dlp_service_client.redact_content(inspect_config, items)
303
+
304
+ def redact_content \
305
+ inspect_config,
306
+ items,
307
+ replace_configs: nil,
308
+ image_redaction_configs: nil,
309
+ options: nil
310
+ req = {
311
+ inspect_config: inspect_config,
312
+ items: items,
313
+ replace_configs: replace_configs,
314
+ image_redaction_configs: image_redaction_configs
315
+ }.delete_if { |_, v| v.nil? }
316
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::RedactContentRequest)
317
+ @redact_content.call(req, options)
318
+ end
319
+
320
+ # De-identifies potentially sensitive info from a list of strings.
321
+ # This method has limits on input size and output size.
322
+ #
323
+ # @param deidentify_config [Google::Privacy::Dlp::V2beta1::DeidentifyConfig | Hash]
324
+ # Configuration for the de-identification of the list of content items.
325
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::DeidentifyConfig`
326
+ # can also be provided.
327
+ # @param inspect_config [Google::Privacy::Dlp::V2beta1::InspectConfig | Hash]
328
+ # Configuration for the inspector.
329
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::InspectConfig`
330
+ # can also be provided.
331
+ # @param items [Array<Google::Privacy::Dlp::V2beta1::ContentItem | Hash>]
332
+ # The list of items to inspect. Up to 100 are allowed per request.
333
+ # All items will be treated as text/*.
334
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::ContentItem`
335
+ # can also be provided.
336
+ # @param options [Google::Gax::CallOptions]
337
+ # Overrides the default settings for this call, e.g, timeout,
338
+ # retries, etc.
339
+ # @return [Google::Privacy::Dlp::V2beta1::DeidentifyContentResponse]
340
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
341
+ # @example
342
+ # require "google/cloud/dlp/v2beta1"
343
+ #
344
+ # dlp_service_client = Google::Cloud::Dlp::V2beta1.new
345
+ # deidentify_config = {}
346
+ # inspect_config = {}
347
+ # items = []
348
+ # response = dlp_service_client.deidentify_content(deidentify_config, inspect_config, items)
349
+
350
+ def deidentify_content \
351
+ deidentify_config,
352
+ inspect_config,
353
+ items,
354
+ options: nil
355
+ req = {
356
+ deidentify_config: deidentify_config,
357
+ inspect_config: inspect_config,
358
+ items: items
359
+ }.delete_if { |_, v| v.nil? }
360
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::DeidentifyContentRequest)
361
+ @deidentify_content.call(req, options)
362
+ end
363
+
364
+ # Schedules a job to compute risk analysis metrics over content in a Google
365
+ # Cloud Platform repository.
366
+ #
367
+ # @param privacy_metric [Google::Privacy::Dlp::V2beta1::PrivacyMetric | Hash]
368
+ # Privacy metric to compute.
369
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::PrivacyMetric`
370
+ # can also be provided.
371
+ # @param source_table [Google::Privacy::Dlp::V2beta1::BigQueryTable | Hash]
372
+ # Input dataset to compute metrics over.
373
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::BigQueryTable`
374
+ # can also be provided.
375
+ # @param options [Google::Gax::CallOptions]
376
+ # Overrides the default settings for this call, e.g, timeout,
377
+ # retries, etc.
378
+ # @return [Google::Gax::Operation]
379
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
380
+ # @example
381
+ # require "google/cloud/dlp/v2beta1"
382
+ #
383
+ # dlp_service_client = Google::Cloud::Dlp::V2beta1.new
384
+ # privacy_metric = {}
385
+ # source_table = {}
386
+ #
387
+ # # Register a callback during the method call.
388
+ # operation = dlp_service_client.analyze_data_source_risk(privacy_metric, source_table) do |op|
389
+ # raise op.results.message if op.error?
390
+ # op_results = op.results
391
+ # # Process the results.
392
+ #
393
+ # metadata = op.metadata
394
+ # # Process the metadata.
395
+ # end
396
+ #
397
+ # # Or use the return value to register a callback.
398
+ # operation.on_done do |op|
399
+ # raise op.results.message if op.error?
400
+ # op_results = op.results
401
+ # # Process the results.
402
+ #
403
+ # metadata = op.metadata
404
+ # # Process the metadata.
405
+ # end
406
+ #
407
+ # # Manually reload the operation.
408
+ # operation.reload!
409
+ #
410
+ # # Or block until the operation completes, triggering callbacks on
411
+ # # completion.
412
+ # operation.wait_until_done!
413
+
414
+ def analyze_data_source_risk \
415
+ privacy_metric,
416
+ source_table,
417
+ options: nil
418
+ req = {
419
+ privacy_metric: privacy_metric,
420
+ source_table: source_table
421
+ }.delete_if { |_, v| v.nil? }
422
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::AnalyzeDataSourceRiskRequest)
423
+ operation = Google::Gax::Operation.new(
424
+ @analyze_data_source_risk.call(req, options),
425
+ @operations_client,
426
+ Google::Privacy::Dlp::V2beta1::RiskAnalysisOperationResult,
427
+ Google::Privacy::Dlp::V2beta1::RiskAnalysisOperationMetadata,
428
+ call_options: options
429
+ )
430
+ operation.on_done { |operation| yield(operation) } if block_given?
431
+ operation
432
+ end
433
+
434
+ # Schedules a job scanning content in a Google Cloud Platform data
435
+ # repository.
436
+ #
437
+ # @param inspect_config [Google::Privacy::Dlp::V2beta1::InspectConfig | Hash]
438
+ # Configuration for the inspector.
439
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::InspectConfig`
440
+ # can also be provided.
441
+ # @param storage_config [Google::Privacy::Dlp::V2beta1::StorageConfig | Hash]
442
+ # Specification of the data set to process.
443
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::StorageConfig`
444
+ # can also be provided.
445
+ # @param output_config [Google::Privacy::Dlp::V2beta1::OutputStorageConfig | Hash]
446
+ # Optional location to store findings.
447
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::OutputStorageConfig`
448
+ # can also be provided.
449
+ # @param operation_config [Google::Privacy::Dlp::V2beta1::OperationConfig | Hash]
450
+ # Additional configuration settings for long running operations.
451
+ # A hash of the same form as `Google::Privacy::Dlp::V2beta1::OperationConfig`
452
+ # can also be provided.
453
+ # @param options [Google::Gax::CallOptions]
454
+ # Overrides the default settings for this call, e.g, timeout,
455
+ # retries, etc.
456
+ # @return [Google::Gax::Operation]
457
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
458
+ # @example
459
+ # require "google/cloud/dlp/v2beta1"
460
+ #
461
+ # dlp_service_client = Google::Cloud::Dlp::V2beta1.new
462
+ # name = "EMAIL_ADDRESS"
463
+ # info_types_element = { name: name }
464
+ # info_types = [info_types_element]
465
+ # inspect_config = { info_types: info_types }
466
+ # url = "gs://example_bucket/example_file.png"
467
+ # file_set = { url: url }
468
+ # cloud_storage_options = { file_set: file_set }
469
+ # storage_config = { cloud_storage_options: cloud_storage_options }
470
+ # output_config = {}
471
+ #
472
+ # # Register a callback during the method call.
473
+ # operation = dlp_service_client.create_inspect_operation(inspect_config, storage_config, output_config) do |op|
474
+ # raise op.results.message if op.error?
475
+ # op_results = op.results
476
+ # # Process the results.
477
+ #
478
+ # metadata = op.metadata
479
+ # # Process the metadata.
480
+ # end
481
+ #
482
+ # # Or use the return value to register a callback.
483
+ # operation.on_done do |op|
484
+ # raise op.results.message if op.error?
485
+ # op_results = op.results
486
+ # # Process the results.
487
+ #
488
+ # metadata = op.metadata
489
+ # # Process the metadata.
490
+ # end
491
+ #
492
+ # # Manually reload the operation.
493
+ # operation.reload!
494
+ #
495
+ # # Or block until the operation completes, triggering callbacks on
496
+ # # completion.
497
+ # operation.wait_until_done!
498
+
499
+ def create_inspect_operation \
500
+ inspect_config,
501
+ storage_config,
502
+ output_config,
503
+ operation_config: nil,
504
+ options: nil
505
+ req = {
506
+ inspect_config: inspect_config,
507
+ storage_config: storage_config,
508
+ output_config: output_config,
509
+ operation_config: operation_config
510
+ }.delete_if { |_, v| v.nil? }
511
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::CreateInspectOperationRequest)
512
+ operation = Google::Gax::Operation.new(
513
+ @create_inspect_operation.call(req, options),
514
+ @operations_client,
515
+ Google::Privacy::Dlp::V2beta1::InspectOperationResult,
516
+ Google::Privacy::Dlp::V2beta1::InspectOperationMetadata,
517
+ call_options: options
518
+ )
519
+ operation.on_done { |operation| yield(operation) } if block_given?
520
+ operation
521
+ end
522
+
523
+ # Returns list of results for given inspect operation result set id.
524
+ #
525
+ # @param name [String]
526
+ # Identifier of the results set returned as metadata of
527
+ # the longrunning operation created by a call to InspectDataSource.
528
+ # Should be in the format of +inspect/results/{id}+.
529
+ # @param page_size [Integer]
530
+ # Maximum number of results to return.
531
+ # If 0, the implementation selects a reasonable value.
532
+ # @param page_token [String]
533
+ # The value returned by the last +ListInspectFindingsResponse+; indicates
534
+ # that this is a continuation of a prior +ListInspectFindings+ call, and that
535
+ # the system should return the next page of data.
536
+ # @param filter [String]
537
+ # Restricts findings to items that match. Supports info_type and likelihood.
538
+ #
539
+ # Examples:
540
+ #
541
+ # * info_type=EMAIL_ADDRESS
542
+ # * info_type=PHONE_NUMBER,EMAIL_ADDRESS
543
+ # * likelihood=VERY_LIKELY
544
+ # * likelihood=VERY_LIKELY,LIKELY
545
+ # * info_type=EMAIL_ADDRESS,likelihood=VERY_LIKELY,LIKELY
546
+ # @param options [Google::Gax::CallOptions]
547
+ # Overrides the default settings for this call, e.g, timeout,
548
+ # retries, etc.
549
+ # @return [Google::Privacy::Dlp::V2beta1::ListInspectFindingsResponse]
550
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
551
+ # @example
552
+ # require "google/cloud/dlp/v2beta1"
553
+ #
554
+ # dlp_service_client = Google::Cloud::Dlp::V2beta1.new
555
+ # formatted_name = Google::Cloud::Dlp::V2beta1::DlpServiceClient.result_path("[RESULT]")
556
+ # response = dlp_service_client.list_inspect_findings(formatted_name)
557
+
558
+ def list_inspect_findings \
559
+ name,
560
+ page_size: nil,
561
+ page_token: nil,
562
+ filter: nil,
563
+ options: nil
564
+ req = {
565
+ name: name,
566
+ page_size: page_size,
567
+ page_token: page_token,
568
+ filter: filter
569
+ }.delete_if { |_, v| v.nil? }
570
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::ListInspectFindingsRequest)
571
+ @list_inspect_findings.call(req, options)
572
+ end
573
+
574
+ # Returns sensitive information types for given category.
575
+ #
576
+ # @param category [String]
577
+ # Category name as returned by ListRootCategories.
578
+ # @param language_code [String]
579
+ # Optional BCP-47 language code for localized info type friendly
580
+ # names. If omitted, or if localized strings are not available,
581
+ # en-US strings will be returned.
582
+ # @param options [Google::Gax::CallOptions]
583
+ # Overrides the default settings for this call, e.g, timeout,
584
+ # retries, etc.
585
+ # @return [Google::Privacy::Dlp::V2beta1::ListInfoTypesResponse]
586
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
587
+ # @example
588
+ # require "google/cloud/dlp/v2beta1"
589
+ #
590
+ # dlp_service_client = Google::Cloud::Dlp::V2beta1.new
591
+ # category = "PII"
592
+ # language_code = "en"
593
+ # response = dlp_service_client.list_info_types(category, language_code)
594
+
595
+ def list_info_types \
596
+ category,
597
+ language_code,
598
+ options: nil
599
+ req = {
600
+ category: category,
601
+ language_code: language_code
602
+ }.delete_if { |_, v| v.nil? }
603
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::ListInfoTypesRequest)
604
+ @list_info_types.call(req, options)
605
+ end
606
+
607
+ # Returns the list of root categories of sensitive information.
608
+ #
609
+ # @param language_code [String]
610
+ # Optional language code for localized friendly category names.
611
+ # If omitted or if localized strings are not available,
612
+ # en-US strings will be returned.
613
+ # @param options [Google::Gax::CallOptions]
614
+ # Overrides the default settings for this call, e.g, timeout,
615
+ # retries, etc.
616
+ # @return [Google::Privacy::Dlp::V2beta1::ListRootCategoriesResponse]
617
+ # @raise [Google::Gax::GaxError] if the RPC is aborted.
618
+ # @example
619
+ # require "google/cloud/dlp/v2beta1"
620
+ #
621
+ # dlp_service_client = Google::Cloud::Dlp::V2beta1.new
622
+ # language_code = "en"
623
+ # response = dlp_service_client.list_root_categories(language_code)
624
+
625
+ def list_root_categories \
626
+ language_code,
627
+ options: nil
628
+ req = {
629
+ language_code: language_code
630
+ }.delete_if { |_, v| v.nil? }
631
+ req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::ListRootCategoriesRequest)
632
+ @list_root_categories.call(req, options)
633
+ end
634
+ end
635
+ end
636
+ end
637
+ end
638
+ end