2525// [START scc_create_notification_config]
2626use Google \Cloud \SecurityCenter \V1 \SecurityCenterClient ;
2727use Google \Cloud \SecurityCenter \V1 \NotificationConfig ;
28+ use Google \Cloud \SecurityCenter \V1 \NotificationConfig \StreamingConfig ;
2829
2930/** Uncomment and populate these variables in your code */
3031// $organizationId = "{your-org-id}";
3637$ organizationName = $ securityCenterClient ::organizationName ($ organizationId );
3738$ pubsubTopic = $ securityCenterClient ::topicName ($ projectId , $ topicName );
3839
39- $ streamingConfig = new NotificationConfig \ StreamingConfig ();
40+ $ streamingConfig = new StreamingConfig ();
4041$ streamingConfig ->setFilter ("state = \"ACTIVE \"" );
41- $ notificationConfig = new NotificationConfig ();
42- $ notificationConfig ->setDescription ('A sample notification config ' );
43- $ notificationConfig ->setPubsubTopic ($ pubsubTopic );
44- $ notificationConfig ->setStreamingConfig ($ streamingConfig );
42+ $ notificationConfig = ( new NotificationConfig ())
43+ ->setDescription ('A sample notification config ' )
44+ ->setPubsubTopic ($ pubsubTopic )
45+ ->setStreamingConfig ($ streamingConfig );
4546
4647$ response = $ securityCenterClient ->createNotificationConfig (
4748 $ organizationName ,
5051);
5152printf ('Notification config was created: %s ' , $ response ->getName ());
5253
53- $ securityCenterClient ->close ();
54- // [END scc_create_notification_config]
54+ // [END scc_create_notification_config]
0 commit comments