ListClusters
描述
擷取叢集列表。在叢集數很大情況下,需要分批調用 API 才能查詢出所有的叢集列表,所以需要使用者跟 BatchCompute 之間傳入一個上下文marker。如果首次調用查詢 API 傳入的 marker 為空白值,否則傳入上一次調用 API 時返回的 marker 值。如果調用 API 返回的 Marker 的值為空白,則表示沒有更多的叢集,無須再調用 API 查詢。
請求文法
請求行:
GET /clusters?Marker={Marker}&MaxItemCount={MaxItemCount} HTTP/1.1要求方法為 GET,請求資源為 clusters,請求參數:
屬性名稱 | 類型 | 是否必須 | 描述 |
|---|---|---|---|
Marker | string | 否 | 本頁起始資源標識符。預設為空白字串。 |
MaxItemCount | int | 否 | 一次返回最大資源數量。預設值50,最大值100。 |
返回資訊
成功
狀態行:
HTTP/1.1 201 OK響應資料:
說明
由於篇幅有限下面返回的 Items 僅列出一個值。
{
"NextMarker": "cls-6ki3npokblk1091cbko00f",
"Items":[{
"Name": "clusterName1",
"Id": "cls-6kir9pdp3lg6220g418002",
"OwnerId": 123,
"Description": "demo",
"CreationTime": "2016-10-31T06:55:33.921897Z",
"State": "Active",
"ImageId": "img-ubuntu",
"Notification": {
"Topic": {
"Name": "test-topic",
"Endpoint": "http://[UserId].mns.[Region].aliyuncs.com/",
"Events": [
"OnClusterDeleted",
"OnInstanceCreated",
"OnInstanceActive"
]
}
},
"Configs": {
"Disks": {
"SystemDisk": {
"Type": "cloud",
"Size": 500
},
"DataDisk": {
"Type": "cloud",
"Size": 500,
"MountPoint": "/path/to/mount"
}
}
},
"Groups": {
"group1": {
"DesiredVMCount": 3,
"ActualVMCount": 2,
"InstanceType": "bcs.a2.large",
"ResourceType": "OnDemand"
}
},
"OperationLogs": ["[2016-10-31T06:55:33.921897Z][group]Creating instance group successfully","[2016-10-31T06:55:33.941897Z]Creating cluster successfully"],
"Metrics": {
"RunningCount": 1,
"StartingCount": 0,
"StoppingCount": 0,
"StoppedCount": 0
}
}]
}屬性說明:
屬性名稱 | 類型 | 是否必須 | 描述 |
|---|---|---|---|
NextMarker | string | 是 | 下一頁起始資源標識符。最後一頁該值為空白。 |
Items | array of Item | 是 | 叢集列表。Item 對象屬性參閱 API 擷取叢集執行個體資訊。 |
錯誤
狀態代碼 | 錯誤碼 | 錯誤資訊 | 語義 |
|---|---|---|---|
400 | InvalidMaxItemCount | Specified parameter MaxItemCount is not valid. Its type must be integer. | MaxItemCount必須是一個integer。 |
400 | InvalidMaxItemCount | Specified parameter MaxItemCount is not valid. It must be in [0, 100]. | MaxItemCount的大小必須在0與100之間。 |