功能介紹
根據(jù)項目ID查詢指定資源類型的資源實例。
資源、資源tag默認(rèn)按照創(chuàng)建時間倒序。
調(diào)試
您可以在API Explorer中調(diào)試該接口。
URI
POST /autoscaling-api/v1/{project_id}/{resource_type}/resource_instances/action
參數(shù) |
是否必選 |
參數(shù)類型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
項目ID |
resource_type |
是 |
String |
資源類型,枚舉類:scaling_group_tag |
請求參數(shù)
參數(shù) |
是否必選 |
參數(shù)類型 |
描述 |
---|---|---|---|
key |
是 |
String |
資源標(biāo)簽鍵。最大長度127個unicode字符。key不能為空。(搜索時不對此參數(shù)做校驗)。最多為10個,不能為空或者空字符串。且不能重復(fù)。 |
values |
是 |
Array of strings |
資源標(biāo)簽值列表,每個值最大長度255個unicode字符,每個key下最多為10個,同一個key中values不能重復(fù)。
|
請求示例
- 查詢租戶下按包含標(biāo)簽key=key1,value=value,不包含key=key2,value=value2,索引位置100,查詢最大記錄數(shù)為100的伸縮組資源信息,action為filter。
POST https: //{Endpoint}/autoscaling-api/v1/{project_id}/scaling_group_tag/resource_instances/action { "offset": "100", "limit": "100", "action": "filter", "matches": [{ "key": "resource_name", "value": "resource1" }], "not_tags": [{ "key": "key2", "values": ["value2"] }], "tags": [{ "key": "key1", "values": ["value1"] }] }
- 查詢租戶下按包含標(biāo)簽key=key1,value=value,不包含key=key2,value=value2的伸縮組資源數(shù)目,action為count。
POST https: //{Endpoint}/autoscaling-api/v1/{project_id}/scaling_group_tag/resource_instances/action { "action": "count", "not_tags": [{ "key": "key2", "values": ["value2"] }], "tags": [{ "key": "key1", "values": ["value1"] }, { "key": "key2", "values": ["value1", "value2"] }], "matches": [{ "key": "resource_name", "value": "resource1" }] }
響應(yīng)參數(shù)
參數(shù) |
參數(shù)類型 |
描述 |
---|---|---|
resources |
||
total_count |
Integer |
總記錄數(shù),當(dāng)請求action為count時,僅返回該參數(shù),不返回resources和marker值。 |
marker |
String |
分頁位置標(biāo)識 |
響應(yīng)示例
- action為filter時響應(yīng)示例
{ "resources": [{ "resource_id": "64af4b6f-ec51-4436-8004-7a8f30080c87", "resource_detail": "SCALING_GROUP_TAG", "tags": [{ "key": "key1","value": "value1" }], "resource_name": "as_scaling_group_1" }, { "resource_id": "7122ef51-604b-40e7-b9b2-1de4cd78dc60", "resource_detail": "SCALING_GROUP_TAG", "tags": [{ "key": "key1","value": "value1" }], "resource_name": "as_scaling_group_2" }], "marker": "2", "total_count": 2 }
- action為count時響應(yīng)示例
{ "total_count": 1000 }
返回值
- 正常
- 異常
返回值
說明
400 Bad Request
服務(wù)器未能處理請求。
401 Unauthorized
被請求的頁面需要用戶名和密碼。
403 Forbidden
對被請求的頁面訪問禁止。
404 Not Found
服務(wù)器無法找到被請求的頁面。
405 Method Not Allowed
請求中指定的方法不被允許。
406 Not Acceptable
服務(wù)器生成的響應(yīng)無法被客戶端所接受。
407 Proxy Authentication Required
用戶必須首先使用代理服務(wù)器進(jìn)行驗證,這樣請求才會被處理。
408 Request Timeout
請求超出了服務(wù)器的等待時間。
409 Conflict
由于沖突,請求無法被完成。
500 Internal Server Error
請求未完成。服務(wù)異常。
501 Not Implemented
請求未完成。服務(wù)器不支持所請求的功能。
502 Bad Gateway
請求未完成。服務(wù)器從上游服務(wù)器收到一個無效的響應(yīng)。
503 Service Unavailable
請求未完成。系統(tǒng)暫時異常。
504 Gateway Timeout
網(wǎng)關(guān)超時。
錯誤碼
請參考錯誤碼。