保存实例镜像
将CCI容器计算实例保存为镜像,可用于后续创建新实例。
POST
https://api.alayanew.com/v1/cci/instance/{id}/save-image鉴权(Authorizations)
bearerAuthAuthorizationString必填用户可通过已获取的 Open API Key 做验证。例如:Bearer [YOUR_API_KEY]。
Path Parameters
idString必填实例ID,实例的唯一标识符,例如:08ba7a0e-af00-4072-a5e5-1298ed6c1aa0。
Request body
imageNameString镜像名称,例如:nginx。
tagString镜像tag,例如:1。
Response
application/json · 200statusInteger业务状态码,200表示成功。
messageString接口响应信息,成功或失败原因描述。
dataObject接口返回的数据对象,包含镜像ID等信息。
curl -X 'POST' \
'https://api.alayanew.com/v1/cci/instance/08ba7a0e-af00-4072-a5e5-1298ed6c1aa0/save-image' \
-H 'accept: application/json' \
-H 'Authorization: Bearer [YOUR_API_KEY]' \
-H 'Content-Type: application/json' \
-d '{
"imageName": "nginx",
"tag": "1"
}'import requests
url = "https://api.alayanew.com/v1/cci/instance/08ba7a0e-af00-4072-a5e5-1298ed6c1aa0/save-image"
headers = {
"accept": "application/json",
"Authorization": "Bearer [YOUR_API_KEY]",
"Content-Type": "application/json"
}
data = {
"imageName": "nginx",
"tag": "1"
}
response = requests.post(url, headers=headers, json=data)
print(response.text)fetch('https://api.alayanew.com/v1/cci/instance/08ba7a0e-af00-4072-a5e5-1298ed6c1aa0/save-image', {
method: 'POST',
headers: {
'accept': 'application/json',
'Authorization': 'Bearer [YOUR_API_KEY]',
'Content-Type': 'application/json'
},
body: JSON.stringify({
imageName: "nginx",
tag: "1"
})
})
.then(response => response.text())
.then(data => console.log(data))
.catch(error => console.error(error));{
"status": 200,
"message": "OK",
"data": {
"image_id": "img-12345678"
}
}{
"status": 403,
"message": "Forbidden",
"data": {}
}{
"status": 500,
"message": "Internal Server Error",
"data": {}
}Last updated on
