Skip to main content

Update Template

Update the configuration of a specific template

PUT
/api/v1/agentstudio/sandbox/templates/{templateCode}
cURL
curl --request PUT \
  --url 'https://{workspace_id}.{region}.maas.aliyuncs.com/api/v1/agentstudio/sandbox/templates/{templateCode}' \
  --header 'Authorization: Bearer <YOUR_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "cpuCount": 0,
  "memoryMB": 0,
  "fromImage": "<string>",
  "imageName": "<string>",
  "mntConfig": [
    {
      "originFileName": "<string>",
      "originFileId": "<string>",
      "mountPath": "<string>"
    }
  ],
  "networkConfig": {
    "allowOut": [
      "<string>"
    ],
    "denyOut": [
      "<string>"
    ]
  },
  "envConfig": {},
  "autoPauseTime": 0,
  "maxRunningTimeout": 0,
  "description": "<string>"
}
'
{
  "templateID": "<string>",
  "templateName": "<string>",
  "cpuCount": 0,
  "memoryMB": 0,
  "buildID": "<string>",
  "buildStatus": "<string>",
  "version": 0,
  "createdAt": "<string>",
  "updatedAt": "<string>"
}
Files in mntConfig must be uploaded with source=sandbox_template. For details, see File upload.

Authorizations

string
header
required

Path Parameters

string
required

模版唯一 code(即创建接口返回的 templateID)

Body

application/json
string

模版名称,未传时保留原名称

integer

vCPU 数量,必须与 memoryMB 同时传;未传时保留原规格

integer

内存大小,单位 MB,必须与 cpuCount 同时传;未传时保留原规格

string

基础镜像,未传时保留原镜像

string

镜像展示名称,未传时保留原展示名称

object[]

文件挂载配置,传入时重新校验文件 ID。mountPath 必须以 /home/user/workspace/uploads/ 开头,路径不在该目录下时接口接受配置但实例中不会出现文件;originFileId 必须来自带 source=sandbox_template 且 status=available 的文件。上传方式见文件上传

object

网络规则,与创建模版一致

object

替换为本次传入的环境变量键值对

integer

到期自动暂停时间,单位秒,取值范围 [300,604800]

300 <= x <= 604800
integer

最大运行时间,单位秒,取值范围 [300,604800]

300 <= x <= 604800
string

模版描述

Response

200-application/json
string

模版 ID,更新前后保持不变

string

模版名称

integer

vCPU 数量

integer

内存大小,单位 MB

string

新版本构建 ID,用于查询构建状态

string

构建状态,可能为 building

integer

模版版本号,每次成功更新后递增

string

模版首次创建时间

string

本次更新时间