保存镜像
将运行中实例的当前环境保存为自定义镜像,供后续开通或开机时使用。要求实例处于运行中(RUNNING)状态且无进行中的保存任务。
保存异步完成,保存期间实例处于镜像保存中,期间不能关机、释放或再次保存,可通过查询实例列表的镜像保存状态字段确认是否完成。
POST
https://api.alayanew.com/api/osm/v1/cci/instance/{id}/save-image鉴权(Authorizations)
bearerAuthAuthorizationString必填用户获取Authorization请求头后,通过该请求头完成身份认证。例如:Authorization: [your-auth-header]。
Path Parameters
idString必填实例 ID(来自查询实例列表的 id)。例如:2006a5d0-0a55-4e8f-9d3c-b7a1f20c5d88。
Request body
application/jsonimageNameString必填镜像名称,由小写字母、数字及 .、_、-、/ 组成,长度 1~256。例如:"my-training-env"。
tagString镜像标签,由字母、数字及 .、_、- 组成,长度 1~128,不传时为 latest。例如:"v1.0"。
Response
application/json · 200statusInteger业务状态码,200 表示保存请求已受理;失败时为错误码。
messageString响应信息,成功为 "OK";失败时为错误描述。
curl -X 'POST' \
'https://api.alayanew.com/api/osm/v1/cci/instance/2006a5d0-0a55-4e8f-9d3c-b7a1f20c5d88/save-image' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: [your-auth-header]' \
-d '{
"imageName": "my-training-env",
"tag": "v1.0"
}'import requests
instance_id = "2006a5d0-0a55-4e8f-9d3c-b7a1f20c5d88"
url = f"https://api.alayanew.com/api/osm/v1/cci/instance/{instance_id}/save-image"
headers = {
"accept": "application/json",
"Content-Type": "application/json",
"Authorization": "[your-auth-header]"
}
payload = {
"imageName": "my-training-env",
"tag": "v1.0"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())const instanceId = '2006a5d0-0a55-4e8f-9d3c-b7a1f20c5d88';
const payload = {
imageName: 'my-training-env',
tag: 'v1.0'
};
fetch(`https://api.alayanew.com/api/osm/v1/cci/instance/${instanceId}/save-image`, {
method: 'POST',
headers: {
'accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': '[your-auth-header]'
},
body: JSON.stringify(payload)
})
.then(res => res.json())
.then(console.log)
.catch(console.error);{
"status": 200,
"message": "OK"
}最后更新于
