# Google Cloud Functions V2 Client - Class EventTrigger (2.1.3)

2.1.3 (latest) 2.1.2 2.0.6 1.7.0 1.6.5 1.5.0 1.4.2 1.3.1 1.2.0 1.1.2 1.0.3 Reference documentation and code samples for the Google Cloud Functions V2 Client class EventTrigger.

Describes EventTrigger, used to request events to be sent from another
service.

Generated from protobuf message `google.cloud.functions.v2.EventTrigger`

## Namespace

Google \\ Cloud \\ Functions \\ V2

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ trigger` | `string` Output only. The resource name of the Eventarc trigger. The format of this field is `projects/{project}/locations/{region}/triggers/{trigger}`. |
| `↳ trigger_region` | `string` The region that the trigger will be in. The trigger will only receive events originating in this region. It can be the same region as the function, a different region or multi-region, or the global region. If not provided, defaults to the same region as the function. |
| `↳ event_type` | `string` Required. The type of event to observe. For example: `google.cloud.audit.log.v1.written` or `google.cloud.pubsub.topic.v1.messagePublished`. |
| `↳ event_filters` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.EventFilter>` Criteria used to filter events. |
| `↳ pubsub_topic` | `string` Optional. The name of a Pub/Sub topic in the same project that will be used as the transport topic for the event delivery. Format: `projects/{project}/topics/{topic}`. This is only valid for events of type `google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here will not be deleted at function deletion. |
| `↳ service_account_email` | `string` Optional. The email of the trigger's service account. The service account must have permission to invoke Cloud Run services, the permission is `run.routes.invoke`. If empty, defaults to the Compute Engine default service account: `{project_number}-compute\@developer.gserviceaccount.com`. |
| `↳ retry_policy` | `int` Optional. If unset, then defaults to ignoring failures (i.e. not retrying them). |
| `↳ channel` | `string` Optional. The name of the channel associated with the trigger in `projects/{project}/locations/{location}/channels/{channel}` format. You must provide a channel to receive events from Eventarc SaaS partners. |
| `↳ service` | `string` Optional. The hostname of the service that 1st Gen function should be observed. If no string is provided, the default service implementing the API will be used. For example, `storage.googleapis.com` is the default for all event types in the `google.storage` namespace. The field is only applicable to 1st Gen functions. |

### getTrigger

Output only. The resource name of the Eventarc trigger. The format of this
field is `projects/{project}/locations/{region}/triggers/{trigger}`.

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

### setTrigger

Output only. The resource name of the Eventarc trigger. The format of this
field is `projects/{project}/locations/{region}/triggers/{trigger}`.

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

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

### getTriggerRegion

The region that the trigger will be in. The trigger will only receive
events originating in this region. It can be the same
region as the function, a different region or multi-region, or the global
region. If not provided, defaults to the same region as the function.

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

### setTriggerRegion

The region that the trigger will be in. The trigger will only receive
events originating in this region. It can be the same
region as the function, a different region or multi-region, or the global
region. If not provided, defaults to the same region as the function.

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

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

### getEventType

Required. The type of event to observe. For example:
`google.cloud.audit.log.v1.written` or
`google.cloud.pubsub.topic.v1.messagePublished`.

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

### setEventType

Required. The type of event to observe. For example:
`google.cloud.audit.log.v1.written` or
`google.cloud.pubsub.topic.v1.messagePublished`.

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

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

### getEventFilters

Criteria used to filter events.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.EventFilter>` |   |

### setEventFilters

Criteria used to filter events.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.EventFilter>` |

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

### getPubsubTopic

Optional. The name of a Pub/Sub topic in the same project that will be used
as the transport topic for the event delivery. Format:
`projects/{project}/topics/{topic}`.

This is only valid for events of type
`google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here
will not be deleted at function deletion.

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

### setPubsubTopic

Optional. The name of a Pub/Sub topic in the same project that will be used
as the transport topic for the event delivery. Format:
`projects/{project}/topics/{topic}`.

This is only valid for events of type
`google.cloud.pubsub.topic.v1.messagePublished`. The topic provided here
will not be deleted at function deletion.

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

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

### getServiceAccountEmail

Optional. The email of the trigger's service account. The service account
must have permission to invoke Cloud Run services, the permission is
`run.routes.invoke`.

If empty, defaults to the Compute Engine default service account:
`{project_number}-compute\@developer.gserviceaccount.com`.

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

### setServiceAccountEmail

Optional. The email of the trigger's service account. The service account
must have permission to invoke Cloud Run services, the permission is
`run.routes.invoke`.

If empty, defaults to the Compute Engine default service account:
`{project_number}-compute\@developer.gserviceaccount.com`.

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

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

### getRetryPolicy

Optional. If unset, then defaults to ignoring failures (i.e. not retrying
them).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [RetryPolicy](https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.EventTrigger.RetryPolicy). |

### setRetryPolicy

Optional. If unset, then defaults to ignoring failures (i.e. not retrying
them).

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [RetryPolicy](https://docs.cloud.google.com/php/docs/reference/cloud-functions/latest/V2.EventTrigger.RetryPolicy). |

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

### getChannel

Optional. The name of the channel associated with the trigger in
`projects/{project}/locations/{location}/channels/{channel}` format.

You must provide a channel to receive events from Eventarc SaaS partners.

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

### setChannel

Optional. The name of the channel associated with the trigger in
`projects/{project}/locations/{location}/channels/{channel}` format.

You must provide a channel to receive events from Eventarc SaaS partners.

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

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

### getService

Optional. The hostname of the service that 1st Gen function should be
observed.

If no string is provided, the default service implementing the API will
be used. For example, `storage.googleapis.com` is the default for all
event types in the `google.storage` namespace.
The field is only applicable to 1st Gen functions.

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

### setService

Optional. The hostname of the service that 1st Gen function should be
observed.

If no string is provided, the default service implementing the API will
be used. For example, `storage.googleapis.com` is the default for all
event types in the `google.storage` namespace.
The field is only applicable to 1st Gen functions.

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

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