文档

获取镜像信息

get_image

参数

参数 类型 是否必须 描述
image CreateResponse 集群标识符

返回值

get_image方法将返回一个GetResponse 对象, 封装了Image类型的所有接口。

例子

Python源码:

  1. import time
  2. import batchcompute
  3. from batchcompute import CN_SHENZHEN as REGION
  4. from batchcompute import Client, ClientError
  5. ACCESS_KEY_ID = 'Your Access Key Id'
  6. ACCESS_KEY_SECRET = 'Your Access Key Secret'
  7. client = Client(REGION, ACCESS_KEY_ID, ACCESS_KEY_SECRET)
  8. def get_image():
  9. try:
  10. image_id = "img-centos"
  11. rsp = client.get_image(image_id)
  12. print rsp
  13. except ClientError, e:
  14. print (e.get_status_code(), e.get_code(), e.get_requestid(), e.get_msg())
  15. if __name__ == '__main__':
  16. get_image()

执行结果:

  1. {
  2. "Name": "Centos-6.8-x64",
  3. "CreationTime": "2017-10-26 16:19:59.595663",
  4. "Platform": "Linux",
  5. "EcsImageId": "m-wz9fq26zde3vfjac7eo9",
  6. "OwnerId": 0,
  7. "Type": "System",
  8. "Id": "img-centos",
  9. "Description": "centos 6.8 64bit for vpc"
  10. }
  • 本页导读 (0)
文档反馈