获取集群信息
更新时间:
接口
get_cluster
参数
| 参数 | 类型 | 是否必须 | 描述 |
|---|---|---|---|
| cluster | string | 是 | 集群标识符 |
返回值
get_cluster方法将返回一个GetResponse 对象。
例子
Python 源码:
e.g.
import timeimport batchcomputefrom batchcompute import CN_SHENZHEN as REGIONfrom batchcompute import Client, ClientErrorACCESS_KEY_ID = 'Your Access Key Id'ACCESS_KEY_SECRET = 'Your Access Key Secret'client = Client(REGION, ACCESS_KEY_ID, ACCESS_KEY_SECRET)def get_cluster():try:cluster_id = "cls-xxx"rsp = client.get_cluster(cluster_id)print (rsp.Name, rsp.State)except ClientError, e:print (e.get_status_code(), e.get_code(), e.get_requestid(), e.get_msg())if __name__ == '__main__':get_cluster()
执行结果:
(u'test-cluster', u'Active')
该文章对您有帮助吗?