# NotificationConfig

Specification to configure notifications published to Pub/Sub. Notifications are published to the customer-provided topic using the following `PubsubMessage.attributes`:

- `"eventType"`: one of the `https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/NotificationConfig#EventType` values
- `"payloadFormat"`: one of the `https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/NotificationConfig#PayloadFormat` values
- `"projectId"`: the `https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/transferOperations#TransferOperation.FIELDS.project_id` of the `TransferOperation`
- `"transferJobName"`: the `https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/transferOperations#TransferOperation.FIELDS.transfer_job_name` of the `TransferOperation`
- `"transferOperationName"`: the `https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/transferOperations#TransferOperation.FIELDS.name` of the `TransferOperation`

The `PubsubMessage.data` contains a `https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/transferOperations#TransferOperation` resource formatted according to the specified `PayloadFormat`.

| JSON representation |
|---|
| ``` { "pubsubTopic": string, "eventTypes": [ enum (`https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/NotificationConfig#EventType`) ], "payloadFormat": enum (`https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/NotificationConfig#PayloadFormat`) } ``` |

| Fields ||
|---|---|
| `pubsubTopic` | `string` Required. The `Topic.name` of the Pub/Sub topic to which to publish notifications. Must be of the format: `projects/{project}/topics/{topic}`. Not matching this format results in an `https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/transferOperations#Code.ENUM_VALUES.INVALID_ARGUMENT` error. |
| `eventTypes[]` | ``enum (`https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/NotificationConfig#EventType`)`` Event types for which a notification is desired. If empty, send notifications for all event types. |
| `payloadFormat` | ``enum (`https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/NotificationConfig#PayloadFormat`)`` Required. The desired format of the notification message payloads. |

## EventType

Enum for specifying event types for which notifications are to be published.

Additional event types may be added in the future. Clients should either safely ignore unrecognized event types or explicitly specify which event types they are prepared to accept.

| Enums ||
|---|---|
| `EVENT_TYPE_UNSPECIFIED` | Illegal value, to avoid allowing a default. |
| `TRANSFER_OPERATION_SUCCESS` | `TransferOperation` completed with status `https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/transferOperations#Status.ENUM_VALUES.SUCCESS`. |
| `TRANSFER_OPERATION_FAILED` | `TransferOperation` completed with status `https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/transferOperations#Status.ENUM_VALUES.FAILED`. |
| `TRANSFER_OPERATION_ABORTED` | `TransferOperation` completed with status `https://docs.cloud.google.com/storage-transfer/docs/reference/rest/v1/transferOperations#Status.ENUM_VALUES.ABORTED`. |

## PayloadFormat

Enum for specifying the format of a notification message's payload.

| Enums ||
|---|---|
| `PAYLOAD_FORMAT_UNSPECIFIED` | Illegal value, to avoid allowing a default. |
| `NONE` | No payload is included with the notification. |
| `JSON` | `TransferOperation` is [formatted as a JSON response](https://developers.google.com/protocol-buffers/docs/proto3#json), in application/json. |