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
try:
# Init a Client object.
client = ...
# Refer to ClusterDescription.
image_desc = ImageDescription(...)
image = client.create_image(image_desc)
# Print out the cluster id.
print (image.Id)
except ClientError, e:
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:
try:
# Init a Client object.
client = ...
image_desc = ImageDescription()
image_desc.Name = "PythonSDKImage"
image_desc.Description = "PythonSDKImage"
image_desc.EcsImageId = "m-xxxx"
image_desc.Platform = "Linux" # or Windows
print(client.create_image(image_desc).Id)
except ClientError, e:
print (e)