函数工作流 FUNCTIONGRAPH-示例1:创建函数和Timer触发器实现定时从OBS桶中下载文件:步骤4:创建Timer触发器,实现定时下载文件

时间:2025-05-28 09:46:55

步骤4:创建Timer触发器,实现定时下载文件

URI:POST /v2/{project_id}/fgs/triggers/{function_urn}

API文档详情请参见:创建触发器

  • 请求示例
    POST  https://{Endpoint}/v2/{project_id}/fgs/triggers/{function_urn}
    {
     "event_data": {
      "name": "Timer-download",
      "schedule_type": "Rate",
      "schedule": "1d"
     },
     "event_type_code": "MessageCreated",
     "trigger_status": "ACTIVE",
     "trigger_type_code": "TIMER"
    }

    function_urn为步骤1:创建下载文件的函数中记录的函数URN。

    上述请求示例表示每天从OBS桶中下载文件。

  • 响应示例
    {
     "trigger_id": "461bbe95-c85b-4dc9-a306-9701e77f1d66",
     "trigger_type_code": "TIMER",
     "trigger_status": "ACTIVE",
     "event_data": {
      "name": "Timer-download",
      "schedule": "1d",
      "schedule_type": "Rate"
     },
     "last_updated_time": "2020-06-04T10:33:30+08:00",
     "created_time": "2020-06-04T10:33:30+08:00"
    }
support.huaweicloud.com/api-functiongraph/functiongraph_06_0202.html