Creating an Application Version

Function

This API is used to create an application version.

URI

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

Table 1 Parameter description

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 ID.

Request

Table 2 Parameters in the request body

Parameter

Mandatory

Type

Description

version

Yes

Table 3 object

Application version information.

Table 3 version

Parameter

Mandatory

Type

Description

version

Yes

String

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

image_url

Yes

String

Container image URL. The value 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 strings

Parameters.

Request example:

{
    "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 4 Parameter description

Parameter

Type

Description

version

Table 17

Application version details.

Response example:

{
    "version": {
        "envs": [
            {
                "name": "key",
                "value": "name"
            }
        ],
        "created_at": "2018-07-16T14:16:28",
        "updated_at": null,
        "version": "v2",
        "image_url": "edge-demo-app:latest",
        
        "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.