Class: Google::Cloud::Dlp::V2beta1::DlpServiceClient

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/dlp/v2beta1/dlp_service_client.rb

Overview

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.

Defined Under Namespace

Classes: OperationsClient

Constant Summary collapse

SERVICE_ADDRESS =

The default address of the service.

"dlp.googleapis.com".freeze
DEFAULT_SERVICE_PORT =

The default port of the service.

443
DEFAULT_TIMEOUT =
30
ALL_SCOPES =

The scopes needed to make gRPC calls to all of the methods defined in this service.

[
  "https://www.googleapis.com/auth/cloud-platform"
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(credentials: nil, scopes: ALL_SCOPES, client_config: {}, timeout: DEFAULT_TIMEOUT, lib_name: nil, lib_version: "") ⇒ DlpServiceClient

Returns a new instance of DlpServiceClient

Parameters:

  • credentials (Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc)

    Provides the means for authenticating requests made by the client. This parameter can be many types. A Google::Auth::Credentials uses a the properties of its represented keyfile for authenticating requests made by this client. A String will be treated as the path to the keyfile to be used for the construction of credentials for this client. A Hash will be treated as the contents of a keyfile to be used for the construction of credentials for this client. A GRPC::Core::Channel will be used to make calls through. A GRPC::Core::ChannelCredentials for the setting up the RPC client. The channel credentials should already be composed with a GRPC::Core::CallCredentials object. A Proc will be used as an updater_proc for the Grpc channel. The proc transforms the metadata for requests, generally, to give OAuth credentials.

  • scopes (Array<String>)

    The OAuth scopes for this service. This parameter is ignored if an updater_proc is supplied.

  • client_config (Hash)

    A Hash for call options for each method. See Google::Gax#construct_settings for the structure of this data. Falls back to the default config if not specified or the specified config is missing data points.

  • timeout (Numeric)

    The default timeout, in seconds, for calls made through this client.



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/google/cloud/dlp/v2beta1/dlp_service_client.rb', line 108

def initialize \
    credentials: nil,
    scopes: ALL_SCOPES,
    client_config: {},
    timeout: DEFAULT_TIMEOUT,
    lib_name: nil,
    lib_version: ""
  # These require statements are intentionally placed here to initialize
  # the gRPC module only when it's required.
  # See https://github.com/googleapis/toolkit/issues/446
  require "google/gax/grpc"
  require "google/privacy/dlp/v2beta1/dlp_services_pb"

  credentials ||= Google::Cloud::Dlp::Credentials.default

  @operations_client = OperationsClient.new(
    credentials: credentials,
    scopes: scopes,
    client_config: client_config,
    timeout: timeout,
    lib_name: lib_name,
    lib_version: lib_version,
  )

  if credentials.is_a?(String) || credentials.is_a?(Hash)
    updater_proc = Google::Cloud::Dlp::Credentials.new(credentials).updater_proc
  end
  if credentials.is_a?(GRPC::Core::Channel)
    channel = credentials
  end
  if credentials.is_a?(GRPC::Core::ChannelCredentials)
    chan_creds = credentials
  end
  if credentials.is_a?(Proc)
    updater_proc = credentials
  end
  if credentials.is_a?(Google::Auth::Credentials)
    updater_proc = credentials.updater_proc
  end

  package_version = Gem.loaded_specs['google-cloud-dlp'].version.version

  google_api_client = "gl-ruby/#{RUBY_VERSION}"
  google_api_client << " #{lib_name}/#{lib_version}" if lib_name
  google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
  google_api_client << " grpc/#{GRPC::VERSION}"
  google_api_client.freeze

  headers = { :"x-goog-api-client" => google_api_client }
  client_config_file = Pathname.new(__dir__).join(
    "dlp_service_client_config.json"
  )
  defaults = client_config_file.open do |f|
    Google::Gax.construct_settings(
      "google.privacy.dlp.v2beta1.DlpService",
      JSON.parse(f.read),
      client_config,
      Google::Gax::Grpc::STATUS_CODE_NAMES,
      timeout,
      errors: Google::Gax::Grpc::API_ERRORS,
      kwargs: headers
    )
  end

  # Allow overriding the service path/port in subclasses.
  service_path = self.class::SERVICE_ADDRESS
  port = self.class::DEFAULT_SERVICE_PORT
  @dlp_service_stub = Google::Gax::Grpc.create_stub(
    service_path,
    port,
    chan_creds: chan_creds,
    channel: channel,
    updater_proc: updater_proc,
    scopes: scopes,
    &Google::Privacy::Dlp::V2beta1::DlpService::Stub.method(:new)
  )

  @inspect_content = Google::Gax.create_api_call(
    @dlp_service_stub.method(:inspect_content),
    defaults["inspect_content"]
  )
  @redact_content = Google::Gax.create_api_call(
    @dlp_service_stub.method(:redact_content),
    defaults["redact_content"]
  )
  @deidentify_content = Google::Gax.create_api_call(
    @dlp_service_stub.method(:deidentify_content),
    defaults["deidentify_content"]
  )
  @analyze_data_source_risk = Google::Gax.create_api_call(
    @dlp_service_stub.method(:analyze_data_source_risk),
    defaults["analyze_data_source_risk"]
  )
  @create_inspect_operation = Google::Gax.create_api_call(
    @dlp_service_stub.method(:create_inspect_operation),
    defaults["create_inspect_operation"]
  )
  @list_inspect_findings = Google::Gax.create_api_call(
    @dlp_service_stub.method(:list_inspect_findings),
    defaults["list_inspect_findings"]
  )
  @list_info_types = Google::Gax.create_api_call(
    @dlp_service_stub.method(:list_info_types),
    defaults["list_info_types"]
  )
  @list_root_categories = Google::Gax.create_api_call(
    @dlp_service_stub.method(:list_root_categories),
    defaults["list_root_categories"]
  )
end

Instance Attribute Details

#dlp_service_stubGoogle::Privacy::Dlp::V2beta1::DlpService::Stub (readonly)

Returns:

  • (Google::Privacy::Dlp::V2beta1::DlpService::Stub)


48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
# File 'lib/google/cloud/dlp/v2beta1/dlp_service_client.rb', line 48

class DlpServiceClient
  attr_reader :dlp_service_stub

  # The default address of the service.
  SERVICE_ADDRESS = "dlp.googleapis.com".freeze

  # The default port of the service.
  DEFAULT_SERVICE_PORT = 443

  DEFAULT_TIMEOUT = 30

  # The scopes needed to make gRPC calls to all of the methods defined in
  # this service.
  ALL_SCOPES = [
    "https://www.googleapis.com/auth/cloud-platform"
  ].freeze

  class OperationsClient < Google::Longrunning::OperationsClient
    SERVICE_ADDRESS = SERVICE_ADDRESS
  end

  RESULT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "inspect/results/{result}"
  )

  private_constant :RESULT_PATH_TEMPLATE

  # Returns a fully-qualified result resource name string.
  # @param result [String]
  # @return [String]
  def self.result_path result
    RESULT_PATH_TEMPLATE.render(
      :"result" => result
    )
  end

  # @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
  #   Provides the means for authenticating requests made by the client. This parameter can
  #   be many types.
  #   A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
  #   authenticating requests made by this client.
  #   A `String` will be treated as the path to the keyfile to be used for the construction of
  #   credentials for this client.
  #   A `Hash` will be treated as the contents of a keyfile to be used for the construction of
  #   credentials for this client.
  #   A `GRPC::Core::Channel` will be used to make calls through.
  #   A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
  #   should already be composed with a `GRPC::Core::CallCredentials` object.
  #   A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
  #   metadata for requests, generally, to give OAuth credentials.
  # @param scopes [Array<String>]
  #   The OAuth scopes for this service. This parameter is ignored if
  #   an updater_proc is supplied.
  # @param client_config [Hash]
  #   A Hash for call options for each method. See
  #   Google::Gax#construct_settings for the structure of
  #   this data. Falls back to the default config if not specified
  #   or the specified config is missing data points.
  # @param timeout [Numeric]
  #   The default timeout, in seconds, for calls made through this client.
  def initialize \
      credentials: nil,
      scopes: ALL_SCOPES,
      client_config: {},
      timeout: DEFAULT_TIMEOUT,
      lib_name: nil,
      lib_version: ""
    # These require statements are intentionally placed here to initialize
    # the gRPC module only when it's required.
    # See https://github.com/googleapis/toolkit/issues/446
    require "google/gax/grpc"
    require "google/privacy/dlp/v2beta1/dlp_services_pb"

    credentials ||= Google::Cloud::Dlp::Credentials.default

    @operations_client = OperationsClient.new(
      credentials: credentials,
      scopes: scopes,
      client_config: client_config,
      timeout: timeout,
      lib_name: lib_name,
      lib_version: lib_version,
    )

    if credentials.is_a?(String) || credentials.is_a?(Hash)
      updater_proc = Google::Cloud::Dlp::Credentials.new(credentials).updater_proc
    end
    if credentials.is_a?(GRPC::Core::Channel)
      channel = credentials
    end
    if credentials.is_a?(GRPC::Core::ChannelCredentials)
      chan_creds = credentials
    end
    if credentials.is_a?(Proc)
      updater_proc = credentials
    end
    if credentials.is_a?(Google::Auth::Credentials)
      updater_proc = credentials.updater_proc
    end

    package_version = Gem.loaded_specs['google-cloud-dlp'].version.version

    google_api_client = "gl-ruby/#{RUBY_VERSION}"
    google_api_client << " #{lib_name}/#{lib_version}" if lib_name
    google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
    google_api_client << " grpc/#{GRPC::VERSION}"
    google_api_client.freeze

    headers = { :"x-goog-api-client" => google_api_client }
    client_config_file = Pathname.new(__dir__).join(
      "dlp_service_client_config.json"
    )
    defaults = client_config_file.open do |f|
      Google::Gax.construct_settings(
        "google.privacy.dlp.v2beta1.DlpService",
        JSON.parse(f.read),
        client_config,
        Google::Gax::Grpc::STATUS_CODE_NAMES,
        timeout,
        errors: Google::Gax::Grpc::API_ERRORS,
        kwargs: headers
      )
    end

    # Allow overriding the service path/port in subclasses.
    service_path = self.class::SERVICE_ADDRESS
    port = self.class::DEFAULT_SERVICE_PORT
    @dlp_service_stub = Google::Gax::Grpc.create_stub(
      service_path,
      port,
      chan_creds: chan_creds,
      channel: channel,
      updater_proc: updater_proc,
      scopes: scopes,
      &Google::Privacy::Dlp::V2beta1::DlpService::Stub.method(:new)
    )

    @inspect_content = Google::Gax.create_api_call(
      @dlp_service_stub.method(:inspect_content),
      defaults["inspect_content"]
    )
    @redact_content = Google::Gax.create_api_call(
      @dlp_service_stub.method(:redact_content),
      defaults["redact_content"]
    )
    @deidentify_content = Google::Gax.create_api_call(
      @dlp_service_stub.method(:deidentify_content),
      defaults["deidentify_content"]
    )
    @analyze_data_source_risk = Google::Gax.create_api_call(
      @dlp_service_stub.method(:analyze_data_source_risk),
      defaults["analyze_data_source_risk"]
    )
    @create_inspect_operation = Google::Gax.create_api_call(
      @dlp_service_stub.method(:create_inspect_operation),
      defaults["create_inspect_operation"]
    )
    @list_inspect_findings = Google::Gax.create_api_call(
      @dlp_service_stub.method(:list_inspect_findings),
      defaults["list_inspect_findings"]
    )
    @list_info_types = Google::Gax.create_api_call(
      @dlp_service_stub.method(:list_info_types),
      defaults["list_info_types"]
    )
    @list_root_categories = Google::Gax.create_api_call(
      @dlp_service_stub.method(:list_root_categories),
      defaults["list_root_categories"]
    )
  end

  # Service calls

  # Finds potentially sensitive info in a list of strings.
  # This method has limits on input size, processing time, and output size.
  #
  # @param inspect_config [Google::Privacy::Dlp::V2beta1::InspectConfig | Hash]
  #   Configuration for the inspector.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::InspectConfig`
  #   can also be provided.
  # @param items [Array<Google::Privacy::Dlp::V2beta1::ContentItem | Hash>]
  #   The list of items to inspect. Items in a single request are
  #   considered "related" unless inspect_config.independent_inputs is true.
  #   Up to 100 are allowed per request.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::ContentItem`
  #   can also be provided.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @return [Google::Privacy::Dlp::V2beta1::InspectContentResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp/v2beta1"
  #
  #   dlp_service_client = Google::Cloud::Dlp::V2beta1.new
  #   name = "EMAIL_ADDRESS"
  #   info_types_element = { name: name }
  #   info_types = [info_types_element]
  #   inspect_config = { info_types: info_types }
  #   type = "text/plain"
  #   value = "My email is example@example.com."
  #   items_element = { type: type, value: value }
  #   items = [items_element]
  #   response = dlp_service_client.inspect_content(inspect_config, items)

  def inspect_content \
      inspect_config,
      items,
      options: nil
    req = {
      inspect_config: inspect_config,
      items: items
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::InspectContentRequest)
    @inspect_content.call(req, options)
  end

  # Redacts potentially sensitive info from a list of strings.
  # This method has limits on input size, processing time, and output size.
  #
  # @param inspect_config [Google::Privacy::Dlp::V2beta1::InspectConfig | Hash]
  #   Configuration for the inspector.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::InspectConfig`
  #   can also be provided.
  # @param items [Array<Google::Privacy::Dlp::V2beta1::ContentItem | Hash>]
  #   The list of items to inspect. Up to 100 are allowed per request.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::ContentItem`
  #   can also be provided.
  # @param replace_configs [Array<Google::Privacy::Dlp::V2beta1::RedactContentRequest::ReplaceConfig | Hash>]
  #   The strings to replace findings text findings with. Must specify at least
  #   one of these or one ImageRedactionConfig if redacting images.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::RedactContentRequest::ReplaceConfig`
  #   can also be provided.
  # @param image_redaction_configs [Array<Google::Privacy::Dlp::V2beta1::RedactContentRequest::ImageRedactionConfig | Hash>]
  #   The configuration for specifying what content to redact from images.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::RedactContentRequest::ImageRedactionConfig`
  #   can also be provided.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @return [Google::Privacy::Dlp::V2beta1::RedactContentResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp/v2beta1"
  #
  #   dlp_service_client = Google::Cloud::Dlp::V2beta1.new
  #   name = "EMAIL_ADDRESS"
  #   info_types_element = { name: name }
  #   info_types = [info_types_element]
  #   inspect_config = { info_types: info_types }
  #   type = "text/plain"
  #   value = "My email is example@example.com."
  #   items_element = { type: type, value: value }
  #   items = [items_element]
  #   response = dlp_service_client.redact_content(inspect_config, items)

  def redact_content \
      inspect_config,
      items,
      replace_configs: nil,
      image_redaction_configs: nil,
      options: nil
    req = {
      inspect_config: inspect_config,
      items: items,
      replace_configs: replace_configs,
      image_redaction_configs: image_redaction_configs
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::RedactContentRequest)
    @redact_content.call(req, options)
  end

  # De-identifies potentially sensitive info from a list of strings.
  # This method has limits on input size and output size.
  #
  # @param deidentify_config [Google::Privacy::Dlp::V2beta1::DeidentifyConfig | Hash]
  #   Configuration for the de-identification of the list of content items.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::DeidentifyConfig`
  #   can also be provided.
  # @param inspect_config [Google::Privacy::Dlp::V2beta1::InspectConfig | Hash]
  #   Configuration for the inspector.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::InspectConfig`
  #   can also be provided.
  # @param items [Array<Google::Privacy::Dlp::V2beta1::ContentItem | Hash>]
  #   The list of items to inspect. Up to 100 are allowed per request.
  #   All items will be treated as text/*.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::ContentItem`
  #   can also be provided.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @return [Google::Privacy::Dlp::V2beta1::DeidentifyContentResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp/v2beta1"
  #
  #   dlp_service_client = Google::Cloud::Dlp::V2beta1.new
  #   deidentify_config = {}
  #   inspect_config = {}
  #   items = []
  #   response = dlp_service_client.deidentify_content(deidentify_config, inspect_config, items)

  def deidentify_content \
      deidentify_config,
      inspect_config,
      items,
      options: nil
    req = {
      deidentify_config: deidentify_config,
      inspect_config: inspect_config,
      items: items
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::DeidentifyContentRequest)
    @deidentify_content.call(req, options)
  end

  # Schedules a job to compute risk analysis metrics over content in a Google
  # Cloud Platform repository.
  #
  # @param privacy_metric [Google::Privacy::Dlp::V2beta1::PrivacyMetric | Hash]
  #   Privacy metric to compute.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::PrivacyMetric`
  #   can also be provided.
  # @param source_table [Google::Privacy::Dlp::V2beta1::BigQueryTable | Hash]
  #   Input dataset to compute metrics over.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::BigQueryTable`
  #   can also be provided.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @return [Google::Gax::Operation]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp/v2beta1"
  #
  #   dlp_service_client = Google::Cloud::Dlp::V2beta1.new
  #   privacy_metric = {}
  #   source_table = {}
  #
  #   # Register a callback during the method call.
  #   operation = dlp_service_client.analyze_data_source_risk(privacy_metric, source_table) do |op|
  #     raise op.results.message if op.error?
  #     op_results = op.results
  #     # Process the results.
  #
  #     metadata = op.metadata
  #     # Process the metadata.
  #   end
  #
  #   # Or use the return value to register a callback.
  #   operation.on_done do |op|
  #     raise op.results.message if op.error?
  #     op_results = op.results
  #     # Process the results.
  #
  #     metadata = op.metadata
  #     # Process the metadata.
  #   end
  #
  #   # Manually reload the operation.
  #   operation.reload!
  #
  #   # Or block until the operation completes, triggering callbacks on
  #   # completion.
  #   operation.wait_until_done!

  def analyze_data_source_risk \
      privacy_metric,
      source_table,
      options: nil
    req = {
      privacy_metric: privacy_metric,
      source_table: source_table
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::AnalyzeDataSourceRiskRequest)
    operation = Google::Gax::Operation.new(
      @analyze_data_source_risk.call(req, options),
      @operations_client,
      Google::Privacy::Dlp::V2beta1::RiskAnalysisOperationResult,
      Google::Privacy::Dlp::V2beta1::RiskAnalysisOperationMetadata,
      call_options: options
    )
    operation.on_done { |operation| yield(operation) } if block_given?
    operation
  end

  # Schedules a job scanning content in a Google Cloud Platform data
  # repository.
  #
  # @param inspect_config [Google::Privacy::Dlp::V2beta1::InspectConfig | Hash]
  #   Configuration for the inspector.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::InspectConfig`
  #   can also be provided.
  # @param storage_config [Google::Privacy::Dlp::V2beta1::StorageConfig | Hash]
  #   Specification of the data set to process.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::StorageConfig`
  #   can also be provided.
  # @param output_config [Google::Privacy::Dlp::V2beta1::OutputStorageConfig | Hash]
  #   Optional location to store findings.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::OutputStorageConfig`
  #   can also be provided.
  # @param operation_config [Google::Privacy::Dlp::V2beta1::OperationConfig | Hash]
  #   Additional configuration settings for long running operations.
  #   A hash of the same form as `Google::Privacy::Dlp::V2beta1::OperationConfig`
  #   can also be provided.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @return [Google::Gax::Operation]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp/v2beta1"
  #
  #   dlp_service_client = Google::Cloud::Dlp::V2beta1.new
  #   name = "EMAIL_ADDRESS"
  #   info_types_element = { name: name }
  #   info_types = [info_types_element]
  #   inspect_config = { info_types: info_types }
  #   url = "gs://example_bucket/example_file.png"
  #   file_set = { url: url }
  #   cloud_storage_options = { file_set: file_set }
  #   storage_config = { cloud_storage_options: cloud_storage_options }
  #   output_config = {}
  #
  #   # Register a callback during the method call.
  #   operation = dlp_service_client.create_inspect_operation(inspect_config, storage_config, output_config) do |op|
  #     raise op.results.message if op.error?
  #     op_results = op.results
  #     # Process the results.
  #
  #     metadata = op.metadata
  #     # Process the metadata.
  #   end
  #
  #   # Or use the return value to register a callback.
  #   operation.on_done do |op|
  #     raise op.results.message if op.error?
  #     op_results = op.results
  #     # Process the results.
  #
  #     metadata = op.metadata
  #     # Process the metadata.
  #   end
  #
  #   # Manually reload the operation.
  #   operation.reload!
  #
  #   # Or block until the operation completes, triggering callbacks on
  #   # completion.
  #   operation.wait_until_done!

  def create_inspect_operation \
      inspect_config,
      storage_config,
      output_config,
      operation_config: nil,
      options: nil
    req = {
      inspect_config: inspect_config,
      storage_config: storage_config,
      output_config: output_config,
      operation_config: operation_config
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::CreateInspectOperationRequest)
    operation = Google::Gax::Operation.new(
      @create_inspect_operation.call(req, options),
      @operations_client,
      Google::Privacy::Dlp::V2beta1::InspectOperationResult,
      Google::Privacy::Dlp::V2beta1::InspectOperationMetadata,
      call_options: options
    )
    operation.on_done { |operation| yield(operation) } if block_given?
    operation
  end

  # Returns list of results for given inspect operation result set id.
  #
  # @param name [String]
  #   Identifier of the results set returned as metadata of
  #   the longrunning operation created by a call to InspectDataSource.
  #   Should be in the format of +inspect/results/{id}+.
  # @param page_size [Integer]
  #   Maximum number of results to return.
  #   If 0, the implementation selects a reasonable value.
  # @param page_token [String]
  #   The value returned by the last +ListInspectFindingsResponse+; indicates
  #   that this is a continuation of a prior +ListInspectFindings+ call, and that
  #   the system should return the next page of data.
  # @param filter [String]
  #   Restricts findings to items that match. Supports info_type and likelihood.
  #
  #   Examples:
  #
  #   * info_type=EMAIL_ADDRESS
  #   * info_type=PHONE_NUMBER,EMAIL_ADDRESS
  #   * likelihood=VERY_LIKELY
  #   * likelihood=VERY_LIKELY,LIKELY
  #   * info_type=EMAIL_ADDRESS,likelihood=VERY_LIKELY,LIKELY
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @return [Google::Privacy::Dlp::V2beta1::ListInspectFindingsResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp/v2beta1"
  #
  #   dlp_service_client = Google::Cloud::Dlp::V2beta1.new
  #   formatted_name = Google::Cloud::Dlp::V2beta1::DlpServiceClient.result_path("[RESULT]")
  #   response = dlp_service_client.list_inspect_findings(formatted_name)

  def list_inspect_findings \
      name,
      page_size: nil,
      page_token: nil,
      filter: nil,
      options: nil
    req = {
      name: name,
      page_size: page_size,
      page_token: page_token,
      filter: filter
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::ListInspectFindingsRequest)
    @list_inspect_findings.call(req, options)
  end

  # Returns sensitive information types for given category.
  #
  # @param category [String]
  #   Category name as returned by ListRootCategories.
  # @param language_code [String]
  #   Optional BCP-47 language code for localized info type friendly
  #   names. If omitted, or if localized strings are not available,
  #   en-US strings will be returned.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @return [Google::Privacy::Dlp::V2beta1::ListInfoTypesResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp/v2beta1"
  #
  #   dlp_service_client = Google::Cloud::Dlp::V2beta1.new
  #   category = "PII"
  #   language_code = "en"
  #   response = dlp_service_client.list_info_types(category, language_code)

  def list_info_types \
      category,
      language_code,
      options: nil
    req = {
      category: category,
      language_code: language_code
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::ListInfoTypesRequest)
    @list_info_types.call(req, options)
  end

  # Returns the list of root categories of sensitive information.
  #
  # @param language_code [String]
  #   Optional language code for localized friendly category names.
  #   If omitted or if localized strings are not available,
  #   en-US strings will be returned.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @return [Google::Privacy::Dlp::V2beta1::ListRootCategoriesResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp/v2beta1"
  #
  #   dlp_service_client = Google::Cloud::Dlp::V2beta1.new
  #   language_code = "en"
  #   response = dlp_service_client.list_root_categories(language_code)

  def list_root_categories \
      language_code,
      options: nil
    req = {
      language_code: language_code
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::ListRootCategoriesRequest)
    @list_root_categories.call(req, options)
  end
end

Class Method Details

.result_path(result) ⇒ String

Returns a fully-qualified result resource name string.

Parameters:

  • result (String)

Returns:

  • (String)


78
79
80
81
82
# File 'lib/google/cloud/dlp/v2beta1/dlp_service_client.rb', line 78

def self.result_path result
  RESULT_PATH_TEMPLATE.render(
    :"result" => result
  )
end

Instance Method Details

#analyze_data_source_risk(privacy_metric, source_table, options: nil) ⇒ Google::Gax::Operation

Schedules a job to compute risk analysis metrics over content in a Google Cloud Platform repository.

Examples:

require "google/cloud/dlp/v2beta1"

dlp_service_client = Google::Cloud::Dlp::V2beta1.new
privacy_metric = {}
source_table = {}

# Register a callback during the method call.
operation = dlp_service_client.analyze_data_source_risk(privacy_metric, source_table) do |op|
  raise op.results.message if op.error?
  op_results = op.results
  # Process the results.

   = op.
  # Process the metadata.
end

# Or use the return value to register a callback.
operation.on_done do |op|
  raise op.results.message if op.error?
  op_results = op.results
  # Process the results.

   = op.
  # Process the metadata.
end

# Manually reload the operation.
operation.reload!

# Or block until the operation completes, triggering callbacks on
# completion.
operation.wait_until_done!

Parameters:

  • privacy_metric (Google::Privacy::Dlp::V2beta1::PrivacyMetric | Hash)

    Privacy metric to compute. A hash of the same form as Google::Privacy::Dlp::V2beta1::PrivacyMetric can also be provided.

  • source_table (Google::Privacy::Dlp::V2beta1::BigQueryTable | Hash)

    Input dataset to compute metrics over. A hash of the same form as Google::Privacy::Dlp::V2beta1::BigQueryTable can also be provided.

  • options (Google::Gax::CallOptions)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Returns:

  • (Google::Gax::Operation)

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/google/cloud/dlp/v2beta1/dlp_service_client.rb', line 414

def analyze_data_source_risk \
    privacy_metric,
    source_table,
    options: nil
  req = {
    privacy_metric: privacy_metric,
    source_table: source_table
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::AnalyzeDataSourceRiskRequest)
  operation = Google::Gax::Operation.new(
    @analyze_data_source_risk.call(req, options),
    @operations_client,
    Google::Privacy::Dlp::V2beta1::RiskAnalysisOperationResult,
    Google::Privacy::Dlp::V2beta1::RiskAnalysisOperationMetadata,
    call_options: options
  )
  operation.on_done { |operation| yield(operation) } if block_given?
  operation
end

#create_inspect_operation(inspect_config, storage_config, output_config, operation_config: nil, options: nil) ⇒ Google::Gax::Operation

Schedules a job scanning content in a Google Cloud Platform data repository.

Examples:

require "google/cloud/dlp/v2beta1"

dlp_service_client = Google::Cloud::Dlp::V2beta1.new
name = "EMAIL_ADDRESS"
info_types_element = { name: name }
info_types = [info_types_element]
inspect_config = { info_types: info_types }
url = "gs://example_bucket/example_file.png"
file_set = { url: url }
cloud_storage_options = { file_set: file_set }
storage_config = { cloud_storage_options: cloud_storage_options }
output_config = {}

# Register a callback during the method call.
operation = dlp_service_client.create_inspect_operation(inspect_config, storage_config, output_config) do |op|
  raise op.results.message if op.error?
  op_results = op.results
  # Process the results.

   = op.
  # Process the metadata.
end

# Or use the return value to register a callback.
operation.on_done do |op|
  raise op.results.message if op.error?
  op_results = op.results
  # Process the results.

   = op.
  # Process the metadata.
end

# Manually reload the operation.
operation.reload!

# Or block until the operation completes, triggering callbacks on
# completion.
operation.wait_until_done!

Parameters:

  • inspect_config (Google::Privacy::Dlp::V2beta1::InspectConfig | Hash)

    Configuration for the inspector. A hash of the same form as Google::Privacy::Dlp::V2beta1::InspectConfig can also be provided.

  • storage_config (Google::Privacy::Dlp::V2beta1::StorageConfig | Hash)

    Specification of the data set to process. A hash of the same form as Google::Privacy::Dlp::V2beta1::StorageConfig can also be provided.

  • output_config (Google::Privacy::Dlp::V2beta1::OutputStorageConfig | Hash)

    Optional location to store findings. A hash of the same form as Google::Privacy::Dlp::V2beta1::OutputStorageConfig can also be provided.

  • operation_config (Google::Privacy::Dlp::V2beta1::OperationConfig | Hash)

    Additional configuration settings for long running operations. A hash of the same form as Google::Privacy::Dlp::V2beta1::OperationConfig can also be provided.

  • options (Google::Gax::CallOptions)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Returns:

  • (Google::Gax::Operation)

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/google/cloud/dlp/v2beta1/dlp_service_client.rb', line 499

def create_inspect_operation \
    inspect_config,
    storage_config,
    output_config,
    operation_config: nil,
    options: nil
  req = {
    inspect_config: inspect_config,
    storage_config: storage_config,
    output_config: output_config,
    operation_config: operation_config
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::CreateInspectOperationRequest)
  operation = Google::Gax::Operation.new(
    @create_inspect_operation.call(req, options),
    @operations_client,
    Google::Privacy::Dlp::V2beta1::InspectOperationResult,
    Google::Privacy::Dlp::V2beta1::InspectOperationMetadata,
    call_options: options
  )
  operation.on_done { |operation| yield(operation) } if block_given?
  operation
end

#deidentify_content(deidentify_config, inspect_config, items, options: nil) ⇒ Google::Privacy::Dlp::V2beta1::DeidentifyContentResponse

De-identifies potentially sensitive info from a list of strings. This method has limits on input size and output size.

Examples:

require "google/cloud/dlp/v2beta1"

dlp_service_client = Google::Cloud::Dlp::V2beta1.new
deidentify_config = {}
inspect_config = {}
items = []
response = dlp_service_client.deidentify_content(deidentify_config, inspect_config, items)

Parameters:

  • deidentify_config (Google::Privacy::Dlp::V2beta1::DeidentifyConfig | Hash)

    Configuration for the de-identification of the list of content items. A hash of the same form as Google::Privacy::Dlp::V2beta1::DeidentifyConfig can also be provided.

  • inspect_config (Google::Privacy::Dlp::V2beta1::InspectConfig | Hash)

    Configuration for the inspector. A hash of the same form as Google::Privacy::Dlp::V2beta1::InspectConfig can also be provided.

  • items (Array<Google::Privacy::Dlp::V2beta1::ContentItem | Hash>)

    The list of items to inspect. Up to 100 are allowed per request. All items will be treated as text/*. A hash of the same form as Google::Privacy::Dlp::V2beta1::ContentItem can also be provided.

  • options (Google::Gax::CallOptions)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/google/cloud/dlp/v2beta1/dlp_service_client.rb', line 350

def deidentify_content \
    deidentify_config,
    inspect_config,
    items,
    options: nil
  req = {
    deidentify_config: deidentify_config,
    inspect_config: inspect_config,
    items: items
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::DeidentifyContentRequest)
  @deidentify_content.call(req, options)
end

#inspect_content(inspect_config, items, options: nil) ⇒ Google::Privacy::Dlp::V2beta1::InspectContentResponse

Finds potentially sensitive info in a list of strings. This method has limits on input size, processing time, and output size.

Examples:

require "google/cloud/dlp/v2beta1"

dlp_service_client = Google::Cloud::Dlp::V2beta1.new
name = "EMAIL_ADDRESS"
info_types_element = { name: name }
info_types = [info_types_element]
inspect_config = { info_types: info_types }
type = "text/plain"
value = "My email is example@example.com."
items_element = { type: type, value: value }
items = [items_element]
response = dlp_service_client.inspect_content(inspect_config, items)

Parameters:

  • inspect_config (Google::Privacy::Dlp::V2beta1::InspectConfig | Hash)

    Configuration for the inspector. A hash of the same form as Google::Privacy::Dlp::V2beta1::InspectConfig can also be provided.

  • items (Array<Google::Privacy::Dlp::V2beta1::ContentItem | Hash>)

    The list of items to inspect. Items in a single request are considered "related" unless inspect_config.independent_inputs is true. Up to 100 are allowed per request. A hash of the same form as Google::Privacy::Dlp::V2beta1::ContentItem can also be provided.

  • options (Google::Gax::CallOptions)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



253
254
255
256
257
258
259
260
261
262
263
# File 'lib/google/cloud/dlp/v2beta1/dlp_service_client.rb', line 253

def inspect_content \
    inspect_config,
    items,
    options: nil
  req = {
    inspect_config: inspect_config,
    items: items
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::InspectContentRequest)
  @inspect_content.call(req, options)
end

#list_info_types(category, language_code, options: nil) ⇒ Google::Privacy::Dlp::V2beta1::ListInfoTypesResponse

Returns sensitive information types for given category.

Examples:

require "google/cloud/dlp/v2beta1"

dlp_service_client = Google::Cloud::Dlp::V2beta1.new
category = "PII"
language_code = "en"
response = dlp_service_client.list_info_types(category, language_code)

Parameters:

  • category (String)

    Category name as returned by ListRootCategories.

  • language_code (String)

    Optional BCP-47 language code for localized info type friendly names. If omitted, or if localized strings are not available, en-US strings will be returned.

  • options (Google::Gax::CallOptions)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



595
596
597
598
599
600
601
602
603
604
605
# File 'lib/google/cloud/dlp/v2beta1/dlp_service_client.rb', line 595

def list_info_types \
    category,
    language_code,
    options: nil
  req = {
    category: category,
    language_code: language_code
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::ListInfoTypesRequest)
  @list_info_types.call(req, options)
end

#list_inspect_findings(name, page_size: nil, page_token: nil, filter: nil, options: nil) ⇒ Google::Privacy::Dlp::V2beta1::ListInspectFindingsResponse

Returns list of results for given inspect operation result set id.

Examples:

require "google/cloud/dlp/v2beta1"

dlp_service_client = Google::Cloud::Dlp::V2beta1.new
formatted_name = Google::Cloud::Dlp::V2beta1::DlpServiceClient.result_path("[RESULT]")
response = dlp_service_client.list_inspect_findings(formatted_name)

Parameters:

  • name (String)

    Identifier of the results set returned as metadata of the longrunning operation created by a call to InspectDataSource. Should be in the format of +inspect/results/id+.

  • page_size (Integer)

    Maximum number of results to return. If 0, the implementation selects a reasonable value.

  • page_token (String)

    The value returned by the last +ListInspectFindingsResponse+; indicates that this is a continuation of a prior +ListInspectFindings+ call, and that the system should return the next page of data.

  • filter (String)

    Restricts findings to items that match. Supports info_type and likelihood.

    Examples:

    • info_type=EMAIL_ADDRESS
    • info_type=PHONE_NUMBER,EMAIL_ADDRESS
    • likelihood=VERY_LIKELY
    • likelihood=VERY_LIKELY,LIKELY
    • info_type=EMAIL_ADDRESS,likelihood=VERY_LIKELY,LIKELY
  • options (Google::Gax::CallOptions)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
# File 'lib/google/cloud/dlp/v2beta1/dlp_service_client.rb', line 558

def list_inspect_findings \
    name,
    page_size: nil,
    page_token: nil,
    filter: nil,
    options: nil
  req = {
    name: name,
    page_size: page_size,
    page_token: page_token,
    filter: filter
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::ListInspectFindingsRequest)
  @list_inspect_findings.call(req, options)
end

#list_root_categories(language_code, options: nil) ⇒ Google::Privacy::Dlp::V2beta1::ListRootCategoriesResponse

Returns the list of root categories of sensitive information.

Examples:

require "google/cloud/dlp/v2beta1"

dlp_service_client = Google::Cloud::Dlp::V2beta1.new
language_code = "en"
response = dlp_service_client.list_root_categories(language_code)

Parameters:

  • language_code (String)

    Optional language code for localized friendly category names. If omitted or if localized strings are not available, en-US strings will be returned.

  • options (Google::Gax::CallOptions)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



625
626
627
628
629
630
631
632
633
# File 'lib/google/cloud/dlp/v2beta1/dlp_service_client.rb', line 625

def list_root_categories \
    language_code,
    options: nil
  req = {
    language_code: language_code
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::ListRootCategoriesRequest)
  @list_root_categories.call(req, options)
end

#redact_content(inspect_config, items, replace_configs: nil, image_redaction_configs: nil, options: nil) ⇒ Google::Privacy::Dlp::V2beta1::RedactContentResponse

Redacts potentially sensitive info from a list of strings. This method has limits on input size, processing time, and output size.

Examples:

require "google/cloud/dlp/v2beta1"

dlp_service_client = Google::Cloud::Dlp::V2beta1.new
name = "EMAIL_ADDRESS"
info_types_element = { name: name }
info_types = [info_types_element]
inspect_config = { info_types: info_types }
type = "text/plain"
value = "My email is example@example.com."
items_element = { type: type, value: value }
items = [items_element]
response = dlp_service_client.redact_content(inspect_config, items)

Parameters:

  • inspect_config (Google::Privacy::Dlp::V2beta1::InspectConfig | Hash)

    Configuration for the inspector. A hash of the same form as Google::Privacy::Dlp::V2beta1::InspectConfig can also be provided.

  • items (Array<Google::Privacy::Dlp::V2beta1::ContentItem | Hash>)

    The list of items to inspect. Up to 100 are allowed per request. A hash of the same form as Google::Privacy::Dlp::V2beta1::ContentItem can also be provided.

  • replace_configs (Array<Google::Privacy::Dlp::V2beta1::RedactContentRequest::ReplaceConfig | Hash>)

    The strings to replace findings text findings with. Must specify at least one of these or one ImageRedactionConfig if redacting images. A hash of the same form as Google::Privacy::Dlp::V2beta1::RedactContentRequest::ReplaceConfig can also be provided.

  • image_redaction_configs (Array<Google::Privacy::Dlp::V2beta1::RedactContentRequest::ImageRedactionConfig | Hash>)

    The configuration for specifying what content to redact from images. A hash of the same form as Google::Privacy::Dlp::V2beta1::RedactContentRequest::ImageRedactionConfig can also be provided.

  • options (Google::Gax::CallOptions)

    Overrides the default settings for this call, e.g, timeout, retries, etc.

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
# File 'lib/google/cloud/dlp/v2beta1/dlp_service_client.rb', line 304

def redact_content \
    inspect_config,
    items,
    replace_configs: nil,
    image_redaction_configs: nil,
    options: nil
  req = {
    inspect_config: inspect_config,
    items: items,
    replace_configs: replace_configs,
    image_redaction_configs: image_redaction_configs
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2beta1::RedactContentRequest)
  @redact_content.call(req, options)
end