全部产品
Search
文档中心

批量计算:创建镜像

更新时间:Feb 16, 2023

CreateImage

描述

创建用于在BatchCompute服务中使用的镜像。

请求语法

请求行:

POST /images?IdempotentToken={IdempotentToken} HTTP/1.1

请求方法为 POST ,请求资源为 images ,属性说明如下:

属性名称

类型

是否必须

描述

IdempotentToken

string

用于保证请求的幂等性。由客户端生成该参数值,要保证在不同请求间唯一,最大不值过64个字符,字符包括了字母、数字以及下划线。

请求数据:

请求数据以 JSON 格式描述:

{
    "Name": "ImageName",
    "Description": "ImageDescription",
    "EcsImageId": "m-xxx",
    "Platform": "Linux",
}

属性说明:

属性名称

类型

是否必须

描述

Name

string

镜像名称。

Description

string

镜像描述。

EcsImageId

string

用户要使用的EcsImageId。

Platform

string

用户要使用的镜像的平台类型,可选值为Linux,Windows。

返回信息

成功

状态行:

HTTP/1.1 201 Created

响应数据:

{
    "Id":"img-23jhhsd"
}

属性说明:

属性名称

类型

是否必须

描述

Id

string

镜像标识符。

错误

状态码

错误码

错误信息

语义

400

IdempotentTokenMismatch

Specified idempotent token mismatch.

说明该token已经被使用过,并且该请求参数与之前的请求不一样

400

InvalidJsonFormat

The request body has an invalid json format.

请求body是一个非法的JSON格式

400

InvalidHttpBody

Specified parameter HttpBody is not valid. Its type must be object.

http body必须是一个object

400

MissingName

Name is mandatory for this action.

缺少Name参数

400

InvalidName

Specified parameter Name is not valid. Its type must be string.

Name必须是一个string

400

InvalidName

Specified parameter Name is not valid. Its length must be in [1, 64].

Name的长度必须在1与64之间

400

InvalidName

Specified parameter Name is not valid. It must only contain characters within [a-zA-Z0-9_-], and must not start with [0-9].

Name中只能包括字母数字和_-,但不能以数字开头

400

InvalidDescription

Specified parameter Description is not valid. Its type must be string.

Description必须是一个string

400

InvalidDescription

Specified parameter Description is not valid. Its length must be in [0, 1024].

Description的长度必须在0与1024之间

400

MissingEcsImageId

EcsImageId is mandatory for this action.

缺少EcsImageId参数

400

InvalidEcsImageId

Specified parameter EcsImageId is not valid. Its type must be string.

EcsImageId必须是一个string

400

InvalidEcsImageId

Specified parameter EcsImageId is not valid. Its length must be in [1, 256].

EcsImageId的长度必须在1与256之间

400

InvalidEcsImageId

Specified parameter EcsImageId is not valid. The specified EcsImageId does not exist or not you onwer.

EcsImageId必须是一个有效的ECS镜像Id

400

InvalidEcsImageId

Specified parameter EcsImageId is not valid. This EcsImageId has been registered.

这个EcsImageId已经被注册过

400

InvalidEcsImageId

Specified parameter EcsImageId is not valid. The image is not available.

Ecs镜像当前状态不正确

400

InvalidEcsImageId

Specified parameter EcsImageId is not valid. The share Image Quota exceeds or the shared image user quota exceeds.

已经超过自定义镜像共享配额限制或已经超过单个镜像共享给用户数量的配额限制

400

InvalidRoleArn

Specified parameter RoleArn is not valid. You haven’t created AliyunBatchComputeDefaultRole yet.

尚未创建AliyunBatchComputeDefaultRole角色给BatchCompute服务

400

InvalidRoleArn

Specified parameter RoleArn is not valid. AliyunBatchComputeDefaultRole don’t have access to share image.

AliyunBatchComputeDefaultRole角色没有共享镜像的权限

400

MissingPlatform

Platform is mandatory for this action.

缺少Platform参数

400

InvalidPlatform

Specified parameter Platform is not valid. Its type must be string.

Platform必须是一个string

400

InvalidPlatform

Specified parameter Platform is not valid. Its length must be in [1, 256].

Platform的长度必须在1与256之间

403

QuotaExhausted.MaxImageCount

The MaxImageCount ({value}) quota is exhausted.

Image数量不能超过{value}

400

Invalid{Parameter}

Specified parameter {Parameter} is not valid.

{Parameter}参数不合法