发布到 Cloud Dataflow 模板 REST 时无法设置动态模板 API

Cannot set dynamic template when posting to Cloud Dataflow template REST API

我正在尝试通过发布到 REST API 并通过 OAUTH 进行身份验证来使用 Cloud Scheduler 安排数据流作业。我创建了一个模板,当我手动使用 Dataflow 'Create job from template' 时它可以工作。但是,当用作 HTTP 端点 (https://dataflow.googleapis.com/v1b3/projects/${my.proj}/locations/europe-west1/templates:launch?gcsPath=gs://${my.proj}/templates/${template.name}) 时,returns 出现以下错误:

{
  "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"jobName\": Cannot bind query parameter. Field 'jobName' could not be found in request message.\nInvalid JSON payload received. Unknown name \"environment\": Cannot bind query parameter. Field 'environment' could not be found in request message.\nInvalid JSON payload received. Unknown name \"parameters\": Cannot bind query parameter. Field 'parameters' could not be found in request message.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "description": "Invalid JSON payload received. Unknown name \"jobName\": Cannot bind query parameter. Field 'jobName' could not be found in request message."
          },
          {
            "description": "Invalid JSON payload received. Unknown name \"environment\": Cannot bind query parameter. Field 'environment' could not be found in request message."
          },
          {
            "description": "Invalid JSON payload received. Unknown name \"parameters\": Cannot bind query parameter. Field 'parameters' could not be found in request message."
          }
        ]
      }
    ]
  }
}

以下是我的POST正文:

{
  "jobName": "test",
  "parameters": {
    "region": "europe-west1"
  },
  "environment": {
    "tempLocation": "gs://${my.proj}/temp",
    "zone": "europe-west1"
  }
}

非常感谢您的帮助,提前致谢!!

我确认以下有效:

TEMPLATE_LOCATION="gs://${my.proj}/templates/${template.name}"
API_ROOT_URL="https://dataflow.googleapis.com/"
TEMPLATES_LAUNCH_API="${API_ROOT_URL}/v1b3/projects/${my.proj}/locations/europe-west1/templates:launch"

time curl -X POST -H "Content-Type: application/json" \
 -H "Authorization: Bearer $(gcloud auth print-access-token)" \
 "${TEMPLATES_LAUNCH_API}"`
 `"?gcsPath=${TEMPLATE_LOCATION}"`
 ` -d ' 
 {
    "jobName": "test",
    "parameters": {},
    "environment": {
        "tempLocation": "gs://${my.proj}/temp",
        "workerZone": "europe-west1-d",
    }
}' 

注意参数中不需要指定region,是workerZone而不是zone。