# REST Resource: projects.locations.channels.events

- [Resource: Event](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#Event)
  - [JSON representation](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#Event.SCHEMA_REPRESENTATION)
- [InputSwitchTask](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#InputSwitchTask)
  - [JSON representation](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#InputSwitchTask.SCHEMA_REPRESENTATION)
- [AdBreakTask](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#AdBreakTask)
  - [JSON representation](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#AdBreakTask.SCHEMA_REPRESENTATION)
- [ReturnToProgramTask](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#ReturnToProgramTask)
- [SlateTask](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#SlateTask)
  - [JSON representation](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#SlateTask.SCHEMA_REPRESENTATION)
- [MuteTask](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#MuteTask)
  - [JSON representation](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#MuteTask.SCHEMA_REPRESENTATION)
- [UnmuteTask](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#UnmuteTask)
- [UpdateEncryptionsTask](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#UpdateEncryptionsTask)
  - [JSON representation](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#UpdateEncryptionsTask.SCHEMA_REPRESENTATION)
- [EncryptionUpdate](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#EncryptionUpdate)
  - [JSON representation](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#EncryptionUpdate.SCHEMA_REPRESENTATION)
- [State](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#State)
- [Methods](https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#METHODS_SUMMARY)

## Resource: Event

Event is a sub-resource of a channel, which can be scheduled by the user to execute operations on a channel resource without having to stop the channel.

| JSON representation |
|---|
| ``` { "name": string, "createTime": string, "updateTime": string, "labels": { string: string, ... }, "executeNow": boolean, "executionTime": string, "state": enum (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#State`), "error": { object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/Status`) }, // Union field `task` can be only one of the following: "inputSwitch": { object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#InputSwitchTask`) }, "adBreak": { object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#AdBreakTask`) }, "returnToProgram": { object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#ReturnToProgramTask`) }, "slate": { object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#SlateTask`) }, "mute": { object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#MuteTask`) }, "unmute": { object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#UnmuteTask`) }, "updateEncryptions": { object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#UpdateEncryptionsTask`) } // End of list of possible types for union field `task`. } ``` |

| Fields ||
|---|---|
| `name` | `string` The resource name of the event, in the form of: `projects/{project}/locations/{location}/channels/{channelId}/events/{eventId}`. |
| `createTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The creation time. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `updateTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. The update time. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `labels` | `map (key: string, value: string)` User-defined key/value metadata. An object containing a list of `"key": value` pairs. Example: `{ "name": "wrench", "mass": "1.3kg", "count": "3" }`. |
| `executeNow` | `boolean` When this field is set to true, the event will be executed at the earliest time that the server can schedule the event and `https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#Event.FIELDS.execution_time` will be populated with the time that the server actually schedules the event. |
| `executionTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` The time to execute the event. If you set `https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#Event.FIELDS.execute_now` to `true`, then do not set this field in the `events.create` request. In this case, the server schedules the event and populates this field. If you set `https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#Event.FIELDS.execute_now` to `false`, then you must set this field to at least 10 seconds in the future or else the event can't be created. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `state` | ``enum (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#State`)`` Output only. The state of the event. |
| `error` | ``object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/Status`)`` Output only. An error object that describes the reason for the failure. This property is always present when `state` is `FAILED`. |
| Union field `task`. Required. Operation to be executed by this event. `task` can be only one of the following: ||
| `inputSwitch` | ``object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#InputSwitchTask`)`` Switches to another input stream. |
| `adBreak` | ``object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#AdBreakTask`)`` Inserts a new ad opportunity. |
| `returnToProgram` | ``object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#ReturnToProgramTask`)`` Stops any running ad break. |
| `slate` | ``object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#SlateTask`)`` Inserts a slate. |
| `mute` | ``object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#MuteTask`)`` Mutes the stream. |
| `unmute` | ``object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#UnmuteTask`)`` Unmutes the stream. |
| `updateEncryptions` | ``object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#UpdateEncryptionsTask`)`` Updates encryption settings. |

## InputSwitchTask

Switches to another input stream. Automatic failover is then disabled.

| JSON representation |
|---|
| ``` { "inputKey": string } ``` |

| Fields ||
|---|---|
| `inputKey` | `string` The `https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels#InputAttachment.FIELDS.key` of the input to switch to. |

## AdBreakTask

Inserts a new ad opportunity.

| JSON representation |
|---|
| ``` { "duration": string } ``` |

| Fields ||
|---|---|
| `duration` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` Duration of an ad opportunity. Must be greater than 0. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |

## ReturnToProgramTask

This type has no fields.
Stops any events which are currently running. This only applies to events with a duration.

## SlateTask

Inserts a slate.

| JSON representation |
|---|
| ``` { "duration": string, "asset": string } ``` |

| Fields ||
|---|---|
| `duration` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` Optional. Duration of the slate. Must be greater than 0 if specified. Omit this field for a long running slate. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |
| `asset` | `string` Slate asset to use for the duration. If its duration is less than the duration of the SlateTask, then the slate loops. The slate must be represented in the form of: `projects/{project}/locations/{location}/assets/{assetId}`. |

## MuteTask

Mutes the stream.

| JSON representation |
|---|
| ``` { "duration": string } ``` |

| Fields ||
|---|---|
| `duration` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#duration` format)`` Duration for which the stream should be muted. If omitted, the stream will be muted until an UnmuteTask event is sent. A duration in seconds with up to nine fractional digits, ending with '`s`'. Example: `"3.5s"`. |

## UnmuteTask

This type has no fields.
Unmutes the stream. The task fails if the stream is not currently muted.

## UpdateEncryptionsTask

Update encryption settings.

| JSON representation |
|---|
| ``` { "encryptions": [ { object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#EncryptionUpdate`) } ] } ``` |

| Fields ||
|---|---|
| `encryptions[]` | ``object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#EncryptionUpdate`)`` Required. A list of `https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events#EncryptionUpdate`s that updates the existing encryption settings. |

## EncryptionUpdate

Encryption setting when updating encryption.

| JSON representation |
|---|
| ``` { "id": string, // Union field `secret_source` can be only one of the following: "secretManagerKeySource": { object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/SecretManagerSource`) } // End of list of possible types for union field `secret_source`. } ``` |

| Fields ||
|---|---|
| `id` | `string` Required. Identifier for the encryption option to be updated. |
| Union field `secret_source`. Defines where new content keys are stored. `secret_source` can be only one of the following: ||
| `secretManagerKeySource` | ``object (`https://docs.cloud.google.com/livestream/docs/reference/rest/v1/SecretManagerSource`)`` For keys stored in Google Secret Manager. |

## State

State of the event

| Enums ||
|---|---|
| `STATE_UNSPECIFIED` | Event state is not specified. |
| `SCHEDULED` | Event is scheduled but not executed yet. |
| `RUNNING` | Event is being executed. |
| `SUCCEEDED` | Event has been successfully executed. |
| `FAILED` | Event fails to be executed. |
| `PENDING` | Event has been created but not scheduled yet. |
| `STOPPED` | Event was stopped before running for its full duration. |

| ## Methods ||
|---|---|
| ### `https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events/create` | Creates an event with the provided unique ID in the specified channel. |
| ### `https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events/delete` | Deletes the specified event. |
| ### `https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events/get` | Returns the specified event. |
| ### `https://docs.cloud.google.com/livestream/docs/reference/rest/v1/projects.locations.channels.events/list` | Returns a list of all events in the specified channel. |