查询IP访问控制规则

GET/zstack/v1/login-control/access-control/rules

Headers

Authorization: OAuth the-session-uuid

Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X GET http://localhost:8080/zstack/v1/login-control/access-control/rules?q=uuid=4f41ad1c52ac3ba690282ede3d1ebb2a

可查询字段

运行CLI命令行工具,输入QueryAccessControlRule并按Tab键查看所有可查询字段以及可跨表查询的资源名。

API返回

返回示例

{
  "inventories": [
    {
      "rule": "192.168.10.0/24"
    }
  ]
}
名字类型描述起始版本
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error3.5.1
inventoriesList详情参考inventories3.5.1

error

名字类型描述起始版本
codeString错误码号,错误的全局唯一标识,例如SYS.1000, HOST.10013.5.1
descriptionString错误的概要描述3.5.1
detailsString错误的详细信息3.5.1
elaborationString保留字段,默认为null3.5.1
opaqueLinkedHashMap保留字段,默认为null3.5.1
causeErrorCode根错误,引发当前错误的源错误,若无原错误,该字段为null3.5.1

inventories

名字类型描述起始版本
uuidString资源的UUID,唯一标示该资源3.5.1
nameString资源名称3.5.1
descriptionString资源的详细描述3.5.1
ruleString 3.5.1
createDateTimestamp创建时间3.5.1
lastOpDateTimestamp最后一次修改时间3.5.1
strategyControlStrategy详情参考strategy3.5.1

strategy

名字类型描述起始版本
ACCEPTControlStrategy 3.5.1
REJECTControlStrategy 3.5.1

SDK示例

Java SDK

QueryAccessControlRuleAction action = new QueryAccessControlRuleAction();
action.conditions = asList("uuid=b4cae0f6a9ac3cd686ba36c81291d197");
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
QueryAccessControlRuleAction.Result res = action.call();

Python SDK

QueryAccessControlRuleAction action = QueryAccessControlRuleAction()
action.conditions = ["uuid=4b3f7d2f1fda3f1d8089b4d037364bf9"]
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
QueryAccessControlRuleAction.Result res = action.call()