全部产品
Search
文档中心

:获取镜像信息

更新时间:Feb 24, 2023

get_image

参数

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

返回值

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

例子

Python源码:

import time
import batchcompute
from batchcompute import CN_SHENZHEN as REGION
from batchcompute import Client, ClientError

ACCESS_KEY_ID = 'Your Access Key Id'
ACCESS_KEY_SECRET = 'Your Access Key Secret'

client = Client(REGION, ACCESS_KEY_ID, ACCESS_KEY_SECRET)

def get_image():
    try:
        image_id = "img-centos"
        rsp = client.get_image(image_id)
        print rsp
    except ClientError, e:
        print (e.get_status_code(), e.get_code(), e.get_requestid(), e.get_msg())

if __name__ == '__main__':
    get_image()

执行结果:

{
    "Name": "Centos-6.8-x64",
    "CreationTime": "2017-10-26 16:19:59.595663",
    "Platform": "Linux",
    "EcsImageId": "m-wz9fq26zde3vfjac7eo9",
    "OwnerId": 0,
    "Type": "System",
    "Id": "img-centos",
    "Description": "centos 6.8 64bit for vpc"
}