Creating a Dependency Version
Function
This API is used to create a dependency version.
URI
POST /v2/{project_id}/fgs/dependencies/version
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details, see Obtaining a Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
depend_file |
No |
String |
This parameter is mandatory when depend_type is set to zip. It is in the file stream format and must be a ZIP file encoded using Base64. |
depend_link |
No |
String |
URL of the dependency in the OBS console when depend_type is set to obs. |
depend_type |
Yes |
String |
Import mode. Options: obs and zip. |
runtime |
Yes |
String |
Environment in which a FunctionGraph function is executed. Options:
Enumeration values:
|
name |
Yes |
String |
Dependence name. It 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
Parameter |
Type |
Description |
---|---|---|
id |
String |
Dependency version. |
owner |
String |
Dependency owner. |
link |
String |
URL of the dependency in OBS. |
runtime |
String |
Environment in which a FunctionGraph function is executed. Options:
Enumeration values:
|
etag |
String |
Unique identifier of the dependency. |
size |
Long |
Dependency size. |
name |
String |
Dependency name. |
description |
String |
Dependency description. |
file_name |
String |
Dependency file name. |
version |
Long |
Dependency version. |
dep_id |
String |
Dependency ID. |
last_modified |
Long |
Time when the dependency was last updated. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error code. |
error_msg |
String |
Error message. |
Example Requests
-
Create a dependency version by directly uploading a ZIP file.
POST https://{Endpoint}/v2/{project_id}/fgs/dependencies/version { "depend_file" : "xxx", "depend_type" : "zip", "runtime" : "Node.js8.10", "name" : "xxx" }
-
Create a dependency by uploading a ZIP file from OBS.
POST https://{Endpoint}/v2/{project_id}/fgs/dependencies/version { "depend_link" : "https://{bucket}.{obs_endpoint}/depends/****/4f4ae4eb-dcdc-4dd3-bffd-79600bd972b3.zip", "depend_type" : "obs", "runtime" : "Node.js8.10", "name" : "xxx" }
Example Responses
Status code: 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 library for Kafka operations.", "file_name" : "python-kafka.zip", "version" : 0, "dep_id" : "edbd67fa-f107-40b3-af75-a85f0577ad61", "last_modified" : 1660029887 }
Status Codes
Status Code |
Description |
---|---|
200 |
ok |
401 |
Unauthorized. |
403 |
Forbidden. |
404 |
Not found. |
500 |
Internal server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot