Skip to content

Commit c79bbda

Browse files
authored
Update DLP samples to new format (GoogleCloudPlatform#880)
1 parent 882adac commit c79bbda

32 files changed

+2366
-2689
lines changed

dlp/README.md

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,31 +27,21 @@ DLP API from PHP.
2727
4. **Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md).
2828
Run `php composer.phar install` (if composer is installed locally) or `composer install`
2929
(if composer is installed globally).
30-
5. Run `php dlp.php`. The following commands are available:
31-
32-
```
33-
help Displays help for a command
34-
inspect-datastore Inspect Cloud Datastore using the Data Loss Prevention (DLP) API.
35-
inspect-file Inspect a file using the Data Loss Prevention (DLP) API.
36-
inspect-string Inspect a string using the Data Loss Prevention (DLP) API.
37-
list Lists commands
38-
list-categories Lists all Info Type Categories for the Data Loss Prevention (DLP) API.
39-
list-info-types Lists all Info Types for the Data Loss Prevention (DLP) API.
40-
redact-string Redact sensitive data from a string using the Data Loss Prevention (DLP) API.
41-
```
42-
43-
Example:
44-
45-
```
46-
$ php dlp.php inspect-string 'Robert Frost'
30+
5. Execute the snippets in the [src/](src/) directory by running
31+
`php src/SNIPPET_NAME.php`. The usage will print for each if no arguments
32+
are provided:
33+
```sh
34+
$ php src/inspect_string.php
35+
Usage: php src/inspect_string.php PROJECT_ID STRING
36+
37+
$ php src/inspect_string.php your-project-id '[email protected]'
4738
Findings:
48-
Quote: Robert
49-
Info type: US_MALE_NAME
50-
Likelihood: Very likely
39+
40+
Info type: EMAIL_ADDRESS
41+
Likelihood: LIKELY
5142
```
5243

53-
54-
6. Run `php dlp.php COMMAND --help` to print information about the usage of each command.
44+
See the [DLP Documentation](https://cloud.google.com/dlp/docs/inspecting-text) for more information.
5545

5646
## Contributing changes
5747

dlp/composer.json

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,10 @@
33
"type": "project",
44
"require": {
55
"google/cloud-dlp": "^0.18.1",
6-
"google/cloud-pubsub": "^1.11.1",
7-
"symfony/console": "^3.3"
8-
},
9-
"autoload": {
10-
"files": [
11-
"src/inspect_datastore.php",
12-
"src/inspect_bigquery.php",
13-
"src/inspect_gcs.php",
14-
"src/inspect_file.php",
15-
"src/inspect_string.php",
16-
"src/list_info_types.php",
17-
"src/deidentify_mask.php",
18-
"src/deidentify_fpe.php",
19-
"src/reidentify_fpe.php",
20-
"src/deidentify_dates.php",
21-
"src/redact_image.php",
22-
"src/create_trigger.php",
23-
"src/list_triggers.php",
24-
"src/delete_trigger.php",
25-
"src/create_inspect_template.php",
26-
"src/list_inspect_templates.php",
27-
"src/delete_inspect_template.php",
28-
"src/list_jobs.php",
29-
"src/delete_job.php",
30-
"src/numerical_stats.php",
31-
"src/categorical_stats.php",
32-
"src/k_anonymity.php",
33-
"src/l_diversity.php",
34-
"src/k_map.php"
35-
]
6+
"google/cloud-pubsub": "^1.11.1"
367
},
378
"require-dev": {
389
"phpunit/phpunit": "^5",
39-
"google/cloud-tools": "^0.8.5"
10+
"google/cloud-tools": "dev-master"
4011
}
4112
}

0 commit comments

Comments
 (0)