diff --git a/Data Loss Prevention: Qwik Start - JSON b/Data Loss Prevention: Qwik Start - JSON new file mode 100644 index 0000000..672e6d2 --- /dev/null +++ b/Data Loss Prevention: Qwik Start - JSON @@ -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 test@gmail.com", + }, + "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