Skip to content

Commit 2776614

Browse files
authored
fix: migrate DLP samples to use regional syntax in parent field (GoogleCloudPlatform#1122)
1 parent 091b3c2 commit 2776614

24 files changed

+42
-23
lines changed

dlp/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,23 @@ This simple command-line application demonstrates how to invoke
4545

4646
See the [DLP Documentation](https://cloud.google.com/dlp/docs/inspecting-text) for more information.
4747

48+
## Troubleshooting
49+
50+
### bcmath extension missing
51+
52+
If you see an error like this:
53+
54+
```
55+
PHP Fatal error: Uncaught Error: Call to undefined function Google\Protobuf\Internal\bccomp() in /usr/local/google/home/crwilson/github/GoogleCloudPlatform/php-docs-samples/dlp/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php:986
56+
```
57+
58+
You may need to install the bcmath PHP extension.
59+
e.g. (may depend on your php version)
60+
```
61+
$ sudo apt-get install php7.3-bcmath
62+
```
63+
64+
4865
## Contributing changes
4966
5067
* See [CONTRIBUTING.md](../CONTRIBUTING.md)

dlp/src/categorical_stats.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
->setActions([$action]);
9595

9696
// Submit request
97-
$parent = $dlp->projectName($callingProjectId);
97+
$parent = "projects/$callingProjectId/locations/global";;
9898
$job = $dlp->createDlpJob($parent, [
9999
'riskJob' => $riskJob
100100
]);

dlp/src/create_inspect_template.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
->setDescription($description);
8787

8888
// Run request
89-
$parent = $dlp->projectName($callingProjectId);
89+
$parent = "projects/$callingProjectId/locations/global";
9090
$template = $dlp->createInspectTemplate($parent, [
9191
'inspectTemplate' => $inspectTemplate,
9292
'templateId' => $templateId

dlp/src/create_trigger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
->setDescription($description);
130130

131131
// Run trigger creation request
132-
$parent = $dlp->projectName($callingProjectId);
132+
$parent = "projects/$callingProjectId/locations/global";
133133
$trigger = $dlp->createJobTrigger($parent, [
134134
'jobTrigger' => $jobTriggerObject,
135135
'triggerId' => $triggerId

dlp/src/deidentify_dates.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
$deidentifyConfig = (new DeidentifyConfig())
152152
->setRecordTransformations($recordTransformations);
153153

154-
$parent = $dlp->projectName($callingProjectId);
154+
$parent = "projects/$callingProjectId/locations/global";
155155

156156
// Run request
157157
$response = $dlp->deidentifyContent($parent, [

dlp/src/deidentify_fpe.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
$content = (new ContentItem())
105105
->setValue($string);
106106

107-
$parent = $dlp->projectName($callingProjectId);
107+
$parent = "projects/$callingProjectId/locations/global";
108108

109109
// Run request
110110
$response = $dlp->deidentifyContent($parent, [

dlp/src/deidentify_mask.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
$item = (new ContentItem())
8383
->setValue($string);
8484

85-
$parent = $dlp->projectName($callingProjectId);
85+
$parent = "projects/$callingProjectId/locations/global";
8686

8787
// Run request
8888
$response = $dlp->deidentifyContent($parent, [

dlp/src/inspect_bigquery.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
$subscription = $topic->subscription($subscriptionId);
115115

116116
// Submit request
117-
$parent = $dlp->projectName($callingProjectId);
117+
$parent = "projects/$callingProjectId/locations/global";
118118
$job = $dlp->createDlpJob($parent, [
119119
'inspectJob' => $inspectJob
120120
]);

dlp/src/inspect_datastore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
$subscription = $topic->subscription($subscriptionId);
119119

120120
// Submit request
121-
$parent = $dlp->projectName($callingProjectId);
121+
$parent = "projects/$callingProjectId/locations/global";
122122
$job = $dlp->createDlpJob($parent, [
123123
'inspectJob' => $inspectJob
124124
]);

dlp/src/inspect_gcs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
$subscription = $topic->subscription($subscriptionId);
115115

116116
// Submit request
117-
$parent = $dlp->projectName($callingProjectId);
117+
$parent = "projects/$callingProjectId/locations/global";
118118
$job = $dlp->createDlpJob($parent, [
119119
'inspectJob' => $inspectJob
120120
]);

0 commit comments

Comments
 (0)