Skip to content

Commit

Permalink
Create Data Loss Prevention: Qwik Start - JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
Ayush7-BIT authored Jul 20, 2023
1 parent e15f951 commit 26e3e44
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions Data Loss Prevention: Qwik Start - JSON
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
cat > inspect-request.json << EOF
{
"item":{
"value":"My phone number is (206) 555-0123."
},
"inspectConfig":{
"infoTypes":[
{
"name":"PHONE_NUMBER"
},
{
"name":"US_TOLLFREE_PHONE_NUMBER"
}
],
"minLikelihood":"POSSIBLE",
"limits":{
"maxFindingsPerItem":0
},
"includeQuote":true
}
}
EOF
gcloud auth print-access-token
curl -s \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://dlp.googleapis.com/v2/projects/$DEVSHELL_PROJECT_ID/content:inspect \
-d @inspect-request.json -o inspect-output.txt
gsutil cp inspect-output.txt gs://$DEVSHELL_PROJECT_ID-bucket
cat > new-inspect-file.json << EOF
{
"item": {
"value":"My email is [email protected]",
},
"deidentifyConfig": {
"infoTypeTransformations":{
"transformations": [
{
"primitiveTransformation": {
"replaceWithInfoTypeConfig": {}
}
}
]
}
},
"inspectConfig": {
"infoTypes": {
"name": "EMAIL_ADDRESS"
}
}
}
EOF
curl -s \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://dlp.googleapis.com/v2/projects/$DEVSHELL_PROJECT_ID/content:deidentify \
-d @new-inspect-file.json -o redact-output.txt
cat redact-output.txt
gsutil cp redact-output.txt gs://$DEVSHELL_PROJECT_ID-bucket

0 comments on commit 26e3e44

Please sign in to comment.