Class: Google::Cloud::Dlp::V2::DlpServiceClient

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

Overview

The Cloud Data Loss Prevention (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.

To learn more about concepts and find how-to guides see https://cloud.google.com/dlp/docs/.

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
GRPC_INTERCEPTORS =

The default set of gRPC interceptors.

[]
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, metadata: nil, exception_transformer: nil, 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.

  • metadata (Hash)

    Default metadata to be sent with each request. This can be overridden on a per call basis.

  • exception_transformer (Proc)

    An optional proc that intercepts any exceptions raised during an API call to inject custom error handling.



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
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 249

def initialize \
    credentials: nil,
    scopes: ALL_SCOPES,
    client_config: {},
    timeout: DEFAULT_TIMEOUT,
    metadata: nil,
    exception_transformer: nil,
    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/v2/dlp_services_pb"

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

  if credentials.is_a?(String) || credentials.is_a?(Hash)
    updater_proc = Google::Cloud::Dlp::V2::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 }
  headers.merge!() unless .nil?
  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.v2.DlpService",
      JSON.parse(f.read),
      client_config,
      Google::Gax::Grpc::STATUS_CODE_NAMES,
      timeout,
      page_descriptors: PAGE_DESCRIPTORS,
      errors: Google::Gax::Grpc::API_ERRORS,
      metadata: headers
    )
  end

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

  @inspect_content = Google::Gax.create_api_call(
    @dlp_service_stub.method(:inspect_content),
    defaults["inspect_content"],
    exception_transformer: exception_transformer
  )
  @redact_image = Google::Gax.create_api_call(
    @dlp_service_stub.method(:redact_image),
    defaults["redact_image"],
    exception_transformer: exception_transformer
  )
  @deidentify_content = Google::Gax.create_api_call(
    @dlp_service_stub.method(:deidentify_content),
    defaults["deidentify_content"],
    exception_transformer: exception_transformer
  )
  @reidentify_content = Google::Gax.create_api_call(
    @dlp_service_stub.method(:reidentify_content),
    defaults["reidentify_content"],
    exception_transformer: exception_transformer
  )
  @list_info_types = Google::Gax.create_api_call(
    @dlp_service_stub.method(:list_info_types),
    defaults["list_info_types"],
    exception_transformer: exception_transformer
  )
  @create_inspect_template = Google::Gax.create_api_call(
    @dlp_service_stub.method(:create_inspect_template),
    defaults["create_inspect_template"],
    exception_transformer: exception_transformer
  )
  @update_inspect_template = Google::Gax.create_api_call(
    @dlp_service_stub.method(:update_inspect_template),
    defaults["update_inspect_template"],
    exception_transformer: exception_transformer
  )
  @get_inspect_template = Google::Gax.create_api_call(
    @dlp_service_stub.method(:get_inspect_template),
    defaults["get_inspect_template"],
    exception_transformer: exception_transformer
  )
  @list_inspect_templates = Google::Gax.create_api_call(
    @dlp_service_stub.method(:list_inspect_templates),
    defaults["list_inspect_templates"],
    exception_transformer: exception_transformer
  )
  @delete_inspect_template = Google::Gax.create_api_call(
    @dlp_service_stub.method(:delete_inspect_template),
    defaults["delete_inspect_template"],
    exception_transformer: exception_transformer
  )
  @create_deidentify_template = Google::Gax.create_api_call(
    @dlp_service_stub.method(:create_deidentify_template),
    defaults["create_deidentify_template"],
    exception_transformer: exception_transformer
  )
  @update_deidentify_template = Google::Gax.create_api_call(
    @dlp_service_stub.method(:update_deidentify_template),
    defaults["update_deidentify_template"],
    exception_transformer: exception_transformer
  )
  @get_deidentify_template = Google::Gax.create_api_call(
    @dlp_service_stub.method(:get_deidentify_template),
    defaults["get_deidentify_template"],
    exception_transformer: exception_transformer
  )
  @list_deidentify_templates = Google::Gax.create_api_call(
    @dlp_service_stub.method(:list_deidentify_templates),
    defaults["list_deidentify_templates"],
    exception_transformer: exception_transformer
  )
  @delete_deidentify_template = Google::Gax.create_api_call(
    @dlp_service_stub.method(:delete_deidentify_template),
    defaults["delete_deidentify_template"],
    exception_transformer: exception_transformer
  )
  @create_dlp_job = Google::Gax.create_api_call(
    @dlp_service_stub.method(:create_dlp_job),
    defaults["create_dlp_job"],
    exception_transformer: exception_transformer
  )
  @list_dlp_jobs = Google::Gax.create_api_call(
    @dlp_service_stub.method(:list_dlp_jobs),
    defaults["list_dlp_jobs"],
    exception_transformer: exception_transformer
  )
  @get_dlp_job = Google::Gax.create_api_call(
    @dlp_service_stub.method(:get_dlp_job),
    defaults["get_dlp_job"],
    exception_transformer: exception_transformer
  )
  @delete_dlp_job = Google::Gax.create_api_call(
    @dlp_service_stub.method(:delete_dlp_job),
    defaults["delete_dlp_job"],
    exception_transformer: exception_transformer
  )
  @cancel_dlp_job = Google::Gax.create_api_call(
    @dlp_service_stub.method(:cancel_dlp_job),
    defaults["cancel_dlp_job"],
    exception_transformer: exception_transformer
  )
  @list_job_triggers = Google::Gax.create_api_call(
    @dlp_service_stub.method(:list_job_triggers),
    defaults["list_job_triggers"],
    exception_transformer: exception_transformer
  )
  @get_job_trigger = Google::Gax.create_api_call(
    @dlp_service_stub.method(:get_job_trigger),
    defaults["get_job_trigger"],
    exception_transformer: exception_transformer
  )
  @delete_job_trigger = Google::Gax.create_api_call(
    @dlp_service_stub.method(:delete_job_trigger),
    defaults["delete_job_trigger"],
    exception_transformer: exception_transformer
  )
  @update_job_trigger = Google::Gax.create_api_call(
    @dlp_service_stub.method(:update_job_trigger),
    defaults["update_job_trigger"],
    exception_transformer: exception_transformer
  )
  @create_job_trigger = Google::Gax.create_api_call(
    @dlp_service_stub.method(:create_job_trigger),
    defaults["create_job_trigger"],
    exception_transformer: exception_transformer
  )
end

Instance Attribute Details

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

Returns:

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


46
47
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
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 46

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

  # The default set of gRPC interceptors.
  GRPC_INTERCEPTORS = []

  DEFAULT_TIMEOUT = 30

  PAGE_DESCRIPTORS = {
    "list_inspect_templates" => Google::Gax::PageDescriptor.new(
      "page_token",
      "next_page_token",
      "inspect_templates"),
    "list_deidentify_templates" => Google::Gax::PageDescriptor.new(
      "page_token",
      "next_page_token",
      "deidentify_templates"),
    "list_dlp_jobs" => Google::Gax::PageDescriptor.new(
      "page_token",
      "next_page_token",
      "jobs"),
    "list_job_triggers" => Google::Gax::PageDescriptor.new(
      "page_token",
      "next_page_token",
      "job_triggers")
  }.freeze

  private_constant :PAGE_DESCRIPTORS

  # 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


  ORGANIZATION_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "organizations/{organization}"
  )

  private_constant :ORGANIZATION_PATH_TEMPLATE

  ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "organizations/{organization}/deidentifyTemplates/{deidentify_template}"
  )

  private_constant :ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE

  PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "projects/{project}/deidentifyTemplates/{deidentify_template}"
  )

  private_constant :PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE

  ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "organizations/{organization}/inspectTemplates/{inspect_template}"
  )

  private_constant :ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE

  PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "projects/{project}/inspectTemplates/{inspect_template}"
  )

  private_constant :PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE

  PROJECT_JOB_TRIGGER_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "projects/{project}/jobTriggers/{job_trigger}"
  )

  private_constant :PROJECT_JOB_TRIGGER_PATH_TEMPLATE

  PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "projects/{project}"
  )

  private_constant :PROJECT_PATH_TEMPLATE

  DLP_JOB_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
    "projects/{project}/dlpJobs/{dlp_job}"
  )

  private_constant :DLP_JOB_PATH_TEMPLATE

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

  # Returns a fully-qualified organization_deidentify_template resource name string.
  # @param organization [String]
  # @param deidentify_template [String]
  # @return [String]
  def self.organization_deidentify_template_path organization, deidentify_template
    ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.render(
      :"organization" => organization,
      :"deidentify_template" => deidentify_template
    )
  end

  # Returns a fully-qualified project_deidentify_template resource name string.
  # @param project [String]
  # @param deidentify_template [String]
  # @return [String]
  def self.project_deidentify_template_path project, deidentify_template
    PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.render(
      :"project" => project,
      :"deidentify_template" => deidentify_template
    )
  end

  # Returns a fully-qualified organization_inspect_template resource name string.
  # @param organization [String]
  # @param inspect_template [String]
  # @return [String]
  def self.organization_inspect_template_path organization, inspect_template
    ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE.render(
      :"organization" => organization,
      :"inspect_template" => inspect_template
    )
  end

  # Returns a fully-qualified project_inspect_template resource name string.
  # @param project [String]
  # @param inspect_template [String]
  # @return [String]
  def self.project_inspect_template_path project, inspect_template
    PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE.render(
      :"project" => project,
      :"inspect_template" => inspect_template
    )
  end

  # Returns a fully-qualified project_job_trigger resource name string.
  # @param project [String]
  # @param job_trigger [String]
  # @return [String]
  def self.project_job_trigger_path project, job_trigger
    PROJECT_JOB_TRIGGER_PATH_TEMPLATE.render(
      :"project" => project,
      :"job_trigger" => job_trigger
    )
  end

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

  # Returns a fully-qualified dlp_job resource name string.
  # @param project [String]
  # @param dlp_job [String]
  # @return [String]
  def self.dlp_job_path project, dlp_job
    DLP_JOB_PATH_TEMPLATE.render(
      :"project" => project,
      :"dlp_job" => dlp_job
    )
  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.
  # @param metadata [Hash]
  #   Default metadata to be sent with each request. This can be overridden on a per call basis.
  # @param exception_transformer [Proc]
  #   An optional proc that intercepts any exceptions raised during an API call to inject
  #   custom error handling.
  def initialize \
      credentials: nil,
      scopes: ALL_SCOPES,
      client_config: {},
      timeout: DEFAULT_TIMEOUT,
      metadata: nil,
      exception_transformer: nil,
      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/v2/dlp_services_pb"

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

    if credentials.is_a?(String) || credentials.is_a?(Hash)
      updater_proc = Google::Cloud::Dlp::V2::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 }
    headers.merge!() unless .nil?
    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.v2.DlpService",
        JSON.parse(f.read),
        client_config,
        Google::Gax::Grpc::STATUS_CODE_NAMES,
        timeout,
        page_descriptors: PAGE_DESCRIPTORS,
        errors: Google::Gax::Grpc::API_ERRORS,
        metadata: headers
      )
    end

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

    @inspect_content = Google::Gax.create_api_call(
      @dlp_service_stub.method(:inspect_content),
      defaults["inspect_content"],
      exception_transformer: exception_transformer
    )
    @redact_image = Google::Gax.create_api_call(
      @dlp_service_stub.method(:redact_image),
      defaults["redact_image"],
      exception_transformer: exception_transformer
    )
    @deidentify_content = Google::Gax.create_api_call(
      @dlp_service_stub.method(:deidentify_content),
      defaults["deidentify_content"],
      exception_transformer: exception_transformer
    )
    @reidentify_content = Google::Gax.create_api_call(
      @dlp_service_stub.method(:reidentify_content),
      defaults["reidentify_content"],
      exception_transformer: exception_transformer
    )
    @list_info_types = Google::Gax.create_api_call(
      @dlp_service_stub.method(:list_info_types),
      defaults["list_info_types"],
      exception_transformer: exception_transformer
    )
    @create_inspect_template = Google::Gax.create_api_call(
      @dlp_service_stub.method(:create_inspect_template),
      defaults["create_inspect_template"],
      exception_transformer: exception_transformer
    )
    @update_inspect_template = Google::Gax.create_api_call(
      @dlp_service_stub.method(:update_inspect_template),
      defaults["update_inspect_template"],
      exception_transformer: exception_transformer
    )
    @get_inspect_template = Google::Gax.create_api_call(
      @dlp_service_stub.method(:get_inspect_template),
      defaults["get_inspect_template"],
      exception_transformer: exception_transformer
    )
    @list_inspect_templates = Google::Gax.create_api_call(
      @dlp_service_stub.method(:list_inspect_templates),
      defaults["list_inspect_templates"],
      exception_transformer: exception_transformer
    )
    @delete_inspect_template = Google::Gax.create_api_call(
      @dlp_service_stub.method(:delete_inspect_template),
      defaults["delete_inspect_template"],
      exception_transformer: exception_transformer
    )
    @create_deidentify_template = Google::Gax.create_api_call(
      @dlp_service_stub.method(:create_deidentify_template),
      defaults["create_deidentify_template"],
      exception_transformer: exception_transformer
    )
    @update_deidentify_template = Google::Gax.create_api_call(
      @dlp_service_stub.method(:update_deidentify_template),
      defaults["update_deidentify_template"],
      exception_transformer: exception_transformer
    )
    @get_deidentify_template = Google::Gax.create_api_call(
      @dlp_service_stub.method(:get_deidentify_template),
      defaults["get_deidentify_template"],
      exception_transformer: exception_transformer
    )
    @list_deidentify_templates = Google::Gax.create_api_call(
      @dlp_service_stub.method(:list_deidentify_templates),
      defaults["list_deidentify_templates"],
      exception_transformer: exception_transformer
    )
    @delete_deidentify_template = Google::Gax.create_api_call(
      @dlp_service_stub.method(:delete_deidentify_template),
      defaults["delete_deidentify_template"],
      exception_transformer: exception_transformer
    )
    @create_dlp_job = Google::Gax.create_api_call(
      @dlp_service_stub.method(:create_dlp_job),
      defaults["create_dlp_job"],
      exception_transformer: exception_transformer
    )
    @list_dlp_jobs = Google::Gax.create_api_call(
      @dlp_service_stub.method(:list_dlp_jobs),
      defaults["list_dlp_jobs"],
      exception_transformer: exception_transformer
    )
    @get_dlp_job = Google::Gax.create_api_call(
      @dlp_service_stub.method(:get_dlp_job),
      defaults["get_dlp_job"],
      exception_transformer: exception_transformer
    )
    @delete_dlp_job = Google::Gax.create_api_call(
      @dlp_service_stub.method(:delete_dlp_job),
      defaults["delete_dlp_job"],
      exception_transformer: exception_transformer
    )
    @cancel_dlp_job = Google::Gax.create_api_call(
      @dlp_service_stub.method(:cancel_dlp_job),
      defaults["cancel_dlp_job"],
      exception_transformer: exception_transformer
    )
    @list_job_triggers = Google::Gax.create_api_call(
      @dlp_service_stub.method(:list_job_triggers),
      defaults["list_job_triggers"],
      exception_transformer: exception_transformer
    )
    @get_job_trigger = Google::Gax.create_api_call(
      @dlp_service_stub.method(:get_job_trigger),
      defaults["get_job_trigger"],
      exception_transformer: exception_transformer
    )
    @delete_job_trigger = Google::Gax.create_api_call(
      @dlp_service_stub.method(:delete_job_trigger),
      defaults["delete_job_trigger"],
      exception_transformer: exception_transformer
    )
    @update_job_trigger = Google::Gax.create_api_call(
      @dlp_service_stub.method(:update_job_trigger),
      defaults["update_job_trigger"],
      exception_transformer: exception_transformer
    )
    @create_job_trigger = Google::Gax.create_api_call(
      @dlp_service_stub.method(:create_job_trigger),
      defaults["create_job_trigger"],
      exception_transformer: exception_transformer
    )
  end

  # Service calls

  # Finds potentially sensitive info in content.
  # This method has limits on input size, processing time, and output size.
  #
  # When no InfoTypes or CustomInfoTypes are specified in this request, the
  # system will automatically choose what detectors to run. By default this may
  # be all types, but may change over time as detectors are updated.
  #
  # For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images
  # and https://cloud.google.com/dlp/docs/inspecting-text,
  #
  # @param parent [String]
  #   The parent resource name, for example projects/my-project-id.
  # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
  #   Configuration for the inspector. What specified here will override
  #   the template referenced by the inspect_template_name argument.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
  #   can also be provided.
  # @param item [Google::Privacy::Dlp::V2::ContentItem | Hash]
  #   The item to inspect.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::ContentItem`
  #   can also be provided.
  # @param inspect_template_name [String]
  #   Optional template to use. Any configuration directly specified in
  #   inspect_config will override those set in the template. Singular fields
  #   that are set in this request will replace their corresponding fields in the
  #   template. Repeated fields are appended. Singular sub-messages and groups
  #   are recursively merged.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::InspectContentResponse]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::InspectContentResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
  #   response = dlp_service_client.inspect_content(formatted_parent)

  def inspect_content \
      parent,
      inspect_config: nil,
      item: nil,
      inspect_template_name: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      inspect_config: inspect_config,
      item: item,
      inspect_template_name: inspect_template_name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::InspectContentRequest)
    @inspect_content.call(req, options, &block)
  end

  # Redacts potentially sensitive info from an image.
  # This method has limits on input size, processing time, and output size.
  # See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to
  # learn more.
  #
  # When no InfoTypes or CustomInfoTypes are specified in this request, the
  # system will automatically choose what detectors to run. By default this may
  # be all types, but may change over time as detectors are updated.
  #
  # @param parent [String]
  #   The parent resource name, for example projects/my-project-id.
  # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
  #   Configuration for the inspector.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
  #   can also be provided.
  # @param image_redaction_configs [Array<Google::Privacy::Dlp::V2::RedactImageRequest::ImageRedactionConfig | Hash>]
  #   The configuration for specifying what content to redact from images.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::RedactImageRequest::ImageRedactionConfig`
  #   can also be provided.
  # @param include_findings [true, false]
  #   Whether the response should include findings along with the redacted
  #   image.
  # @param byte_item [Google::Privacy::Dlp::V2::ByteContentItem | Hash]
  #   The content must be PNG, JPEG, SVG or BMP.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::ByteContentItem`
  #   can also be provided.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::RedactImageResponse]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::RedactImageResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
  #   response = dlp_service_client.redact_image(formatted_parent)

  def redact_image \
      parent,
      inspect_config: nil,
      image_redaction_configs: nil,
      include_findings: nil,
      byte_item: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      inspect_config: inspect_config,
      image_redaction_configs: image_redaction_configs,
      include_findings: include_findings,
      byte_item: byte_item
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::RedactImageRequest)
    @redact_image.call(req, options, &block)
  end

  # De-identifies potentially sensitive info from a ContentItem.
  # This method has limits on input size and output size.
  # See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to
  # learn more.
  #
  # When no InfoTypes or CustomInfoTypes are specified in this request, the
  # system will automatically choose what detectors to run. By default this may
  # be all types, but may change over time as detectors are updated.
  #
  # @param parent [String]
  #   The parent resource name, for example projects/my-project-id.
  # @param deidentify_config [Google::Privacy::Dlp::V2::DeidentifyConfig | Hash]
  #   Configuration for the de-identification of the content item.
  #   Items specified here will override the template referenced by the
  #   deidentify_template_name argument.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyConfig`
  #   can also be provided.
  # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
  #   Configuration for the inspector.
  #   Items specified here will override the template referenced by the
  #   inspect_template_name argument.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
  #   can also be provided.
  # @param item [Google::Privacy::Dlp::V2::ContentItem | Hash]
  #   The item to de-identify. Will be treated as text.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::ContentItem`
  #   can also be provided.
  # @param inspect_template_name [String]
  #   Optional template to use. Any configuration directly specified in
  #   inspect_config will override those set in the template. Singular fields
  #   that are set in this request will replace their corresponding fields in the
  #   template. Repeated fields are appended. Singular sub-messages and groups
  #   are recursively merged.
  # @param deidentify_template_name [String]
  #   Optional template to use. Any configuration directly specified in
  #   deidentify_config will override those set in the template. Singular fields
  #   that are set in this request will replace their corresponding fields in the
  #   template. Repeated fields are appended. Singular sub-messages and groups
  #   are recursively merged.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::DeidentifyContentResponse]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::DeidentifyContentResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
  #   response = dlp_service_client.deidentify_content(formatted_parent)

  def deidentify_content \
      parent,
      deidentify_config: nil,
      inspect_config: nil,
      item: nil,
      inspect_template_name: nil,
      deidentify_template_name: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      deidentify_config: deidentify_config,
      inspect_config: inspect_config,
      item: item,
      inspect_template_name: inspect_template_name,
      deidentify_template_name: deidentify_template_name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeidentifyContentRequest)
    @deidentify_content.call(req, options, &block)
  end

  # Re-identifies content that has been de-identified.
  # See
  # https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example
  # to learn more.
  #
  # @param parent [String]
  #   The parent resource name.
  # @param reidentify_config [Google::Privacy::Dlp::V2::DeidentifyConfig | Hash]
  #   Configuration for the re-identification of the content item.
  #   This field shares the same proto message type that is used for
  #   de-identification, however its usage here is for the reversal of the
  #   previous de-identification. Re-identification is performed by examining
  #   the transformations used to de-identify the items and executing the
  #   reverse. This requires that only reversible transformations
  #   be provided here. The reversible transformations are:
  #
  #   * +CryptoReplaceFfxFpeConfig+
  #   A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyConfig`
  #   can also be provided.
  # @param inspect_config [Google::Privacy::Dlp::V2::InspectConfig | Hash]
  #   Configuration for the inspector.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::InspectConfig`
  #   can also be provided.
  # @param item [Google::Privacy::Dlp::V2::ContentItem | Hash]
  #   The item to re-identify. Will be treated as text.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::ContentItem`
  #   can also be provided.
  # @param inspect_template_name [String]
  #   Optional template to use. Any configuration directly specified in
  #   +inspect_config+ will override those set in the template. Singular fields
  #   that are set in this request will replace their corresponding fields in the
  #   template. Repeated fields are appended. Singular sub-messages and groups
  #   are recursively merged.
  # @param reidentify_template_name [String]
  #   Optional template to use. References an instance of +DeidentifyTemplate+.
  #   Any configuration directly specified in +reidentify_config+ or
  #   +inspect_config+ will override those set in the template. Singular fields
  #   that are set in this request will replace their corresponding fields in the
  #   template. Repeated fields are appended. Singular sub-messages and groups
  #   are recursively merged.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::ReidentifyContentResponse]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::ReidentifyContentResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
  #   response = dlp_service_client.reidentify_content(formatted_parent)

  def reidentify_content \
      parent,
      reidentify_config: nil,
      inspect_config: nil,
      item: nil,
      inspect_template_name: nil,
      reidentify_template_name: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      reidentify_config: reidentify_config,
      inspect_config: inspect_config,
      item: item,
      inspect_template_name: inspect_template_name,
      reidentify_template_name: reidentify_template_name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ReidentifyContentRequest)
    @reidentify_content.call(req, options, &block)
  end

  # Returns a list of the sensitive information types that the DLP API
  # supports. See https://cloud.google.com/dlp/docs/infotypes-reference to
  # learn more.
  #
  # @param language_code [String]
  #   Optional BCP-47 language code for localized infoType friendly
  #   names. If omitted, or if localized strings are not available,
  #   en-US strings will be returned.
  # @param filter [String]
  #   Optional filter to only return infoTypes supported by certain parts of the
  #   API. Defaults to supported_by=INSPECT.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::ListInfoTypesResponse]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::ListInfoTypesResponse]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   response = dlp_service_client.list_info_types

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

  # Creates an InspectTemplate for re-using frequently used configuration
  # for inspecting content, images, and storage.
  # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
  #
  # @param parent [String]
  #   The parent resource name, for example projects/my-project-id or
  #   organizations/my-org-id.
  # @param inspect_template [Google::Privacy::Dlp::V2::InspectTemplate | Hash]
  #   The InspectTemplate to create.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::InspectTemplate`
  #   can also be provided.
  # @param template_id [String]
  #   The template id can contain uppercase and lowercase letters,
  #   numbers, and hyphens; that is, it must match the regular
  #   expression: +[a-zA-Z\\d-]++. The maximum length is 100
  #   characters. Can be empty to allow the system to generate one.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::InspectTemplate]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::InspectTemplate]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
  #   response = dlp_service_client.create_inspect_template(formatted_parent)

  def create_inspect_template \
      parent,
      inspect_template: nil,
      template_id: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      inspect_template: inspect_template,
      template_id: template_id
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateInspectTemplateRequest)
    @create_inspect_template.call(req, options, &block)
  end

  # Updates the InspectTemplate.
  # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
  #
  # @param name [String]
  #   Resource name of organization and inspectTemplate to be updated, for
  #   example +organizations/433245324/inspectTemplates/432452342+ or
  #   projects/project-id/inspectTemplates/432452342.
  # @param inspect_template [Google::Privacy::Dlp::V2::InspectTemplate | Hash]
  #   New InspectTemplate value.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::InspectTemplate`
  #   can also be provided.
  # @param update_mask [Google::Protobuf::FieldMask | Hash]
  #   Mask to control which fields get updated.
  #   A hash of the same form as `Google::Protobuf::FieldMask`
  #   can also be provided.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::InspectTemplate]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::InspectTemplate]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_inspect_template_path("[ORGANIZATION]", "[INSPECT_TEMPLATE]")
  #   response = dlp_service_client.update_inspect_template(formatted_name)

  def update_inspect_template \
      name,
      inspect_template: nil,
      update_mask: nil,
      options: nil,
      &block
    req = {
      name: name,
      inspect_template: inspect_template,
      update_mask: update_mask
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateInspectTemplateRequest)
    @update_inspect_template.call(req, options, &block)
  end

  # Gets an InspectTemplate.
  # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
  #
  # @param name [String]
  #   Resource name of the organization and inspectTemplate to be read, for
  #   example +organizations/433245324/inspectTemplates/432452342+ or
  #   projects/project-id/inspectTemplates/432452342.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::InspectTemplate]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::InspectTemplate]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   response = dlp_service_client.get_inspect_template

  def get_inspect_template \
      name: nil,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetInspectTemplateRequest)
    @get_inspect_template.call(req, options, &block)
  end

  # Lists InspectTemplates.
  # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
  #
  # @param parent [String]
  #   The parent resource name, for example projects/my-project-id or
  #   organizations/my-org-id.
  # @param page_size [Integer]
  #   The maximum number of resources contained in the underlying API
  #   response. If page streaming is performed per-resource, this
  #   parameter does not affect the return value. If page streaming is
  #   performed per-page, this determines the maximum number of
  #   resources in a page.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::InspectTemplate>]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::InspectTemplate>]
  #   An enumerable of Google::Privacy::Dlp::V2::InspectTemplate instances.
  #   See Google::Gax::PagedEnumerable documentation for other
  #   operations such as per-page iteration or access to the response
  #   object.
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
  #
  #   # Iterate over all results.
  #   dlp_service_client.list_inspect_templates(formatted_parent).each do |element|
  #     # Process element.
  #   end
  #
  #   # Or iterate over results one page at a time.
  #   dlp_service_client.list_inspect_templates(formatted_parent).each_page do |page|
  #     # Process each page at a time.
  #     page.each do |element|
  #       # Process element.
  #     end
  #   end

  def list_inspect_templates \
      parent,
      page_size: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      page_size: page_size
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListInspectTemplatesRequest)
    @list_inspect_templates.call(req, options, &block)
  end

  # Deletes an InspectTemplate.
  # See https://cloud.google.com/dlp/docs/creating-templates to learn more.
  #
  # @param name [String]
  #   Resource name of the organization and inspectTemplate to be deleted, for
  #   example +organizations/433245324/inspectTemplates/432452342+ or
  #   projects/project-id/inspectTemplates/432452342.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result []
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_inspect_template_path("[ORGANIZATION]", "[INSPECT_TEMPLATE]")
  #   dlp_service_client.delete_inspect_template(formatted_name)

  def delete_inspect_template \
      name,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteInspectTemplateRequest)
    @delete_inspect_template.call(req, options, &block)
    nil
  end

  # Creates a DeidentifyTemplate for re-using frequently used configuration
  # for de-identifying content, images, and storage.
  # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
  # more.
  #
  # @param parent [String]
  #   The parent resource name, for example projects/my-project-id or
  #   organizations/my-org-id.
  # @param deidentify_template [Google::Privacy::Dlp::V2::DeidentifyTemplate | Hash]
  #   The DeidentifyTemplate to create.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyTemplate`
  #   can also be provided.
  # @param template_id [String]
  #   The template id can contain uppercase and lowercase letters,
  #   numbers, and hyphens; that is, it must match the regular
  #   expression: +[a-zA-Z\\d-]++. The maximum length is 100
  #   characters. Can be empty to allow the system to generate one.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::DeidentifyTemplate]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::DeidentifyTemplate]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
  #   response = dlp_service_client.create_deidentify_template(formatted_parent)

  def create_deidentify_template \
      parent,
      deidentify_template: nil,
      template_id: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      deidentify_template: deidentify_template,
      template_id: template_id
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateDeidentifyTemplateRequest)
    @create_deidentify_template.call(req, options, &block)
  end

  # Updates the DeidentifyTemplate.
  # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
  # more.
  #
  # @param name [String]
  #   Resource name of organization and deidentify template to be updated, for
  #   example +organizations/433245324/deidentifyTemplates/432452342+ or
  #   projects/project-id/deidentifyTemplates/432452342.
  # @param deidentify_template [Google::Privacy::Dlp::V2::DeidentifyTemplate | Hash]
  #   New DeidentifyTemplate value.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::DeidentifyTemplate`
  #   can also be provided.
  # @param update_mask [Google::Protobuf::FieldMask | Hash]
  #   Mask to control which fields get updated.
  #   A hash of the same form as `Google::Protobuf::FieldMask`
  #   can also be provided.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::DeidentifyTemplate]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::DeidentifyTemplate]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
  #   response = dlp_service_client.update_deidentify_template(formatted_name)

  def update_deidentify_template \
      name,
      deidentify_template: nil,
      update_mask: nil,
      options: nil,
      &block
    req = {
      name: name,
      deidentify_template: deidentify_template,
      update_mask: update_mask
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateDeidentifyTemplateRequest)
    @update_deidentify_template.call(req, options, &block)
  end

  # Gets a DeidentifyTemplate.
  # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
  # more.
  #
  # @param name [String]
  #   Resource name of the organization and deidentify template to be read, for
  #   example +organizations/433245324/deidentifyTemplates/432452342+ or
  #   projects/project-id/deidentifyTemplates/432452342.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::DeidentifyTemplate]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::DeidentifyTemplate]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
  #   response = dlp_service_client.get_deidentify_template(formatted_name)

  def get_deidentify_template \
      name,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetDeidentifyTemplateRequest)
    @get_deidentify_template.call(req, options, &block)
  end

  # Lists DeidentifyTemplates.
  # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
  # more.
  #
  # @param parent [String]
  #   The parent resource name, for example projects/my-project-id or
  #   organizations/my-org-id.
  # @param page_size [Integer]
  #   The maximum number of resources contained in the underlying API
  #   response. If page streaming is performed per-resource, this
  #   parameter does not affect the return value. If page streaming is
  #   performed per-page, this determines the maximum number of
  #   resources in a page.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DeidentifyTemplate>]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DeidentifyTemplate>]
  #   An enumerable of Google::Privacy::Dlp::V2::DeidentifyTemplate instances.
  #   See Google::Gax::PagedEnumerable documentation for other
  #   operations such as per-page iteration or access to the response
  #   object.
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
  #
  #   # Iterate over all results.
  #   dlp_service_client.list_deidentify_templates(formatted_parent).each do |element|
  #     # Process element.
  #   end
  #
  #   # Or iterate over results one page at a time.
  #   dlp_service_client.list_deidentify_templates(formatted_parent).each_page do |page|
  #     # Process each page at a time.
  #     page.each do |element|
  #       # Process element.
  #     end
  #   end

  def list_deidentify_templates \
      parent,
      page_size: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      page_size: page_size
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListDeidentifyTemplatesRequest)
    @list_deidentify_templates.call(req, options, &block)
  end

  # Deletes a DeidentifyTemplate.
  # See https://cloud.google.com/dlp/docs/creating-templates-deid to learn
  # more.
  #
  # @param name [String]
  #   Resource name of the organization and deidentify template to be deleted,
  #   for example +organizations/433245324/deidentifyTemplates/432452342+ or
  #   projects/project-id/deidentifyTemplates/432452342.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result []
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
  #   dlp_service_client.delete_deidentify_template(formatted_name)

  def delete_deidentify_template \
      name,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteDeidentifyTemplateRequest)
    @delete_deidentify_template.call(req, options, &block)
    nil
  end

  # Creates a new job to inspect storage or calculate risk metrics.
  # See https://cloud.google.com/dlp/docs/inspecting-storage and
  # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
  #
  # When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the
  # system will automatically choose what detectors to run. By default this may
  # be all types, but may change over time as detectors are updated.
  #
  # @param parent [String]
  #   The parent resource name, for example projects/my-project-id.
  # @param inspect_job [Google::Privacy::Dlp::V2::InspectJobConfig | Hash]
  #   A hash of the same form as `Google::Privacy::Dlp::V2::InspectJobConfig`
  #   can also be provided.
  # @param risk_job [Google::Privacy::Dlp::V2::RiskAnalysisJobConfig | Hash]
  #   A hash of the same form as `Google::Privacy::Dlp::V2::RiskAnalysisJobConfig`
  #   can also be provided.
  # @param job_id [String]
  #   The job id can contain uppercase and lowercase letters,
  #   numbers, and hyphens; that is, it must match the regular
  #   expression: +[a-zA-Z\\d-]++. The maximum length is 100
  #   characters. Can be empty to allow the system to generate one.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::DlpJob]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::DlpJob]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
  #   response = dlp_service_client.create_dlp_job(formatted_parent)

  def create_dlp_job \
      parent,
      inspect_job: nil,
      risk_job: nil,
      job_id: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      inspect_job: inspect_job,
      risk_job: risk_job,
      job_id: job_id
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateDlpJobRequest)
    @create_dlp_job.call(req, options, &block)
  end

  # Lists DlpJobs that match the specified filter in the request.
  # See https://cloud.google.com/dlp/docs/inspecting-storage and
  # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
  #
  # @param parent [String]
  #   The parent resource name, for example projects/my-project-id.
  # @param filter [String]
  #   Optional. Allows filtering.
  #
  #   Supported syntax:
  #
  #   * Filter expressions are made up of one or more restrictions.
  #   * Restrictions can be combined by +AND+ or +OR+ logical operators. A
  #     sequence of restrictions implicitly uses +AND+.
  #   * A restriction has the form of +<field> <operator> <value>+.
  #   * Supported fields/values for inspect jobs:
  #     * +state+ - PENDING|RUNNING|CANCELED|FINISHED|FAILED
  #       * +inspected_storage+ - DATASTORE|CLOUD_STORAGE|BIGQUERY
  #       * +trigger_name+ - The resource name of the trigger that created job.
  #     * Supported fields for risk analysis jobs:
  #       * +state+ - RUNNING|CANCELED|FINISHED|FAILED
  #     * The operator must be +=+ or +!=+.
  #
  #     Examples:
  #
  #   * inspected_storage = cloud_storage AND state = done
  #   * inspected_storage = cloud_storage OR inspected_storage = bigquery
  #   * inspected_storage = cloud_storage AND (state = done OR state = canceled)
  #
  #   The length of this field should be no more than 500 characters.
  # @param page_size [Integer]
  #   The maximum number of resources contained in the underlying API
  #   response. If page streaming is performed per-resource, this
  #   parameter does not affect the return value. If page streaming is
  #   performed per-page, this determines the maximum number of
  #   resources in a page.
  # @param type [Google::Privacy::Dlp::V2::DlpJobType]
  #   The type of job. Defaults to +DlpJobType.INSPECT+
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DlpJob>]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DlpJob>]
  #   An enumerable of Google::Privacy::Dlp::V2::DlpJob instances.
  #   See Google::Gax::PagedEnumerable documentation for other
  #   operations such as per-page iteration or access to the response
  #   object.
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
  #
  #   # Iterate over all results.
  #   dlp_service_client.list_dlp_jobs(formatted_parent).each do |element|
  #     # Process element.
  #   end
  #
  #   # Or iterate over results one page at a time.
  #   dlp_service_client.list_dlp_jobs(formatted_parent).each_page do |page|
  #     # Process each page at a time.
  #     page.each do |element|
  #       # Process element.
  #     end
  #   end

  def list_dlp_jobs \
      parent,
      filter: nil,
      page_size: nil,
      type: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      filter: filter,
      page_size: page_size,
      type: type
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListDlpJobsRequest)
    @list_dlp_jobs.call(req, options, &block)
  end

  # Gets the latest state of a long-running DlpJob.
  # See https://cloud.google.com/dlp/docs/inspecting-storage and
  # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
  #
  # @param name [String]
  #   The name of the DlpJob resource.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::DlpJob]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::DlpJob]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
  #   response = dlp_service_client.get_dlp_job(formatted_name)

  def get_dlp_job \
      name,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetDlpJobRequest)
    @get_dlp_job.call(req, options, &block)
  end

  # Deletes a long-running DlpJob. This method indicates that the client is
  # no longer interested in the DlpJob result. The job will be cancelled if
  # possible.
  # See https://cloud.google.com/dlp/docs/inspecting-storage and
  # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
  #
  # @param name [String]
  #   The name of the DlpJob resource to be deleted.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result []
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
  #   dlp_service_client.delete_dlp_job(formatted_name)

  def delete_dlp_job \
      name,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteDlpJobRequest)
    @delete_dlp_job.call(req, options, &block)
    nil
  end

  # Starts asynchronous cancellation on a long-running DlpJob. The server
  # makes a best effort to cancel the DlpJob, but success is not
  # guaranteed.
  # See https://cloud.google.com/dlp/docs/inspecting-storage and
  # https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.
  #
  # @param name [String]
  #   The name of the DlpJob resource to be cancelled.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result []
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
  #   dlp_service_client.cancel_dlp_job(formatted_name)

  def cancel_dlp_job \
      name,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CancelDlpJobRequest)
    @cancel_dlp_job.call(req, options, &block)
    nil
  end

  # Lists job triggers.
  # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
  #
  # @param parent [String]
  #   The parent resource name, for example +projects/my-project-id+.
  # @param page_size [Integer]
  #   The maximum number of resources contained in the underlying API
  #   response. If page streaming is performed per-resource, this
  #   parameter does not affect the return value. If page streaming is
  #   performed per-page, this determines the maximum number of
  #   resources in a page.
  # @param order_by [String]
  #   Optional comma separated list of triggeredJob fields to order by,
  #   followed by +asc+ or +desc+ postfix. This list is case-insensitive,
  #   default sorting order is ascending, redundant space characters are
  #   insignificant.
  #
  #   Example: +name asc,update_time, create_time desc+
  #
  #   Supported fields are:
  #
  #   * +create_time+: corresponds to time the triggeredJob was created.
  #   * +update_time+: corresponds to time the triggeredJob was last updated.
  #   * +name+: corresponds to JobTrigger's name.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::JobTrigger>]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::JobTrigger>]
  #   An enumerable of Google::Privacy::Dlp::V2::JobTrigger instances.
  #   See Google::Gax::PagedEnumerable documentation for other
  #   operations such as per-page iteration or access to the response
  #   object.
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
  #
  #   # Iterate over all results.
  #   dlp_service_client.list_job_triggers(formatted_parent).each do |element|
  #     # Process element.
  #   end
  #
  #   # Or iterate over results one page at a time.
  #   dlp_service_client.list_job_triggers(formatted_parent).each_page do |page|
  #     # Process each page at a time.
  #     page.each do |element|
  #       # Process element.
  #     end
  #   end

  def list_job_triggers \
      parent,
      page_size: nil,
      order_by: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      page_size: page_size,
      order_by: order_by
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListJobTriggersRequest)
    @list_job_triggers.call(req, options, &block)
  end

  # Gets a job trigger.
  # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
  #
  # @param name [String]
  #   Resource name of the project and the triggeredJob, for example
  #   +projects/dlp-test-project/jobTriggers/53234423+.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::JobTrigger]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::JobTrigger]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.project_job_trigger_path("[PROJECT]", "[JOB_TRIGGER]")
  #   response = dlp_service_client.get_job_trigger(formatted_name)

  def get_job_trigger \
      name,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetJobTriggerRequest)
    @get_job_trigger.call(req, options, &block)
  end

  # Deletes a job trigger.
  # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
  #
  # @param name [String]
  #   Resource name of the project and the triggeredJob, for example
  #   +projects/dlp-test-project/jobTriggers/53234423+.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result []
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #
  #   # TODO: Initialize +name+:
  #   name = ''
  #   dlp_service_client.delete_job_trigger(name)

  def delete_job_trigger \
      name,
      options: nil,
      &block
    req = {
      name: name
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteJobTriggerRequest)
    @delete_job_trigger.call(req, options, &block)
    nil
  end

  # Updates a job trigger.
  # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
  #
  # @param name [String]
  #   Resource name of the project and the triggeredJob, for example
  #   +projects/dlp-test-project/jobTriggers/53234423+.
  # @param job_trigger [Google::Privacy::Dlp::V2::JobTrigger | Hash]
  #   New JobTrigger value.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::JobTrigger`
  #   can also be provided.
  # @param update_mask [Google::Protobuf::FieldMask | Hash]
  #   Mask to control which fields get updated.
  #   A hash of the same form as `Google::Protobuf::FieldMask`
  #   can also be provided.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::JobTrigger]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::JobTrigger]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.project_job_trigger_path("[PROJECT]", "[JOB_TRIGGER]")
  #   response = dlp_service_client.update_job_trigger(formatted_name)

  def update_job_trigger \
      name,
      job_trigger: nil,
      update_mask: nil,
      options: nil,
      &block
    req = {
      name: name,
      job_trigger: job_trigger,
      update_mask: update_mask
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateJobTriggerRequest)
    @update_job_trigger.call(req, options, &block)
  end

  # Creates a job trigger to run DLP actions such as scanning storage for
  # sensitive information on a set schedule.
  # See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.
  #
  # @param parent [String]
  #   The parent resource name, for example projects/my-project-id.
  # @param job_trigger [Google::Privacy::Dlp::V2::JobTrigger | Hash]
  #   The JobTrigger to create.
  #   A hash of the same form as `Google::Privacy::Dlp::V2::JobTrigger`
  #   can also be provided.
  # @param trigger_id [String]
  #   The trigger id can contain uppercase and lowercase letters,
  #   numbers, and hyphens; that is, it must match the regular
  #   expression: +[a-zA-Z\\d-]++. The maximum length is 100
  #   characters. Can be empty to allow the system to generate one.
  # @param options [Google::Gax::CallOptions]
  #   Overrides the default settings for this call, e.g, timeout,
  #   retries, etc.
  # @yield [result, operation] Access the result along with the RPC operation
  # @yieldparam result [Google::Privacy::Dlp::V2::JobTrigger]
  # @yieldparam operation [GRPC::ActiveCall::Operation]
  # @return [Google::Privacy::Dlp::V2::JobTrigger]
  # @raise [Google::Gax::GaxError] if the RPC is aborted.
  # @example
  #   require "google/cloud/dlp"
  #
  #   dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
  #   formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
  #   response = dlp_service_client.create_job_trigger(formatted_parent)

  def create_job_trigger \
      parent,
      job_trigger: nil,
      trigger_id: nil,
      options: nil,
      &block
    req = {
      parent: parent,
      job_trigger: job_trigger,
      trigger_id: trigger_id
    }.delete_if { |_, v| v.nil? }
    req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateJobTriggerRequest)
    @create_job_trigger.call(req, options, &block)
  end
end

Class Method Details

.dlp_job_path(project, dlp_job) ⇒ String

Returns a fully-qualified dlp_job resource name string.

Parameters:

  • project (String)
  • dlp_job (String)

Returns:

  • (String)


213
214
215
216
217
218
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 213

def self.dlp_job_path project, dlp_job
  DLP_JOB_PATH_TEMPLATE.render(
    :"project" => project,
    :"dlp_job" => dlp_job
  )
end

.organization_deidentify_template_path(organization, deidentify_template) ⇒ String

Returns a fully-qualified organization_deidentify_template resource name string.

Parameters:

  • organization (String)
  • deidentify_template (String)

Returns:

  • (String)


149
150
151
152
153
154
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 149

def self.organization_deidentify_template_path organization, deidentify_template
  ORGANIZATION_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.render(
    :"organization" => organization,
    :"deidentify_template" => deidentify_template
  )
end

.organization_inspect_template_path(organization, inspect_template) ⇒ String

Returns a fully-qualified organization_inspect_template resource name string.

Parameters:

  • organization (String)
  • inspect_template (String)

Returns:

  • (String)


171
172
173
174
175
176
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 171

def self.organization_inspect_template_path organization, inspect_template
  ORGANIZATION_INSPECT_TEMPLATE_PATH_TEMPLATE.render(
    :"organization" => organization,
    :"inspect_template" => inspect_template
  )
end

.organization_path(organization) ⇒ String

Returns a fully-qualified organization resource name string.

Parameters:

  • organization (String)

Returns:

  • (String)


139
140
141
142
143
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 139

def self.organization_path organization
  ORGANIZATION_PATH_TEMPLATE.render(
    :"organization" => organization
  )
end

.project_deidentify_template_path(project, deidentify_template) ⇒ String

Returns a fully-qualified project_deidentify_template resource name string.

Parameters:

  • project (String)
  • deidentify_template (String)

Returns:

  • (String)


160
161
162
163
164
165
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 160

def self.project_deidentify_template_path project, deidentify_template
  PROJECT_DEIDENTIFY_TEMPLATE_PATH_TEMPLATE.render(
    :"project" => project,
    :"deidentify_template" => deidentify_template
  )
end

.project_inspect_template_path(project, inspect_template) ⇒ String

Returns a fully-qualified project_inspect_template resource name string.

Parameters:

  • project (String)
  • inspect_template (String)

Returns:

  • (String)


182
183
184
185
186
187
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 182

def self.project_inspect_template_path project, inspect_template
  PROJECT_INSPECT_TEMPLATE_PATH_TEMPLATE.render(
    :"project" => project,
    :"inspect_template" => inspect_template
  )
end

.project_job_trigger_path(project, job_trigger) ⇒ String

Returns a fully-qualified project_job_trigger resource name string.

Parameters:

  • project (String)
  • job_trigger (String)

Returns:

  • (String)


193
194
195
196
197
198
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 193

def self.project_job_trigger_path project, job_trigger
  PROJECT_JOB_TRIGGER_PATH_TEMPLATE.render(
    :"project" => project,
    :"job_trigger" => job_trigger
  )
end

.project_path(project) ⇒ String

Returns a fully-qualified project resource name string.

Parameters:

  • project (String)

Returns:

  • (String)


203
204
205
206
207
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 203

def self.project_path project
  PROJECT_PATH_TEMPLATE.render(
    :"project" => project
  )
end

Instance Method Details

#cancel_dlp_job(name, options: nil) {|result, operation| ... } ⇒ Object

Starts asynchronous cancellation on a long-running DlpJob. The server makes a best effort to cancel the DlpJob, but success is not guaranteed. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
dlp_service_client.cancel_dlp_job(formatted_name)

Parameters:

  • name (String)

    The name of the DlpJob resource to be cancelled.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • result

    []

  • operation (GRPC::ActiveCall::Operation)

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1417

def cancel_dlp_job \
    name,
    options: nil,
    &block
  req = {
    name: name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CancelDlpJobRequest)
  @cancel_dlp_job.call(req, options, &block)
  nil
end

#create_deidentify_template(parent, deidentify_template: nil, template_id: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::DeidentifyTemplate

Creates a DeidentifyTemplate for re-using frequently used configuration for de-identifying content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
response = dlp_service_client.create_deidentify_template(formatted_parent)

Parameters:

  • parent (String)

    The parent resource name, for example projects/my-project-id or organizations/my-org-id.

  • deidentify_template (Google::Privacy::Dlp::V2::DeidentifyTemplate | Hash)

    The DeidentifyTemplate to create. A hash of the same form as Google::Privacy::Dlp::V2::DeidentifyTemplate can also be provided.

  • template_id (String)

    The template id can contain uppercase and lowercase letters, numbers, and hyphens; that is, it must match the regular expression: +[a-zA-Z\d-]++. The maximum length is 100 characters. Can be empty to allow the system to generate one.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1004

def create_deidentify_template \
    parent,
    deidentify_template: nil,
    template_id: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    deidentify_template: deidentify_template,
    template_id: template_id
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateDeidentifyTemplateRequest)
  @create_deidentify_template.call(req, options, &block)
end

#create_dlp_job(parent, inspect_job: nil, risk_job: nil, job_id: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::DlpJob

Creates a new job to inspect storage or calculate risk metrics. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

When no InfoTypes or CustomInfoTypes are specified in inspect jobs, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
response = dlp_service_client.create_dlp_job(formatted_parent)

Parameters:

  • parent (String)

    The parent resource name, for example projects/my-project-id.

  • inspect_job (Google::Privacy::Dlp::V2::InspectJobConfig | Hash)

    A hash of the same form as Google::Privacy::Dlp::V2::InspectJobConfig can also be provided.

  • risk_job (Google::Privacy::Dlp::V2::RiskAnalysisJobConfig | Hash)

    A hash of the same form as Google::Privacy::Dlp::V2::RiskAnalysisJobConfig can also be provided.

  • job_id (String)

    The job id can contain uppercase and lowercase letters, numbers, and hyphens; that is, it must match the regular expression: +[a-zA-Z\d-]++. The maximum length is 100 characters. Can be empty to allow the system to generate one.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1226

def create_dlp_job \
    parent,
    inspect_job: nil,
    risk_job: nil,
    job_id: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    inspect_job: inspect_job,
    risk_job: risk_job,
    job_id: job_id
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateDlpJobRequest)
  @create_dlp_job.call(req, options, &block)
end

#create_inspect_template(parent, inspect_template: nil, template_id: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::InspectTemplate

Creates an InspectTemplate for re-using frequently used configuration for inspecting content, images, and storage. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")
response = dlp_service_client.create_inspect_template(formatted_parent)

Parameters:

  • parent (String)

    The parent resource name, for example projects/my-project-id or organizations/my-org-id.

  • inspect_template (Google::Privacy::Dlp::V2::InspectTemplate | Hash)

    The InspectTemplate to create. A hash of the same form as Google::Privacy::Dlp::V2::InspectTemplate can also be provided.

  • template_id (String)

    The template id can contain uppercase and lowercase letters, numbers, and hyphens; that is, it must match the regular expression: +[a-zA-Z\d-]++. The maximum length is 100 characters. Can be empty to allow the system to generate one.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



791
792
793
794
795
796
797
798
799
800
801
802
803
804
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 791

def create_inspect_template \
    parent,
    inspect_template: nil,
    template_id: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    inspect_template: inspect_template,
    template_id: template_id
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateInspectTemplateRequest)
  @create_inspect_template.call(req, options, &block)
end

#create_job_trigger(parent, job_trigger: nil, trigger_id: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::JobTrigger

Creates a job trigger to run DLP actions such as scanning storage for sensitive information on a set schedule. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
response = dlp_service_client.create_job_trigger(formatted_parent)

Parameters:

  • parent (String)

    The parent resource name, for example projects/my-project-id.

  • job_trigger (Google::Privacy::Dlp::V2::JobTrigger | Hash)

    The JobTrigger to create. A hash of the same form as Google::Privacy::Dlp::V2::JobTrigger can also be provided.

  • trigger_id (String)

    The trigger id can contain uppercase and lowercase letters, numbers, and hyphens; that is, it must match the regular expression: +[a-zA-Z\d-]++. The maximum length is 100 characters. Can be empty to allow the system to generate one.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1639

def create_job_trigger \
    parent,
    job_trigger: nil,
    trigger_id: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    job_trigger: job_trigger,
    trigger_id: trigger_id
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::CreateJobTriggerRequest)
  @create_job_trigger.call(req, options, &block)
end

#deidentify_content(parent, deidentify_config: nil, inspect_config: nil, item: nil, inspect_template_name: nil, deidentify_template_name: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::DeidentifyContentResponse

De-identifies potentially sensitive info from a ContentItem. This method has limits on input size and output size. See https://cloud.google.com/dlp/docs/deidentify-sensitive-data to learn more.

When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
response = dlp_service_client.deidentify_content(formatted_parent)

Parameters:

  • parent (String)

    The parent resource name, for example projects/my-project-id.

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

    Configuration for the de-identification of the content item. Items specified here will override the template referenced by the deidentify_template_name argument. A hash of the same form as Google::Privacy::Dlp::V2::DeidentifyConfig can also be provided.

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

    Configuration for the inspector. Items specified here will override the template referenced by the inspect_template_name argument. A hash of the same form as Google::Privacy::Dlp::V2::InspectConfig can also be provided.

  • item (Google::Privacy::Dlp::V2::ContentItem | Hash)

    The item to de-identify. Will be treated as text. A hash of the same form as Google::Privacy::Dlp::V2::ContentItem can also be provided.

  • inspect_template_name (String)

    Optional template to use. Any configuration directly specified in inspect_config will override those set in the template. Singular fields that are set in this request will replace their corresponding fields in the template. Repeated fields are appended. Singular sub-messages and groups are recursively merged.

  • deidentify_template_name (String)

    Optional template to use. Any configuration directly specified in deidentify_config will override those set in the template. Singular fields that are set in this request will replace their corresponding fields in the template. Repeated fields are appended. Singular sub-messages and groups are recursively merged.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 625

def deidentify_content \
    parent,
    deidentify_config: nil,
    inspect_config: nil,
    item: nil,
    inspect_template_name: nil,
    deidentify_template_name: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    deidentify_config: deidentify_config,
    inspect_config: inspect_config,
    item: item,
    inspect_template_name: inspect_template_name,
    deidentify_template_name: deidentify_template_name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeidentifyContentRequest)
  @deidentify_content.call(req, options, &block)
end

#delete_deidentify_template(name, options: nil) {|result, operation| ... } ⇒ Object

Deletes a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
dlp_service_client.delete_deidentify_template(formatted_name)

Parameters:

  • name (String)

    Resource name of the organization and deidentify template to be deleted, for example +organizations/433245324/deidentifyTemplates/432452342+ or projects/project-id/deidentifyTemplates/432452342.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • result

    []

  • operation (GRPC::ActiveCall::Operation)

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1178

def delete_deidentify_template \
    name,
    options: nil,
    &block
  req = {
    name: name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteDeidentifyTemplateRequest)
  @delete_deidentify_template.call(req, options, &block)
  nil
end

#delete_dlp_job(name, options: nil) {|result, operation| ... } ⇒ Object

Deletes a long-running DlpJob. This method indicates that the client is no longer interested in the DlpJob result. The job will be cancelled if possible. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
dlp_service_client.delete_dlp_job(formatted_name)

Parameters:

  • name (String)

    The name of the DlpJob resource to be deleted.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • result

    []

  • operation (GRPC::ActiveCall::Operation)

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1383

def delete_dlp_job \
    name,
    options: nil,
    &block
  req = {
    name: name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteDlpJobRequest)
  @delete_dlp_job.call(req, options, &block)
  nil
end

#delete_inspect_template(name, options: nil) {|result, operation| ... } ⇒ Object

Deletes an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_inspect_template_path("[ORGANIZATION]", "[INSPECT_TEMPLATE]")
dlp_service_client.delete_inspect_template(formatted_name)

Parameters:

  • name (String)

    Resource name of the organization and inspectTemplate to be deleted, for example +organizations/433245324/inspectTemplates/432452342+ or projects/project-id/inspectTemplates/432452342.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • result

    []

  • operation (GRPC::ActiveCall::Operation)

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



960
961
962
963
964
965
966
967
968
969
970
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 960

def delete_inspect_template \
    name,
    options: nil,
    &block
  req = {
    name: name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteInspectTemplateRequest)
  @delete_inspect_template.call(req, options, &block)
  nil
end

#delete_job_trigger(name, options: nil) {|result, operation| ... } ⇒ Object

Deletes a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)

# TODO: Initialize +name+:
name = ''
dlp_service_client.delete_job_trigger(name)

Parameters:

  • name (String)

    Resource name of the project and the triggeredJob, for example +projects/dlp-test-project/jobTriggers/53234423+.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

  • result

    []

  • operation (GRPC::ActiveCall::Operation)

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1553

def delete_job_trigger \
    name,
    options: nil,
    &block
  req = {
    name: name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::DeleteJobTriggerRequest)
  @delete_job_trigger.call(req, options, &block)
  nil
end

#get_deidentify_template(name, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::DeidentifyTemplate

Gets a DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
response = dlp_service_client.get_deidentify_template(formatted_name)

Parameters:

  • name (String)

    Resource name of the organization and deidentify template to be read, for example +organizations/433245324/deidentifyTemplates/432452342+ or projects/project-id/deidentifyTemplates/432452342.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1088

def get_deidentify_template \
    name,
    options: nil,
    &block
  req = {
    name: name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetDeidentifyTemplateRequest)
  @get_deidentify_template.call(req, options, &block)
end

#get_dlp_job(name, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::DlpJob

Gets the latest state of a long-running DlpJob. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.dlp_job_path("[PROJECT]", "[DLP_JOB]")
response = dlp_service_client.get_dlp_job(formatted_name)

Parameters:

  • name (String)

    The name of the DlpJob resource.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1350

def get_dlp_job \
    name,
    options: nil,
    &block
  req = {
    name: name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetDlpJobRequest)
  @get_dlp_job.call(req, options, &block)
end

#get_inspect_template(name: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::InspectTemplate

Gets an InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
response = dlp_service_client.get_inspect_template

Parameters:

  • name (String)

    Resource name of the organization and inspectTemplate to be read, for example +organizations/433245324/inspectTemplates/432452342+ or projects/project-id/inspectTemplates/432452342.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



872
873
874
875
876
877
878
879
880
881
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 872

def get_inspect_template \
    name: nil,
    options: nil,
    &block
  req = {
    name: name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetInspectTemplateRequest)
  @get_inspect_template.call(req, options, &block)
end

#get_job_trigger(name, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::JobTrigger

Gets a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.project_job_trigger_path("[PROJECT]", "[JOB_TRIGGER]")
response = dlp_service_client.get_job_trigger(formatted_name)

Parameters:

  • name (String)

    Resource name of the project and the triggeredJob, for example +projects/dlp-test-project/jobTriggers/53234423+.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1520

def get_job_trigger \
    name,
    options: nil,
    &block
  req = {
    name: name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::GetJobTriggerRequest)
  @get_job_trigger.call(req, options, &block)
end

#inspect_content(parent, inspect_config: nil, item: nil, inspect_template_name: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::InspectContentResponse

Finds potentially sensitive info in content. This method has limits on input size, processing time, and output size.

When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

For how to guides, see https://cloud.google.com/dlp/docs/inspecting-images and https://cloud.google.com/dlp/docs/inspecting-text,

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
response = dlp_service_client.inspect_content(formatted_parent)

Parameters:

  • parent (String)

    The parent resource name, for example projects/my-project-id.

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

    Configuration for the inspector. What specified here will override the template referenced by the inspect_template_name argument. A hash of the same form as Google::Privacy::Dlp::V2::InspectConfig can also be provided.

  • item (Google::Privacy::Dlp::V2::ContentItem | Hash)

    The item to inspect. A hash of the same form as Google::Privacy::Dlp::V2::ContentItem can also be provided.

  • inspect_template_name (String)

    Optional template to use. Any configuration directly specified in inspect_config will override those set in the template. Singular fields that are set in this request will replace their corresponding fields in the template. Repeated fields are appended. Singular sub-messages and groups are recursively merged.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 494

def inspect_content \
    parent,
    inspect_config: nil,
    item: nil,
    inspect_template_name: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    inspect_config: inspect_config,
    item: item,
    inspect_template_name: inspect_template_name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::InspectContentRequest)
  @inspect_content.call(req, options, &block)
end

#list_deidentify_templates(parent, page_size: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DeidentifyTemplate>

Lists DeidentifyTemplates. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")

# Iterate over all results.
dlp_service_client.list_deidentify_templates(formatted_parent).each do |element|
  # Process element.
end

# Or iterate over results one page at a time.
dlp_service_client.list_deidentify_templates(formatted_parent).each_page do |page|
  # Process each page at a time.
  page.each do |element|
    # Process element.
  end
end

Parameters:

  • parent (String)

    The parent resource name, for example projects/my-project-id or organizations/my-org-id.

  • page_size (Integer)

    The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

  • (Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DeidentifyTemplate>)

    An enumerable of Google::Privacy::Dlp::V2::DeidentifyTemplate instances. See Google::Gax::PagedEnumerable documentation for other operations such as per-page iteration or access to the response object.

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1143

def list_deidentify_templates \
    parent,
    page_size: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    page_size: page_size
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListDeidentifyTemplatesRequest)
  @list_deidentify_templates.call(req, options, &block)
end

#list_dlp_jobs(parent, filter: nil, page_size: nil, type: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DlpJob>

Lists DlpJobs that match the specified filter in the request. See https://cloud.google.com/dlp/docs/inspecting-storage and https://cloud.google.com/dlp/docs/compute-risk-analysis to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")

# Iterate over all results.
dlp_service_client.list_dlp_jobs(formatted_parent).each do |element|
  # Process element.
end

# Or iterate over results one page at a time.
dlp_service_client.list_dlp_jobs(formatted_parent).each_page do |page|
  # Process each page at a time.
  page.each do |element|
    # Process element.
  end
end

Parameters:

  • parent (String)

    The parent resource name, for example projects/my-project-id.

  • filter (String)

    Optional. Allows filtering.

    Supported syntax:

    • Filter expressions are made up of one or more restrictions.
    • Restrictions can be combined by +AND+ or +OR+ logical operators. A sequence of restrictions implicitly uses +AND+.
    • A restriction has the form of + +.
    • Supported fields/values for inspect jobs:
      • +state+ - PENDING|RUNNING|CANCELED|FINISHED|FAILED
      • +inspected_storage+ - DATASTORE|CLOUD_STORAGE|BIGQUERY
      • +trigger_name+ - The resource name of the trigger that created job.
      • Supported fields for risk analysis jobs:
      • +state+ - RUNNING|CANCELED|FINISHED|FAILED
      • The operator must be +=+ or +!=+.

    Examples:

    • inspected_storage = cloud_storage AND state = done
    • inspected_storage = cloud_storage OR inspected_storage = bigquery
    • inspected_storage = cloud_storage AND (state = done OR state = canceled)

    The length of this field should be no more than 500 characters.

  • page_size (Integer)

    The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • type (Google::Privacy::Dlp::V2::DlpJobType)

    The type of job. Defaults to +DlpJobType.INSPECT+

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

  • (Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::DlpJob>)

    An enumerable of Google::Privacy::Dlp::V2::DlpJob instances. See Google::Gax::PagedEnumerable documentation for other operations such as per-page iteration or access to the response object.

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1312

def list_dlp_jobs \
    parent,
    filter: nil,
    page_size: nil,
    type: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    filter: filter,
    page_size: page_size,
    type: type
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListDlpJobsRequest)
  @list_dlp_jobs.call(req, options, &block)
end

#list_info_types(language_code: nil, filter: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::ListInfoTypesResponse

Returns a list of the sensitive information types that the DLP API supports. See https://cloud.google.com/dlp/docs/infotypes-reference to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
response = dlp_service_client.list_info_types

Parameters:

  • language_code (String)

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

  • filter (String)

    Optional filter to only return infoTypes supported by certain parts of the API. Defaults to supported_by=INSPECT.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



747
748
749
750
751
752
753
754
755
756
757
758
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 747

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

#list_inspect_templates(parent, page_size: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::InspectTemplate>

Lists InspectTemplates. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.organization_path("[ORGANIZATION]")

# Iterate over all results.
dlp_service_client.list_inspect_templates(formatted_parent).each do |element|
  # Process element.
end

# Or iterate over results one page at a time.
dlp_service_client.list_inspect_templates(formatted_parent).each_page do |page|
  # Process each page at a time.
  page.each do |element|
    # Process element.
  end
end

Parameters:

  • parent (String)

    The parent resource name, for example projects/my-project-id or organizations/my-org-id.

  • page_size (Integer)

    The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

  • (Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::InspectTemplate>)

    An enumerable of Google::Privacy::Dlp::V2::InspectTemplate instances. See Google::Gax::PagedEnumerable documentation for other operations such as per-page iteration or access to the response object.

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



926
927
928
929
930
931
932
933
934
935
936
937
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 926

def list_inspect_templates \
    parent,
    page_size: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    page_size: page_size
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListInspectTemplatesRequest)
  @list_inspect_templates.call(req, options, &block)
end

#list_job_triggers(parent, page_size: nil, order_by: nil, options: nil) {|result, operation| ... } ⇒ Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::JobTrigger>

Lists job triggers. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")

# Iterate over all results.
dlp_service_client.list_job_triggers(formatted_parent).each do |element|
  # Process element.
end

# Or iterate over results one page at a time.
dlp_service_client.list_job_triggers(formatted_parent).each_page do |page|
  # Process each page at a time.
  page.each do |element|
    # Process element.
  end
end

Parameters:

  • parent (String)

    The parent resource name, for example +projects/my-project-id+.

  • page_size (Integer)

    The maximum number of resources contained in the underlying API response. If page streaming is performed per-resource, this parameter does not affect the return value. If page streaming is performed per-page, this determines the maximum number of resources in a page.

  • order_by (String)

    Optional comma separated list of triggeredJob fields to order by, followed by +asc+ or +desc+ postfix. This list is case-insensitive, default sorting order is ascending, redundant space characters are insignificant.

    Example: +name asc,update_time, create_time desc+

    Supported fields are:

    • +create_time+: corresponds to time the triggeredJob was created.
    • +update_time+: corresponds to time the triggeredJob was last updated.
    • +name+: corresponds to JobTrigger's name.
  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

  • (Google::Gax::PagedEnumerable<Google::Privacy::Dlp::V2::JobTrigger>)

    An enumerable of Google::Privacy::Dlp::V2::JobTrigger instances. See Google::Gax::PagedEnumerable documentation for other operations such as per-page iteration or access to the response object.

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1484

def list_job_triggers \
    parent,
    page_size: nil,
    order_by: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    page_size: page_size,
    order_by: order_by
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ListJobTriggersRequest)
  @list_job_triggers.call(req, options, &block)
end

#redact_image(parent, inspect_config: nil, image_redaction_configs: nil, include_findings: nil, byte_item: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::RedactImageResponse

Redacts potentially sensitive info from an image. This method has limits on input size, processing time, and output size. See https://cloud.google.com/dlp/docs/redacting-sensitive-data-images to learn more.

When no InfoTypes or CustomInfoTypes are specified in this request, the system will automatically choose what detectors to run. By default this may be all types, but may change over time as detectors are updated.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
response = dlp_service_client.redact_image(formatted_parent)

Parameters:

  • parent (String)

    The parent resource name, for example projects/my-project-id.

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

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

  • image_redaction_configs (Array<Google::Privacy::Dlp::V2::RedactImageRequest::ImageRedactionConfig | Hash>)

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

  • include_findings (true, false)

    Whether the response should include findings along with the redacted image.

  • byte_item (Google::Privacy::Dlp::V2::ByteContentItem | Hash)

    The content must be PNG, JPEG, SVG or BMP. A hash of the same form as Google::Privacy::Dlp::V2::ByteContentItem can also be provided.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 552

def redact_image \
    parent,
    inspect_config: nil,
    image_redaction_configs: nil,
    include_findings: nil,
    byte_item: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    inspect_config: inspect_config,
    image_redaction_configs: image_redaction_configs,
    include_findings: include_findings,
    byte_item: byte_item
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::RedactImageRequest)
  @redact_image.call(req, options, &block)
end

#reidentify_content(parent, reidentify_config: nil, inspect_config: nil, item: nil, inspect_template_name: nil, reidentify_template_name: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::ReidentifyContentResponse

Re-identifies content that has been de-identified. See https://cloud.google.com/dlp/docs/pseudonymization#re-identification_in_free_text_code_example to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_parent = Google::Cloud::Dlp::V2::DlpServiceClient.project_path("[PROJECT]")
response = dlp_service_client.reidentify_content(formatted_parent)

Parameters:

  • parent (String)

    The parent resource name.

  • reidentify_config (Google::Privacy::Dlp::V2::DeidentifyConfig | Hash)

    Configuration for the re-identification of the content item. This field shares the same proto message type that is used for de-identification, however its usage here is for the reversal of the previous de-identification. Re-identification is performed by examining the transformations used to de-identify the items and executing the reverse. This requires that only reversible transformations be provided here. The reversible transformations are:

    • +CryptoReplaceFfxFpeConfig+ A hash of the same form as Google::Privacy::Dlp::V2::DeidentifyConfig can also be provided.
  • inspect_config (Google::Privacy::Dlp::V2::InspectConfig | Hash)

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

  • item (Google::Privacy::Dlp::V2::ContentItem | Hash)

    The item to re-identify. Will be treated as text. A hash of the same form as Google::Privacy::Dlp::V2::ContentItem can also be provided.

  • inspect_template_name (String)

    Optional template to use. Any configuration directly specified in +inspect_config+ will override those set in the template. Singular fields that are set in this request will replace their corresponding fields in the template. Repeated fields are appended. Singular sub-messages and groups are recursively merged.

  • reidentify_template_name (String)

    Optional template to use. References an instance of +DeidentifyTemplate+. Any configuration directly specified in +reidentify_config+ or +inspect_config+ will override those set in the template. Singular fields that are set in this request will replace their corresponding fields in the template. Repeated fields are appended. Singular sub-messages and groups are recursively merged.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 701

def reidentify_content \
    parent,
    reidentify_config: nil,
    inspect_config: nil,
    item: nil,
    inspect_template_name: nil,
    reidentify_template_name: nil,
    options: nil,
    &block
  req = {
    parent: parent,
    reidentify_config: reidentify_config,
    inspect_config: inspect_config,
    item: item,
    inspect_template_name: inspect_template_name,
    reidentify_template_name: reidentify_template_name
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::ReidentifyContentRequest)
  @reidentify_content.call(req, options, &block)
end

#update_deidentify_template(name, deidentify_template: nil, update_mask: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::DeidentifyTemplate

Updates the DeidentifyTemplate. See https://cloud.google.com/dlp/docs/creating-templates-deid to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_deidentify_template_path("[ORGANIZATION]", "[DEIDENTIFY_TEMPLATE]")
response = dlp_service_client.update_deidentify_template(formatted_name)

Parameters:

  • name (String)

    Resource name of organization and deidentify template to be updated, for example +organizations/433245324/deidentifyTemplates/432452342+ or projects/project-id/deidentifyTemplates/432452342.

  • deidentify_template (Google::Privacy::Dlp::V2::DeidentifyTemplate | Hash)

    New DeidentifyTemplate value. A hash of the same form as Google::Privacy::Dlp::V2::DeidentifyTemplate can also be provided.

  • update_mask (Google::Protobuf::FieldMask | Hash)

    Mask to control which fields get updated. A hash of the same form as Google::Protobuf::FieldMask can also be provided.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1050

def update_deidentify_template \
    name,
    deidentify_template: nil,
    update_mask: nil,
    options: nil,
    &block
  req = {
    name: name,
    deidentify_template: deidentify_template,
    update_mask: update_mask
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateDeidentifyTemplateRequest)
  @update_deidentify_template.call(req, options, &block)
end

#update_inspect_template(name, inspect_template: nil, update_mask: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::InspectTemplate

Updates the InspectTemplate. See https://cloud.google.com/dlp/docs/creating-templates to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.organization_inspect_template_path("[ORGANIZATION]", "[INSPECT_TEMPLATE]")
response = dlp_service_client.update_inspect_template(formatted_name)

Parameters:

  • name (String)

    Resource name of organization and inspectTemplate to be updated, for example +organizations/433245324/inspectTemplates/432452342+ or projects/project-id/inspectTemplates/432452342.

  • inspect_template (Google::Privacy::Dlp::V2::InspectTemplate | Hash)

    New InspectTemplate value. A hash of the same form as Google::Privacy::Dlp::V2::InspectTemplate can also be provided.

  • update_mask (Google::Protobuf::FieldMask | Hash)

    Mask to control which fields get updated. A hash of the same form as Google::Protobuf::FieldMask can also be provided.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



836
837
838
839
840
841
842
843
844
845
846
847
848
849
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 836

def update_inspect_template \
    name,
    inspect_template: nil,
    update_mask: nil,
    options: nil,
    &block
  req = {
    name: name,
    inspect_template: inspect_template,
    update_mask: update_mask
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateInspectTemplateRequest)
  @update_inspect_template.call(req, options, &block)
end

#update_job_trigger(name, job_trigger: nil, update_mask: nil, options: nil) {|result, operation| ... } ⇒ Google::Privacy::Dlp::V2::JobTrigger

Updates a job trigger. See https://cloud.google.com/dlp/docs/creating-job-triggers to learn more.

Examples:

require "google/cloud/dlp"

dlp_service_client = Google::Cloud::Dlp.new(version: :V2)
formatted_name = Google::Cloud::Dlp::V2::DlpServiceClient.project_job_trigger_path("[PROJECT]", "[JOB_TRIGGER]")
response = dlp_service_client.update_job_trigger(formatted_name)

Parameters:

  • name (String)

    Resource name of the project and the triggeredJob, for example +projects/dlp-test-project/jobTriggers/53234423+.

  • job_trigger (Google::Privacy::Dlp::V2::JobTrigger | Hash)

    New JobTrigger value. A hash of the same form as Google::Privacy::Dlp::V2::JobTrigger can also be provided.

  • update_mask (Google::Protobuf::FieldMask | Hash)

    Mask to control which fields get updated. A hash of the same form as Google::Protobuf::FieldMask can also be provided.

  • options (Google::Gax::CallOptions)

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

Yields:

  • (result, operation)

    Access the result along with the RPC operation

Yield Parameters:

Returns:

Raises:

  • (Google::Gax::GaxError)

    if the RPC is aborted.



1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
# File 'lib/google/cloud/dlp/v2/dlp_service_client.rb', line 1594

def update_job_trigger \
    name,
    job_trigger: nil,
    update_mask: nil,
    options: nil,
    &block
  req = {
    name: name,
    job_trigger: job_trigger,
    update_mask: update_mask
  }.delete_if { |_, v| v.nil? }
  req = Google::Gax::to_proto(req, Google::Privacy::Dlp::V2::UpdateJobTriggerRequest)
  @update_job_trigger.call(req, options, &block)
end