全部产品
Search
文档中心

:获取集群实例列表

更新时间:Apr 12, 2018

描述

获取集群实例列表(list_cluster_instances)。

参数说明

属性 类型 描述
cluster_id str 集群标识符
group_name str 实例组名称
next_marker str 下一页起始资源标识符, 最后一页该值为空。
max_item_count int 实际返回最大资源数量。默认值50,最大值100。

返回值说明

list_cluster_instances方法返回一个 ListResponse 对象,包含了ClusterInstance对象的集合。

请参阅ClusterInstance类的描述,了解ClusterInstance对象的属性。

属性 类型 描述
NextMarker str 下一页起始资源标识符, 最后一页该值为空。
Items list ClusterInstance类型的列表

示例

  1. try:
  2. # Get a Client object.
  3. client = Client(...
  4. ...
  5. cluster_id = "cls-xxxx"
  6. group_name = "group1"
  7. marker = ""
  8. max_item = 100
  9. round = 0
  10. while marker or round != 0:
  11. response = client.list_cluster_instances(cluster_id, group_name, marker, max_item)
  12. marker = response.NextMarker
  13. for cluster_instance in response.Items:
  14. print (cluster_instance.Id, cluster_instance.IpAddress)
  15. round += 1
  16. except ClientError, e:
  17. print(e)