Reference documentation and code samples for the Data Loss Prevention V2 Client class PublishToPubSub.
Publish a message into a given Pub/Sub topic when DlpJob has completed. The
message contains a single field, DlpJobName, which is equal to the
finished job's
DlpJob.name.
Compatible with: Inspect, Risk
Generated from protobuf message google.privacy.dlp.v2.Action.PublishToPubSub
Namespace
Google \ Cloud \ Dlp \ V2 \ Action
Methods
__construct
Constructor.
Parameters
Name
Description
data
array
Optional. Data for populating the Message object.
↳ topic
string
Cloud Pub/Sub topic to send notifications to. The topic must have given publishing access rights to the DLP API service account executing the long running DlpJob sending the notifications. Format is projects/{project}/topics/{topic}.
getTopic
Cloud Pub/Sub topic to send notifications to. The topic must have given
publishing access rights to the DLP API service account executing
the long running DlpJob sending the notifications.
Format is projects/{project}/topics/{topic}.
Returns
Type
Description
string
setTopic
Cloud Pub/Sub topic to send notifications to. The topic must have given
publishing access rights to the DLP API service account executing
the long running DlpJob sending the notifications.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-09 UTC."],[],[],null,["# Data Loss Prevention V2 Client - Class PublishToPubSub (2.6.1)\n\nVersion latestkeyboard_arrow_down\n\n- [2.6.1 (latest)](/php/docs/reference/cloud-dlp/latest/V2.Action.PublishToPubSub)\n- [2.6.0](/php/docs/reference/cloud-dlp/2.6.0/V2.Action.PublishToPubSub)\n- [2.4.1](/php/docs/reference/cloud-dlp/2.4.1/V2.Action.PublishToPubSub)\n- [2.3.0](/php/docs/reference/cloud-dlp/2.3.0/V2.Action.PublishToPubSub)\n- [2.2.3](/php/docs/reference/cloud-dlp/2.2.3/V2.Action.PublishToPubSub)\n- [2.1.0](/php/docs/reference/cloud-dlp/2.1.0/V2.Action.PublishToPubSub)\n- [2.0.0](/php/docs/reference/cloud-dlp/2.0.0/V2.Action.PublishToPubSub)\n- [1.19.0](/php/docs/reference/cloud-dlp/1.19.0/V2.Action.PublishToPubSub)\n- [1.18.0](/php/docs/reference/cloud-dlp/1.18.0/V2.Action.PublishToPubSub)\n- [1.17.0](/php/docs/reference/cloud-dlp/1.17.0/V2.Action.PublishToPubSub)\n- [1.16.0](/php/docs/reference/cloud-dlp/1.16.0/V2.Action.PublishToPubSub)\n- [1.15.1](/php/docs/reference/cloud-dlp/1.15.1/V2.Action.PublishToPubSub)\n- [1.14.0](/php/docs/reference/cloud-dlp/1.14.0/V2.Action.PublishToPubSub)\n- [1.13.2](/php/docs/reference/cloud-dlp/1.13.2/V2.Action.PublishToPubSub)\n- [1.12.0](/php/docs/reference/cloud-dlp/1.12.0/V2.Action.PublishToPubSub)\n- [1.11.0](/php/docs/reference/cloud-dlp/1.11.0/V2.Action.PublishToPubSub)\n- [1.10.2](/php/docs/reference/cloud-dlp/1.10.2/V2.Action.PublishToPubSub)\n- [1.9.0](/php/docs/reference/cloud-dlp/1.9.0/V2.Action.PublishToPubSub)\n- [1.8.6](/php/docs/reference/cloud-dlp/1.8.6/V2.Action.PublishToPubSub) \nReference documentation and code samples for the Data Loss Prevention V2 Client class PublishToPubSub.\n\nPublish a message into a given Pub/Sub topic when DlpJob has completed. The\nmessage contains a single field, `DlpJobName`, which is equal to the\nfinished job's\n[`DlpJob.name`](https://cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/projects.dlpJobs#DlpJob).\n\nCompatible with: Inspect, Risk\n\nGenerated from protobuf message `google.privacy.dlp.v2.Action.PublishToPubSub`\n\nNamespace\n---------\n\nGoogle \\\\ Cloud \\\\ Dlp \\\\ V2 \\\\ Action\n\nMethods\n-------\n\n### __construct\n\nConstructor.\n\n### getTopic\n\nCloud Pub/Sub topic to send notifications to. The topic must have given\npublishing access rights to the DLP API service account executing\nthe long running DlpJob sending the notifications.\n\nFormat is projects/{project}/topics/{topic}.\n\n### setTopic\n\nCloud Pub/Sub topic to send notifications to. The topic must have given\npublishing access rights to the DLP API service account executing\nthe long running DlpJob sending the notifications.\n\nFormat is projects/{project}/topics/{topic}."]]