華為云計算 云知識 創(chuàng)建依賴包CreateDependency
創(chuàng)建依賴包CreateDependency

 

功能介紹

創(chuàng)建依賴包

調(diào)試

您可以在API Explorer中調(diào)試該接口,支持自動認(rèn)證鑒權(quán)。API Explorer可以自動生成SDK代碼示例,并提供SDK代碼示例調(diào)試功能。

URI

POST /v2/{project_id}/fgs/dependencies

表1 路徑參數(shù)

參數(shù)

是否必選

參數(shù)類型

描述

project_id

String

租戶項目 ID,獲取方式請參見獲取項目ID。

請求參數(shù)

表2 請求Header參數(shù)

參數(shù)

是否必選

參數(shù)類型

描述

X-Auth-Token

String

用戶Token。

通過調(diào)用 IAM 服務(wù)獲取用戶Token接口獲?。憫?yīng)消息頭中X-Subject-Token的值)。

表3 請求Body參數(shù)

參數(shù)

是否必選

參數(shù)類型

描述

depend_file

String

depend_type為zip類型時必填,為文件流格式,需要base64編碼zip文件。

depend_link

String

depend_type為obs類型時,依賴包在obs的存儲地址。

depend_type

String

導(dǎo)入類型,目前支持obs和zip。

runtime

String

FunctionGraph函數(shù)的執(zhí)行環(huán)境 Python2.7: Python語言2.7版本。 Python3.6: Pyton語言3.6版本。 Python3.9: Python語言3.9版本。 Go1.8: Go語言1.8版本。 Go1.x: Go語言1.x版本。 Java8: Java語言8版本。 Java11: Java語言11版本。 Node.js6.10: Nodejs語言6.10版本。 Node.js8.10: Nodejs語言8.10版本。 Node.js10.16: Nodejs語言10.16版本。 Node.js12.13: Nodejs語言12.13版本。 Node.js14.18: Nodejs語言14.18版本。 C#(.NET Core 2.0): C#語言2.0版本。 C#(.NET Core 2.1): C#語言2.1版本。 C#(.NET Core 3.1): C#語言3.1版本。 Custom: 自定義運(yùn)行時。 PHP7.3: Php語言7.3版本。 http: HTTP函數(shù)。

枚舉值:

  • Java8

  • Java11

  • Node.js6.10

  • Node.js8.10

  • Node.js10.16

  • Node.js12.13

  • Node.js14.18

  • Python2.7

  • Python3.6

  • Go1.8

  • Go1.x

  • C#(.NET Core 2.0)

  • C#(.NET Core 2.1)

  • C#(.NET Core 3.1)

  • Custom

  • PHP7.3

  • Python3.9

  • http

name

String

依賴包名稱。必須以大、小寫字母開頭,以字母或數(shù)字結(jié)尾,只能由字母、數(shù)字、下劃線、點(diǎn)和中劃線組成,長度不超過96個字符。

description

String

依賴包描述,不超過512個字符。

響應(yīng)參數(shù)

狀態(tài)碼: 200

表4 響應(yīng)Body參數(shù)

參數(shù)

參數(shù)類型

描述

id

String

依賴包版本ID。

owner

String

依賴包擁有者。

link

String

依賴包在obs的存儲地址。

runtime

String

FunctionGraph函數(shù)的執(zhí)行環(huán)境 Python2.7: Python語言2.7版本。 Python3.6: Pyton語言3.6版本。 Python3.9: Python語言3.9版本。 Go1.8: Go語言1.8版本。 Go1.x: Go語言1.x版本。 Java8: Java語言8版本。 Java11: Java語言11版本。 Node.js6.10: Nodejs語言6.10版本。 Node.js8.10: Nodejs語言8.10版本。 Node.js10.16: Nodejs語言10.16版本。 Node.js12.13: Nodejs語言12.13版本。 Node.js14.18: Nodejs語言14.18版本。 C#(.NET Core 2.0): C#語言2.0版本。 C#(.NET Core 2.1): C#語言2.1版本。 C#(.NET Core 3.1): C#語言3.1版本。 Custom: 自定義運(yùn)行時。 PHP7.3: Php語言7.3版本。 http: HTTP函數(shù)。

枚舉值:

  • Java8

  • Java11

  • Node.js6.10

  • Node.js8.10

  • Node.js10.16

  • Node.js12.13

  • Node.js14.18

  • Python2.7

  • Python3.6

  • Go1.8

  • Go1.x

  • C#(.NET Core 2.0)

  • C#(.NET Core 2.1)

  • C#(.NET Core 3.1)

  • Custom

  • PHP7.3

  • Python3.9

  • http

etag

String

依賴包唯一標(biāo)志。

size

Long

依賴包大小。

name

String

依賴包名。

description

String

依賴包描述。

file_name

String

依賴包文件名。

狀態(tài)碼: 400

表5 響應(yīng)Body參數(shù)

參數(shù)

參數(shù)類型

描述

error_code

String

錯誤碼

error_msg

String

錯誤信息

狀態(tài)碼: 401

表6 響應(yīng)Body參數(shù)

參數(shù)

參數(shù)類型

描述

error_code

String

錯誤碼

error_msg

String

錯誤信息

狀態(tài)碼: 403

表7 響應(yīng)Body參數(shù)

參數(shù)

參數(shù)類型

描述

error_code

String

錯誤碼

error_msg

String

錯誤信息

狀態(tài)碼: 404

表8 響應(yīng)Body參數(shù)

參數(shù)

參數(shù)類型

描述

error_code

String

錯誤碼

error_msg

String

錯誤信息

狀態(tài)碼: 500

表9 響應(yīng)Body參數(shù)

參數(shù)

參數(shù)類型

描述

error_code

String

錯誤碼

error_msg

String

錯誤信息

狀態(tài)碼: 503

表10 響應(yīng)Body參數(shù)

參數(shù)

參數(shù)類型

描述

error_code

String

錯誤碼

error_msg

String

錯誤信息

請求示例

  • 創(chuàng)建依賴包使用zip方式。

    POST https://{Endpoint}/v2/{project_id}/fgs/dependencies
    
    {
      "depend_file" : "xxx",
      "depend_type" : "zip",
      "runtime" : "Node.js8.10",
      "name" : "xxx"
    }
  • 創(chuàng)建依賴包使用obs方式。

    POST https://{Endpoint}/v2/{project_id}/fgs/dependencies
    
    {
      "depend_link" : "https://{bucket}.{obs_endpoint}/depends/****/4f4ae4eb-dcdc-4dd3-bffd-79600bd972b3.zip",
      "depend_type" : "obs",
      "runtime" : "Node.js8.10",
      "name" : "xxx"
    }

響應(yīng)示例

狀態(tài)碼: 200

ok

{
  "id" : "4f4ae4eb-dcdc-4dd3-bffd-79600bd972b3",
  "owner" : "*****",
  "link" : "https://{bucket}.{obs_endpoint}/depends/****/4f4ae4eb-dcdc-4dd3-bffd-79600bd972b3.zip",
  "runtime" : "Python3.6",
  "etag" : "83863be4b6c3a86aef995dbc83aae68f",
  "size" : 577118,
  "name" : "python-kafka",
  "description" : "python支持kafka操作的庫",
  "file_name" : "python-kafka.zip"
}

狀態(tài)碼

狀態(tài)碼

描述

200

ok

400

Bad Request 請求錯誤。

401

Unauthorized 鑒權(quán)失敗。

403

Forbidden 沒有操作權(quán)限。

404

Not Found 找不到資源。

500

Internal Server Error 服務(wù)內(nèi)部錯誤。

503

Service Unavailable 服務(wù)不可用

錯誤碼

請參見錯誤碼。