用途:该配方用于订阅 Google Drive 文件或文件夹的变更通知,当目标资源发生变化时通过 Pub/Sub 推送事件。
前置条件:执行本配方前需先加载 gws-events 技能。
主要能力:
- 创建订阅:通过 gws events subscriptions create 命令,以 JSON 指定 targetResource(如 //drive.googleapis.com/drives/DRIVE_ID)、eventTypes(如 google.workspace.drive.file.v1.updated)、notificationEndpoint(pubsubTopic,如 projects/PROJECT/topics/TOPIC)以及 payloadOptions(如 includeResource: true)。
- 列出活跃订阅:使用 gws events subscriptions list。
- 到期前续订:使用 gws events +renew --name subscriptions/SUBSCRIPTION_ID。
使用方式:按步骤依次执行上述命令,先创建订阅,再通过列表命令确认,最后在到期前续订。
适用场景:需要监控 Google Drive 文件或文件夹变更并触发后续处理的自动化流程。
限制:资料未提供更多关于权限、配额、事件类型范围或错误处理的信息。