创建KMS密钥提供程序
Headers
Authorization: OAuth the-session-uuidBody
{
"params": {
"endpoint": "kms.example.com",
"port": 5696,
"kmipVersion": "1.2",
"username": "user",
"password": "password",
"name": "kp-kms",
"description": "example"
},
"systemTags": [],
"userTags": []
}上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X POST -d '{"params":{"endpoint":"kms.example.com","port":5696,"kmipVersion":"1.2","username":"user","password":"password","name":"kp-kms","description":"example"}}' \
http://localhost:8080/zstack/v1/key-providers/kms参数列表
名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
endpoint | String | body(包含在 | KMS地址 |
| 5.0.0 |
port | Integer | body(包含在 | 端口 |
| 5.0.0 |
kmipVersion (可选) | String | body(包含在 | KMIP协议版本 |
| 5.0.0 |
username (可选) | String | body(包含在 | 用户名 |
| 5.0.0 |
password (可选) | String | body(包含在 | 密码 |
| 5.0.0 |
name | String | body(包含在 | 资源名称 |
| 5.0.0 |
description (可选) | String | body(包含在 | 资源的详细描述 |
| 5.0.0 |
type (可选) | String | body(包含在 | 密钥提供程序类型 |
| 5.0.0 |
resourceUuid (可选) | String | body(包含在 | 资源UUID |
| 5.0.0 |
tagUuids (可选) | List | body(包含在 | 标签UUID列表 |
| 5.0.0 |
systemTags (可选) | List | body | 系统标签 |
| 5.0.0 |
userTags (可选) | List | body | 用户标签 |
| 5.0.0 |
SDK示例
Java SDK
CreateKmsAction action = new CreateKmsAction();
action.endpoint = "kms.example.com";
action.port = 5696;
action.kmipVersion = "1.2";
action.username = "user";
action.password = "password";
action.name = "kp-kms";
action.description = "example";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CreateKmsAction.Result res = action.call();Python SDK
action = CreateKmsAction()
action.endpoint = "kms.example.com"
action.port = 5696
action.kmipVersion = "1.2"
action.username = "user"
action.password = "password"
action.name = "kp-kms"
action.description = "example"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
res = action.call()