All Products
Search
Document Center

createImage

Last Updated: May 11, 2018

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

  1. try{
  2. CreateImageResponse response = client.createImage(imageDescription);
  3. String imageId = response.getImageId();
  4. //Creation succeeded
  5. }catch(ClientException e){
  6. e.printStackTrace();
  7. //Creation failed
  8. }