Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 19329bc

Browse files
authored
Create Data Loss Prevention: Qwik Start - JSON
1 parent e599597 commit 19329bc

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
2+
cat > inspect-request.json << EOF
3+
{
4+
"item":{
5+
"value":"My phone number is (206) 555-0123."
6+
},
7+
"inspectConfig":{
8+
"infoTypes":[
9+
{
10+
"name":"PHONE_NUMBER"
11+
},
12+
{
13+
"name":"US_TOLLFREE_PHONE_NUMBER"
14+
}
15+
],
16+
"minLikelihood":"POSSIBLE",
17+
"limits":{
18+
"maxFindingsPerItem":0
19+
},
20+
"includeQuote":true
21+
}
22+
}
23+
EOF
24+
gcloud auth print-access-token
25+
curl -s \
26+
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
27+
-H "Content-Type: application/json" \
28+
https://dlp.googleapis.com/v2/projects/$DEVSHELL_PROJECT_ID/content:inspect \
29+
-d @inspect-request.json -o inspect-output.txt
30+
gsutil cp inspect-output.txt gs://$DEVSHELL_PROJECT_ID-bucket
31+
cat > new-inspect-file.json << EOF
32+
{
33+
"item": {
34+
"value":"My email is [email protected]",
35+
},
36+
"deidentifyConfig": {
37+
"infoTypeTransformations":{
38+
"transformations": [
39+
{
40+
"primitiveTransformation": {
41+
"replaceWithInfoTypeConfig": {}
42+
}
43+
}
44+
]
45+
}
46+
},
47+
"inspectConfig": {
48+
"infoTypes": {
49+
"name": "EMAIL_ADDRESS"
50+
}
51+
}
52+
}
53+
EOF
54+
curl -s \
55+
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
56+
-H "Content-Type: application/json" \
57+
https://dlp.googleapis.com/v2/projects/$DEVSHELL_PROJECT_ID/content:deidentify \
58+
-d @new-inspect-file.json -o redact-output.txt
59+
cat redact-output.txt
60+
gsutil cp redact-output.txt gs://$DEVSHELL_PROJECT_ID-bucket

0 commit comments

Comments
 (0)