integer/array hanode.get(object parameters)
Metoda pozwala na pobranie listy w?z?¨®w klastra o wysokiej dost?pno?ci zgodnie z podanymi parametrami.
Ta metoda jest dost?pna tylko dla u?ytkownika typu Super admin. Zobacz Role u?ytkownika po wi?cej informacji.
(object)
Parametry definiuj?ce ??dany wynik.
Metoda obs?uguje nast?puj?ce parametry.
Parametr | Typ | Opis |
---|---|---|
ha_nodeids | string/array | Zwraca tylko w?z?y z podanymi identyfikatorami w?z?¨®w. |
filter | object | Zwraca tylko te wyniki, kt¨®re dok?adnie pasuj? do podanego filtra. Akceptuje tablic?, w kt¨®rej klucze s? nazwami w?a?ciwo?ci, a warto?ci s? albo pojedyncz? warto?ci?, albo tablic? warto?ci do dopasowania. Umo?liwia filtrowanie wed?ug w?a?ciwo?ci w?z?a: name , address , status . |
sortfield | string/array | Sortuj wynik wed?ug podanych w?a?ciwo?ci. Mo?liwe warto?ci to: name , lastaccess , status . |
countOutput | flag | Te parametry wsp¨®lne dla wszystkich metod get zosta?y opisane w komentarzu referencyjnym. |
limit | integer | |
output | query | |
preservekeys | boolean | |
sortorder | string/array |
(integer/array)
Zwraca jedn? z opcji:
countOutput
zosta? wykorzystany.Zapytanie:
{
"jsonrpc": "2.0",
"method": "hanode.get",
"params": {
"preservekeys": true,
"sortfield": "status",
"sortorder": "DESC"
},
"auth": "3a57200802b24cda67c4e4010b50c065",
"id": 1
}
Odpowied?:
{
"jsonrpc": "2.0",
"result": {
"ckuo7i1nw000h0sajj3l3hh8u": {
"ha_nodeid": "ckuo7i1nw000h0sajj3l3hh8u",
"name": "node-active",
"address": "192.168.1.13",
"port": "10051",
"lastaccess": "1635335704",
"status": "3"
},
"ckuo7i1nw000e0sajwfttc1mp": {
"ha_nodeid": "ckuo7i1nw000e0sajwfttc1mp",
"name": "node6",
"address": "192.168.1.10",
"port": "10053",
"lastaccess": "1635332902",
"status": "2"
},
"ckuo7i1nv000c0sajz85xcrtt": {
"ha_nodeid": "ckuo7i1nv000c0sajz85xcrtt",
"name": "node4",
"address": "192.168.1.8",
"port": "10052",
"lastaccess": "1635334214",
"status": "1"
},
"ckuo7i1nv000a0saj1fcdkeu4": {
"ha_nodeid": "ckuo7i1nv000a0saj1fcdkeu4",
"name": "node2",
"address": "192.168.1.6",
"port": "10051",
"lastaccess": "1635335705",
"status": "0"
}
},
"id": 1
}
Zapytanie:
{
"jsonrpc": "2.0",
"method": "hanode.get",
"params": {
"ha_nodeids": ["ckuo7i1nw000e0sajwfttc1mp", "ckuo7i1nv000c0sajz85xcrtt"]
},
"auth": "3a57200802b24cda67c4e4010b50c065",
"id": 1
}
Odpowied?:
{
"jsonrpc": "2.0",
"result": [
{
"ha_nodeid": "ckuo7i1nv000c0sajz85xcrtt",
"name": "node4",
"address": "192.168.1.8",
"port": "10052",
"lastaccess": "1635334214",
"status": "1"
},
{
"ha_nodeid": "ckuo7i1nw000e0sajwfttc1mp",
"name": "node6",
"address": "192.168.1.10",
"port": "10053",
"lastaccess": "1635332902",
"status": "2"
}
],
"id": 1
}
Zapytanie:
{
"jsonrpc": "2.0",
"method": "hanode.get",
"params": {
"output": ["ha_nodeid", "address", "port"],
"filter": {
"status": 1
}
},
"auth": "3a57200802b24cda67c4e4010b50c065",
"id": 1
}
Odpowied?:
{
"jsonrpc": "2.0",
"result": [
{
"ha_nodeid": "ckuo7i1nw000g0sajjsjre7e3",
"address": "192.168.1.12",
"port": "10051"
},
{
"ha_nodeid": "ckuo7i1nv000c0sajz85xcrtt",
"address": "192.168.1.8",
"port": "10052"
},
{
"ha_nodeid": "ckuo7i1nv000d0sajd95y1b6x",
"address": "192.168.1.9",
"port": "10053"
}
],
"id": 1
}
Zapytanie:
{
"jsonrpc": "2.0",
"method": "hanode.get",
"params": {
"countOutput": true,
"filter": {
"status": 0
}
},
"auth": "3a57200802b24cda67c4e4010b50c065",
"id": 1
}
Odpowied?:
Zapytanie:
{
"jsonrpc": "2.0",
"method": "hanode.get",
"params": {
"output": ["name", "status"],
"filter": {
"address": ["192.168.1.7", "192.168.1.13"]
}
},
"auth": "3a57200802b24cda67c4e4010b50c065",
"id": 1
}
Odpowied?:
{
"jsonrpc": "2.0",
"result": [
{
"name": "node3",
"status": "0"
},
{
"name": "node-active",
"status": "3"
}
],
"id": 1
}
CHaNode::get() w ui/include/classes/api/services/CHaNode.php.