Creating a Dependency

Function

This API is used to create a dependency.

URI

POST /v2/{project_id}/fgs/dependencies

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Tenant's project ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

depend_file

No

String

When depend_type is set to zip, this parameter is required and indicates the file stream format.

depend_link

No

String

When depend_type is set to obs, this parameter indicates the address of the dependency stored in OBS.

depend_type

Yes

String

Import mode. Options: obs and zip.

runtime

Yes

String

Runtime.

Enumeration values:

  • Java8

  • Node.js6.10

  • Node.js8.10

  • Node.js10.16

  • Node.js12.13

  • Python2.7

  • Python3.6

  • Go1.8

  • Go1.x

  • C#(.NET Core 2.0)

  • C#(.NET Core 2.1)

  • C#(.NET Core 3.1)

  • PHP 7.3

name

No

String

Name of the dependency. The name can contain a maximum of 96 characters and must start with a letter and end with a letter or digit. Only letters, digits, underscores (_), periods (.), and hyphens (-) are allowed.

description

No

String

Description of the dependency, which can contain a maximum of 512 characters.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

id

String

Dependency ID.

owner

String

Dependency owner.

link

String

URL of the dependency in the OBS console.

runtime

String

Runtime.

etag

String

Unique ID of the dependency.

size

Long

Size of the dependency.

name

String

Name of the dependency.

description

String

Description of the dependency.

file_name

String

File name of the dependency.

Example Requests

POST https://{functiongraph_endpoint}/v2/7aad83af3e8d42e99ac194e8419e2c9b/fgs/dependencies

Example Responses

Status code: 200

ok

{
  "id" : "4f4ae4eb-dcdc-4dd3-bffd-79600bd972b3",
  "owner" : "*****",
  "link" : "https://***.obs.cn-north-1.myhuaweicloud.com/depends/****/4f4ae4eb-dcdc-4dd3-bffd-79600bd972b3.zip",
  "runtime" : "Python3.6",
  "etag" : "83863be4b6c3a86aef995dbc83aae68f",
  "size" : 577118,
  "name" : "python-kafka",
  "description" : "kafka lib of python",
  "file_name" : "python-kafka.zip"
}

Status Codes

Status Code

Description

200

ok

Error Codes

See Error Codes.