Updated on 2023-11-23 GMT+08:00

Creating an Application Template Version

Function

This API is used to create an application template version.

URI

POST /v2/{project_id}/edgemgr/apps/{app_id}/versions

Table 1 Path parameters

Parameter

Mandatory

Description

project_id

Yes

Project ID. For details about how to obtain a project ID, see Obtaining a Project ID.

app_id

Yes

Application template ID.

Request

Request parameters

Table 2 Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format).

The default value application/json is recommended.

X-Auth-Token

Yes

String

User token. The token 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.

Table 3 Parameters in the request body

Parameter

Mandatory

Type

Description

version

Yes

Table 4 object

Application template version.

Table 4 version

Parameter

Mandatory

Type

Description

version

Yes

String

Version description. The value contains a maximum of 64 characters starting with a letter or digit. Only lowercase letters, digits, hyphens (-), and periods (.) are allowed.

image_url

Yes

String

Container image URL. The URL contains a maximum of 2,083 characters and cannot be an empty string.

envs

No

Array of Table 10 objects

Environment variables.

volumes

No

Array of Table 11 objects

Volume configuration.

resources

No

Table 12 object

Container resource configuration.

configs

No

Table 14 object

Advanced configuration parameters.

liveness_probe

No

Table 15 object

Workload liveness probe.

readiness_probe

No

Table 15 object

Workload readiness probe.

arch

No

String

Architecture. Only x86_64, arm32, and arm64 are supported.

command

No

Array of strings

Startup commands.

args

No

Array of String

Parameters.

npu_type

No

String

NPU type. NUP type supports D310.

  • D310
  • If this parameter is left blank, D310 is used.

Example request

{
    "version": {
        "version": "v2",
        "image_url": "edge-demo-app:latest",
        "resources": {
            "limits": {
                "cpu": 0.1,
                "memory": 1024,
                "gpu": 3.9
            },
            "requests": {
                "cpu": 0.1,
                "memory": 1024,
                "gpu": 3.9
            }
        },
        "envs": [
            {
                "name": "key",
                "value": "name"
            }
        ],
        "volumes": [
            {
                "name": "test",
                "type": "hostPath",
                "source": "/tmp",
                "destination": "/tmp0",
                "read_only": true
            }
        ],
        "configs": {
            "privileged": true,
            "host_network": true,
            "restart_policy": "Always"
        }
    }
}

Response

Response parameters

Table 5 Parameters in the response body

Parameter

Type

Description

version

Table 17 object

Application version details.

Example response

{
    "version": {
        "envs": [
            {
                "name": "key",
                "value": "name"
            }
        ],
        "created_at": "2018-07-16T14:16:28",
        "updated_at": null,
        "version": "v2",
        "image_url": "edge-demo-app:latest",
        "npu_type": "",
        "volumes": [
            {
                "read_only": true,
                "source": "/tmp",
                "destination": "/tmp0",
                "type": "hostPath",
                "name": "test"
            }
        ],
        "configs": {
            "host_network": true,
            "restart_policy": "Always",
            "privileged": true
        },
        "project_id": "{project_id}",
        "id": "9537b861-f4e0-40e5-8b79-da842e0d3ea2",
        "resources": {
            "requests": {
                "gpu": 3.9,
                "cpu": 0.1,
                "memory": 1024
            },
            "limits": {
                "gpu": 3.9,
                "cpu": 0.1,
                "memory": 1024
            }
        }
    }
}

Error Codes

For details, see Error Codes.