函数工作流 FUNCTIONGRAPH-示例1:创建函数和Timer触发器实现定时从OBS桶中下载文件:步骤2:修改函数配置信息中的OBS地址、OBS桶名和文件名

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

步骤2:修改函数配置信息中的OBS地址、OBS桶名和文件名

URI:PUT /v2/{project_id}/fgs/functions/{function_urn}/config

API文档详情请参见:修改函数的metadata信息

  • 请求示例
    PUT  https://{Endpoint}/v2/{project_id}/fgs/functions/{function_urn}/config
    {
     "func_name": "download_file_from_obs",
     "handler": "index.handler",
     "memory_size": 256,
     "runtime": "Python2.7",
     "timeout": 30,
     "user_data": "{\"obs_address\":\"obs.example.example.com\",\"srcBucket\":\" xxx\",\"srcObjName\":\"xxx\"}",
     "xrole": "xxx"
    }

    function_urn为步骤1:创建下载文件的函数中记录的函数URN,obs_address为OBS地址,srcBucket为OBS桶名,srcObjName为文件名,xrole为委托名。

  • 响应示例
    {
     "func_urn": "urn:fss:{project_name}:{project_id}:function:default:download_file_from_obs:latest",
     "func_name": "download_file_from_obs",
     "domain_id": "89fexxxd636",
     "namespace": "{project_id}",
     "project_name": "xxx",
     "package": "default",
     "runtime": "Python2.7",
     "timeout": 30,
     "handler": "index.handler",
     "memory_size": 256,
     "cpu": 400,
     "code_type": "inline",
     "code_filename": "index.zip",
     "code_size": 1707,
     "user_data": "{\"obs_address\":\"obs.example.example.com\",\"srcBucket\":\"xxx\",\"srcObjName\":\"xxx\"}",
     "digest": "68891a6778848a78bd37a8c0798c91d75a5c87aee6e901303047a52edf05bf2170aac4149d79b3f6a40efe78406a83bf6d8683e7b25da4f0c07e7493aa4ccdcd",
     "version": "latest",
     "image_name": "latest-200603165355@varrp",
     "xrole": "xxx",
     "app_xrole": "xxx",
     "last_modified": "2020-06-03T17:25:03+08:00",
     "strategy_config": {
      "concurrency": -1
     },
     "StrategyConfig": {},
     "enterprise_project_id": "0"
    }
support.huaweicloud.com/api-functiongraph/functiongraph_06_0202.html