描述
获取集群实例列表(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类型的列表 |
示例
try:
# Get a Client object.
client = Client(...
...
cluster_id = "cls-xxxx"
group_name = "group1"
marker = ""
max_item = 100
round = 0
while marker or round != 0:
response = client.list_cluster_instances(cluster_id, group_name, marker, max_item)
marker = response.NextMarker
for cluster_instance in response.Items:
print (cluster_instance.Id, cluster_instance.IpAddress)
round += 1
except ClientError, e:
print(e)