File tree Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Expand file tree Collapse file tree 2 files changed +17
-9
lines changed Original file line number Diff line number Diff line change 36
36
* List Data Loss Prevention API jobs corresponding to a given filter.
37
37
*/
38
38
use Google \Cloud \Dlp \V2 \DlpServiceClient ;
39
+ use Google \Cloud \Dlp \V2 \DlpJob \JobState ;
39
40
use Google \Cloud \Dlp \V2 \DlpJobType ;
40
41
41
42
/** Uncomment and populate these variables in your code */
63
64
printf ('Job %s status: %s ' . PHP_EOL , $ job ->getName (), $ job ->getState ());
64
65
$ infoTypeStats = $ job ->getInspectDetails ()->getResult ()->getInfoTypeStats ();
65
66
66
- if (count ($ infoTypeStats ) > 0 ) {
67
- foreach ($ infoTypeStats as $ infoTypeStat ) {
68
- printf (
69
- ' Found %s instance(s) of type %s ' . PHP_EOL ,
70
- $ infoTypeStat ->getCount (),
71
- $ infoTypeStat ->getInfoType ()->getName ()
72
- );
67
+ if ($ job ->getState () == JobState::DONE ) {
68
+ if (count ($ infoTypeStats ) > 0 ) {
69
+ foreach ($ infoTypeStats as $ infoTypeStat ) {
70
+ printf (
71
+ ' Found %s instance(s) of type %s ' . PHP_EOL ,
72
+ $ infoTypeStat ->getCount (),
73
+ $ infoTypeStat ->getInfoType ()->getName ()
74
+ );
75
+ }
76
+ } else {
77
+ print (' No findings. ' . PHP_EOL );
73
78
}
74
- } else {
75
- print (' No findings. ' . PHP_EOL );
76
79
}
77
80
}
78
81
# [END dlp_list_jobs]
Original file line number Diff line number Diff line change @@ -168,6 +168,11 @@ public function testDeidReidFPE()
168
168
public function testTriggers ()
169
169
{
170
170
$ bucketName = $ this ->requireEnv ('GOOGLE_STORAGE_BUCKET ' );
171
+ // Use a different bucket for triggers so we don't trigger a bunch of
172
+ // DLP jobs on our actual storage bucket. This will create the trigger
173
+ // on a nonexistant bucket.
174
+ $ bucketName .= '-dlp-triggers ' ;
175
+
171
176
$ displayName = uniqid ("My trigger display name " );
172
177
$ description = uniqid ("My trigger description " );
173
178
$ triggerId = uniqid ('my-php-test-trigger- ' );
You can’t perform that action at this time.
0 commit comments