获取许可证信息

GET/zstack/v1/licenses

Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-X GET http://localhost:8080/zstack/v1/licenses

参数列表

名字类型位置描述可选值起始版本
additionSession (可选)Stringquery额外的信息,是一个json字符串 4.1.0
systemTags (可选)Listquery系统标签 0.6
userTags (可选)Listquery用户标签 0.6
  • ZSvirt获取许可证信息时支持获取虚拟化平台ID,SystemTags增加platformId选项。
    • 选项格式为:platformId::{%s}。其中{%s}为请求码md5值的前10位。
    • 例如:platformId::a95d3ee34r

API返回

返回示例

{
  "inventory": {
    "licenseType": "Free",
    "licenseRequest": "example request",
    "issuedDate": "2017-01-19 14:31:06",
    "user": "example",
    "hostNum": 10.0,
    "expired": true,
    "managementNodeUuid": "00898b3538e53e70bb7521e54ff80276"
  },
  "additions": []
}
名字类型描述起始版本
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error0.6
inventoryLicenseInventory详情参考inventory0.6

error

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

inventory

名字类型描述起始版本
uuidString资源的UUID,唯一标示该资源4.1.0
licenseTypeString 0.6
licenseRequestString 0.6
expiredDateString 0.6
issuedDateString 0.6
userString 0.6
prodInfoString许可证产品名称4.1.0
hostNumInteger 0.6
cpuNumInteger 0.6
vmNumInteger 4.1.0
availableHostNumInteger 0.6
availableCpuNumInteger 0.6
availableVmNumInteger 4.1.0
expiredboolean 0.6
managementNodeUuidString 4.1.0

SDK示例

Java SDK

GetLicenseInfoAction action = new GetLicenseInfoAction();
GetLicenseInfoAction.Result res = action.call();

Python SDK

GetLicenseInfoAction action = GetLicenseInfoAction()
GetLicenseInfoAction.Result res = action.call()