是否可以使用 Google Scheduler API 安排作业?

Is it possible to schedule a Job using Google Scheduler API?

使用 Google Cloud Scheduler,可以创建具有 Pub/Sub 目标的 Cloud Scheduler 作业。是否可以使用 Cloud Scheduler API 执行相同的操作?我没有在 Cloud Scheduler API 文档中找到计划信息。

看来答案是肯定的。 Cloud Scheduler 将计划的工作称为 job。有一个 REST API 可以创建一个可以在更高级别记录 here. If we read that page carefully we find that it is a POST request which takes a Job as a payload which contains a JSON description of what we want to describe which includes CRON based schedule and target parameters of what should be fired when the scheduler is reached. If we don't want to work at the REST level, there appears to be client API bindings 的作业。

这当然可以!

以下命令创建一个作业,每 3 小时向 Pub/Sub 主题 'my-topic' 发布一条正文为 'Hello' 的消息:

gcloud scheduler jobs create pubsub my-job \
  --schedule="0 */3 * * *" \
  --topic=my-topic \
  --message-body="Hello"

对于其他选项和标志,我建议阅读 documentation