# Google Cloud Eventarc V1 Client - Class Pubsub (2.3.1)

2.3.1 (latest) 2.3.0 2.2.1 2.1.5 2.0.1 1.3.5 1.2.2 1.1.1 1.0.5 Reference documentation and code samples for the Google Cloud Eventarc V1 Client class Pubsub.

Represents a Pub/Sub transport.

Generated from protobuf message `google.cloud.eventarc.v1.Pubsub`

## Namespace

Google \\ Cloud \\ Eventarc \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ topic` | `string` Optional. The name of the Pub/Sub topic created and managed by Eventarc as a transport for the event delivery. Format: `projects/{PROJECT_ID}/topics/{TOPIC_NAME}`. You can set an existing topic for triggers of the type `google.cloud.pubsub.topic.v1.messagePublished`. The topic you provide here is not deleted by Eventarc at trigger deletion. |
| `↳ subscription` | `string` Output only. The name of the Pub/Sub subscription created and managed by Eventarc as a transport for the event delivery. Format: `projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`. |

### getTopic

Optional. The name of the Pub/Sub topic created and managed by Eventarc as
a transport for the event delivery. Format:
`projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.

You can set an existing topic for triggers of the type
`google.cloud.pubsub.topic.v1.messagePublished`. The topic you provide
here is not deleted by Eventarc at trigger deletion.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setTopic

Optional. The name of the Pub/Sub topic created and managed by Eventarc as
a transport for the event delivery. Format:
`projects/{PROJECT_ID}/topics/{TOPIC_NAME}`.

You can set an existing topic for triggers of the type
`google.cloud.pubsub.topic.v1.messagePublished`. The topic you provide
here is not deleted by Eventarc at trigger deletion.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSubscription

Output only. The name of the Pub/Sub subscription created and managed by
Eventarc as a transport for the event delivery. Format:
`projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setSubscription

Output only. The name of the Pub/Sub subscription created and managed by
Eventarc as a transport for the event delivery. Format:
`projects/{PROJECT_ID}/subscriptions/{SUBSCRIPTION_NAME}`.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |