文档

获取集群实例信息

更新时间:

接口

get_cluster_instance

参数

属性 类型 是否必须 描述
cluster_id string 集群标识符。
group_name string 实例组名称。
instance_id string 实例名称。可以通过获取集群实例列表获取实例名称。

返回值

get_cluster_instance方法将返回一个GetResponse 对象。

例子

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_cluster_instance():
  9. try:
  10. cluster_id = 'cls-xxx'
  11. group_name = 'group1'
  12. instance_id = 'ins-yyy'
  13. rsp = client.get_cluster_instance(cluster_id, group_name, instance_id)
  14. print rsp
  15. except ClientError, e:
  16. print (e.get_status_code(), e.get_code(), e.get_requestid(), e.get_msg())
  17. if __name__ == '__main__':
  18. get_cluster_instance()

执行结果:

  1. {
  2. "HostName": "iZwz99s9avvluy6sz1zyz9Z",
  3. "Hint": "",
  4. "ErrorMessage": "",
  5. "CreationTime": "2018-05-20 16:18:29",
  6. "ErrorCode": 0,
  7. "State": "Running",
  8. "IpAddress": "10.169.88.18",
  9. "Id": "ins-6kial5tfblm09er5bt2000"
  10. }