https://cloud.google.com/scheduler/docs/schedule-run-cron-job?hl=ja
https://qiita.com/chidakiyo/items/2bbedfdb29a70acd4e45
-- 1. 前作業
gcloud init
gcloud auth list
gcloud --version
gcloud projects create project01-9999999 \
--name="project01"
gcloud config list
gcloud config set project project01-9999999
gcloud config set compute/region asia-northeast1 --quiet
gcloud config set compute/zone asia-northeast1-a --quiet
gcloud beta billing accounts list
gcloud beta billing projects link project01-9999999 --billing-account=111111-111111-111111
gcloud services enable compute.googleapis.com --project project01-9999999
gcloud components update
-- 2. Cloud Scheduler API と Pub/Sub API を有効化
gcloud services list --enabled
gcloud services enable cloudscheduler.googleapis.com pubsub.googleapis.com \
--project project01-9999999
-- 3. トピックの作成
gcloud pubsub topics create topic01
gcloud pubsub topics list
-- 4. サブスクリプションの作成
gcloud pubsub subscriptions create ss01 \
--topic=topic01
gcloud pubsub subscriptions list
-- 5. Cloud Scheduler ジョブの作成
gcloud scheduler jobs create pubsub job01 \
--schedule "* * * * *" \
--topic topic01 \
--location asia-northeast1 \
--message-body "Hello world!"
gcloud scheduler jobs list \
--location asia-northeast1
-- 6. Cloud Scheduler ジョブを手動実行する
gcloud scheduler jobs run job01 \
--location asia-northeast1
-- 7. Pub/Sub で結果を確認する
gcloud pubsub subscriptions pull ss01 \
--limit 100
-- 8. クリーンアップ
gcloud scheduler jobs delete job01 \
--location asia-northeast1 \
--quiet
gcloud projects list
gcloud projects delete project01-9999999 \
--quiet