16
16
17
17
package com .example .dlp ;
18
18
19
+ import com .google .cloud .ServiceOptions ;
19
20
import com .google .cloud .dlp .v2 .DlpServiceClient ;
20
21
import com .google .privacy .dlp .v2 .ByteContentItem ;
21
22
import com .google .privacy .dlp .v2 .ContentItem ;
26
27
import com .google .privacy .dlp .v2 .InspectContentResponse ;
27
28
import com .google .privacy .dlp .v2 .InspectResult ;
28
29
import com .google .privacy .dlp .v2 .Likelihood ;
30
+ import com .google .privacy .dlp .v2 .ProjectName ;
29
31
import com .google .protobuf .ByteString ;
30
32
import java .util .Arrays ;
31
33
import java .util .List ;
@@ -59,7 +61,9 @@ public static void main(String[] args) throws Exception {
59
61
try (DlpServiceClient dlpServiceClient = DlpServiceClient .create ()) {
60
62
61
63
InspectConfig .FindingLimits findingLimits =
62
- InspectConfig .FindingLimits .newBuilder ().setMaxFindingsPerItem (maxFindings ).build ();
64
+ InspectConfig .FindingLimits .newBuilder ()
65
+ .setMaxFindingsPerItem (maxFindings )
66
+ .build ();
63
67
64
68
InspectConfig inspectConfig =
65
69
InspectConfig .newBuilder ()
@@ -76,8 +80,10 @@ public static void main(String[] args) throws Exception {
76
80
.build ();
77
81
ContentItem contentItem = ContentItem .newBuilder ().setByteItem (byteContentItem ).build ();
78
82
83
+ String projectId = ServiceOptions .getDefaultProjectId ();
79
84
InspectContentRequest request =
80
85
InspectContentRequest .newBuilder ()
86
+ .setParent (ProjectName .of (projectId ).toString ())
81
87
.setInspectConfig (inspectConfig )
82
88
.setItem (contentItem )
83
89
.build ();
0 commit comments