All Products
Search
Document Center

create_image

Last Updated: May 14, 2018

Parameter description

All classes of parameters are converted to dictionary objects containing the attribute information.

Parameter Type Description
image_desc ImageDescription object, str, dict Image description

Response description

  • The create_image method returns a CreateResponse object. The following lists the attributes of the CreateResponse object.
  • You can use response.Id to obtain the ID of the new cluster.
Attribute Type Description
Id str ID of the new image

Example

  1. try:
  2. # Init a Client object.
  3. client = ...
  4. # Refer to ClusterDescription.
  5. image_desc = ImageDescription(...)
  6. image = client.create_image(image_desc)
  7. # Print out the cluster id.
  8. print (image.Id)
  9. except ClientError, e:
  10. print (e)

ImageDescription class

Parameter description

Parameter Type Description
properties dict, str, ImageDescription object Object that contains the image description

Attribute description

For information about Groups, see the description of the GroupDescription class.

Attribute Type Description
Name str Image name
Description str Brief description of the image
EcsImageId str ECS image ID to be bound
Platform str Platform type of the image to be used. Optional values include Linux and Windows
IdempotentToken str Idempotent token. The length cannot exceed 64 characters. It is not required

For example:

  1. try:
  2. # Init a Client object.
  3. client = ...
  4. image_desc = ImageDescription()
  5. image_desc.Name = "PythonSDKImage"
  6. image_desc.Description = "PythonSDKImage"
  7. image_desc.EcsImageId = "m-xxxx"
  8. image_desc.Platform = "Linux" # or Windows
  9. print(client.create_image(image_desc).Id)
  10. except ClientError, e:
  11. print (e)