Cloud Data Loss Prevention (Cloud DLP) is now a part of Sensitive Data Protection. The API name remains the same: Cloud Data Loss Prevention API (DLP API). For information about the services that make up Sensitive Data Protection, see Sensitive Data Protection overview.
Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
ניתוח ממצאים שמאוחסנים כטקסט בפורמט Protobuf
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
בדוגמת הקוד הזו אפשר לראות איך לחלץ פרטים מתוצאות הבדיקה שנשמרו בפורמט טקסט של Protobuf. צריך לבצע את המשימה הזו אם שמרתם את הממצאים של הבדיקה ב-Cloud Storage.
בדוגמה הזו, האובייקט SaveToGcsFindingsOutput שיוצא מומר לפורמט שקריא לבני אדם. אחר כך תוכלו להשתמש בתוצאה כדי לנתח ממצאים ספציפיים של הבדיקה.
כדי לבצע אימות ב-Sensitive Data Protection, צריך להגדיר את Application Default Credentials.
מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.
importcom.google.privacy.dlp.v2.Finding;importcom.google.privacy.dlp.v2.SaveToGcsFindingsOutput;importcom.google.protobuf.ByteString;importcom.google.protobuf.TextFormat;importjava.io.FileInputStream;importjava.io.IOException;importjava.io.InputStreamReader;importjava.io.Reader;importjava.nio.charset.StandardCharsets;publicclassProcessInspectFindingsSavedToGcs{publicstaticvoidmain(String[]args)throwsException{// TODO(developer): Replace these variables before running the sample.StringinputPath="src/test/resources/save_to_gcs_findings.txt";processFindingsGcsFile(inputPath);}// Processes a file containing findings from a DLP inspect job.publicstaticvoidprocessFindingsGcsFile(StringinputPath)throwsIOException{SaveToGcsFindingsOutput.Builderbuilder=SaveToGcsFindingsOutput.newBuilder();try(Readerreader=newInputStreamReader(newFileInputStream(inputPath),StandardCharsets.UTF_8)){TextFormat.merge(reader,builder);}SaveToGcsFindingsOutputoutput=builder.build();// Parse the converted proto and process resultsSystem.out.println("Findings: "+output.getFindingsCount());for(Findingf:output.getFindingsList()){System.out.println("\tInfo type: "+f.getInfoType().getName());System.out.println("\tLikelihood: "+f.getLikelihood());}}}
[[["התוכן קל להבנה","easyToUnderstand","thumb-up"],["התוכן עזר לי לפתור בעיה","solvedMyProblem","thumb-up"],["סיבה אחרת","otherUp","thumb-up"]],[["התוכן קשה להבנה","hardToUnderstand","thumb-down"],["שגיאות בקוד לדוגמה או במידע","incorrectInformationOrSampleCode","thumb-down"],["חסרים לי פרטים או דוגמאות","missingTheInformationSamplesINeed","thumb-down"],["בעיה בתרגום","translationIssue","thumb-down"],["סיבה אחרת","otherDown","thumb-down"]],["עדכון אחרון: 2026-06-18 (שעון UTC)."],[],[]]