Method description
Creates an image.
Parameter description
Parameter |
Type |
Required |
Description |
imageDescription |
ImageDescription |
Yes |
Description of the created image |
The package names of the following classes are all com.aliyuncs.batchcompute.pojo.v20151111.
Attributes of imageDescription (the getter and setter methods are available to all attributes)
Attribute |
Type |
Description |
name |
String |
Image name |
description |
String |
Brief description |
ecsImageId |
String |
ECS image ID |
platform |
String |
Operating system. Optional values include Image.LINUX and Image.WINDOWS |
Response description
- If the image is successfully created, a CreateImageResponse instance is returned. You can use response.getImageId() to obtain the name of the created image.
Type |
Description |
CreateImageResponse |
Obtains the ID of the created image |
- The CreateImageResponse package name is com.aliyuncs.batchcompute.model.v20151111. Other responses listed in the following are under this package.
- If creation fails, a ClientException is thrown.
Sample code
try{
CreateImageResponse response = client.createImage(imageDescription);
String imageId = response.getImageId();
//Creation succeeded
}catch(ClientException e){
e.printStackTrace();
//Creation failed
}