功能介紹
使用標(biāo)簽過(guò)濾實(shí)例。
調(diào)試
您可以在API Explorer中調(diào)試該接口。
URI
POST /v2.0/{project_id}/subnets/resource_instances/action
請(qǐng)求參數(shù)
|
參數(shù)名稱(chēng) |
類(lèi)型 |
是否必選 |
說(shuō)明 |
|---|---|---|---|
|
tags |
否 |
包含標(biāo)簽,最多包含10個(gè)key,每個(gè)key下面的value最多10個(gè),結(jié)構(gòu)體不能缺失,key不能為空或者空字符串。Key不能重復(fù),同一個(gè)key中values不能重復(fù)。 |
|
|
limit |
Integer |
否 |
查詢(xún)記錄數(shù)(action為count時(shí)無(wú)此參數(shù))如果action為filter默認(rèn)為1000,limit最多為1000,不能為負(fù)數(shù),最小值為1 |
|
offset |
Integer |
否 |
(索引位置), 從offset指定的下一條數(shù)據(jù)開(kāi)始查詢(xún)。 查詢(xún)第一頁(yè)數(shù)據(jù)時(shí),不需要傳入此參數(shù),查詢(xún)后續(xù)頁(yè)碼數(shù)據(jù)時(shí),將查詢(xún)前一頁(yè)數(shù)據(jù)時(shí)響應(yīng)體中的值帶入此參數(shù)(action為count時(shí)無(wú)此參數(shù))如果action為filter默認(rèn)為0,必須為數(shù)字,不能為負(fù)數(shù) |
|
action |
String |
是 |
操作標(biāo)識(shí)(僅限于filter,count):filter(過(guò)濾),count(查詢(xún)總條數(shù)) 如果是filter就是分頁(yè)查詢(xún),如果是count只需按照條件將總條數(shù)返回即可。 |
|
matches |
否 |
搜索字段,key為要匹配的字段,當(dāng)前僅支持resource_name。value為匹配的值。此字段為固定字典值。 |
請(qǐng)求示例
- 過(guò)濾查詢(xún)子網(wǎng)資源實(shí)例,action為filter,從第1條數(shù)據(jù)開(kāi)始查詢(xún),單次查詢(xún)最多返回100條,用matches和tags過(guò)濾查詢(xún)。
POST https://{Endpoint}/v2.0/{project_id}/subnets/resource_instances/action { "offset": "0", "limit": "100", "action": "filter", "matches": [ { "key": "resource_name", "value": "resource1" } ], "tags": [ { "key": "key1", "values": [ "*value1", "value2" ] } ] }
- 過(guò)濾計(jì)數(shù)子網(wǎng)資源實(shí)例,action為count,用matches和tags過(guò)濾計(jì)數(shù)。
POST https://{Endpoint}/v2.0/{project_id}/subnets/resource_instances/action { "action": "count", "tags": [ { "key": "key1", "values": [ "value1", "value2" ] }, { "key": "key2", "values": [ "value1", "value2" ] } ], "matches": [ { "key": "resource_name", "value": "resource1" } ] }
響應(yīng)參數(shù)
|
名稱(chēng) |
參數(shù)類(lèi)型 |
說(shuō)明 |
|---|---|---|
|
resources |
||
|
total_count |
Integer |
總記錄數(shù) |
響應(yīng)示例
- action為filter
{ "resources": [ { "resource_detail": null, "resource_id": "cdfs_cefs_wesas_12_dsad", "resource_name": "resouece1", "tags": [ { "key": "key1", "value": "value1" }, { "key": "key2", "value": "value1" } ] } ], "total_count": 1000 }
- action為count
{ "total_count": 1000 }
狀態(tài)碼
請(qǐng)參見(jiàn)狀態(tài)碼。
錯(cuò)誤碼
請(qǐng)參考錯(cuò)誤碼。
