函数工作流 FUNCTIONGRAPH-示例2:上传代码到OBS桶,并使用OBS链接创建函数:步骤3:调用创建函数API,使用OBS链接创建函数

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

步骤3:调用创建函数API,使用OBS链接创建函数

URI:POST /v2/{project_id}/fgs/functions

API文档详情请参见:创建函数

  • 请求示例
    POST  https://{Endpoint}/v2/{project_id}/fgs/functions
    {
     "code_type": "obs",
     "code_url": "https://test.obs.example.example.com/fss_examples_python2.7.zip",
     "func_name": "create_function_from_obs",
     "handler": "index.handler",
     "memory_size": 256,
     "package": "default",
     "runtime": "Python2.7",
     "timeout": 30
    }

    “code_url”为2中记录的OBS链接。

  • 响应示例
    {
     "func_urn": "urn:fss:{project_name}:{project_id}:function:default:create_function_from_obs:latest",
     "func_name": "create_function_from_obs",
     "domain_id": "0503xxxa960",
     "namespace": "{project_id}",
     "project_name": "xxx",
     "package": "default",
     "runtime": "Python2.7",
     "timeout": 30,
     "handler": "index.handler",
     "memory_size": 256,
     "cpu": 400,
     "code_type": "obs",
     "code_url": "https://test.obs.example.example.com/fss_examples_python2.7.zip",
     "code_filename": "fss_examples_python2.7.zip",
     "code_size": 436,
     "digest": "3af770ada27514564b1a20d964cba4b35f432fa40f9fc4f4f7c1f0d2f42eac6cb4db1358c195235966b05f66b4664e7bf31c3f384a9066b3d1fcc3e96b4c3f65",
     "version": "latest",
     "image_name": "latest-200619100734@gjf4p",
     "last_modified": "2020-06-19T10:07:34+08:00",
     "strategy_config": {
      "concurrency": -1
     },
     "StrategyConfig": {},
     "enterprise_project_id": "0"
    }
support.huaweicloud.com/api-functiongraph/functiongraph_06_0204.html
提示

您即将访问非华为云网站,请注意账号财产安全