更新LDAP服务器
Headers
Authorization: OAuth the-session-uuidBody
{
"updateLdapServer": {
"name": "new name"
},
"systemTags": [],
"userTags": []
}上述示例中systemTags、userTags字段可以省略。列出是为了表示body中可以包含这两个字段。
Curl示例
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"updateLdapServer":{"name":"new name"}}' \
http://localhost:8080/zstack/v1/ldap/servers/ddd2491867273e6d8fb7c891faf0413f参数列表
名字 | 类型 | 位置 | 描述 | 可选值 | 起始版本 |
|---|---|---|---|---|---|
ldapServerUuid | String | url | LDAP服务器的UUID |
| 4.3.0 |
name (可选) | String | body(包含在 | 资源名称 |
| 4.3.0 |
description (可选) | String | body(包含在 | 资源的详细描述 |
| 4.3.0 |
url (可选) | String | body(包含在 | LDAP服务器的访问地址 |
| 4.3.0 |
base (可选) | String | body(包含在 | LDAP服务器的查询BaseDN |
| 4.3.0 |
username (可选) | String | body(包含在 | 访问LDAP服务器的用户名 |
| 4.3.0 |
password (可选) | String | body(包含在 | 密码 |
| 4.3.0 |
encryption (可选) | String | body(包含在 | 加密方式 |
| 4.3.0 |
systemTags (可选) | List | body | 系统标签 |
| 4.3.0 |
userTags (可选) | List | body | 用户标签 |
| 4.3.0 |
serverType (可选) | String | body(包含在 | LDAP服务器类型 |
| 4.3.0 |
usernameProperty (可选) | String | body(包含在 | 用户登录该虚拟化平台时使用哪个字段用作用户名 |
| 4.3.0 |
filter (可选) | String | body(包含在 | 从LDAP服务器同步时,使用的过滤器,确定哪些用户是需要同步的 |
| 4.3.0 |
syncCreatedAccountStrategy (可选) | String | body(包含在 | 在从LDAP服务器同步时,对于LDAP服务器中新创建的用户,该虚拟化平台的处理策略,是创建对应的account还是无动作 |
| 4.3.0 |
syncDeletedAccountStrategy (可选) | String | body(包含在 | 在从LDAP服务器同步时,对于LDAP服务器中已删除的用户,该虚拟化平台的处理策略,是删除对应的account、标记已删除还是无动作 |
| 4.3.0 |
API返回
返回示例
{
"inventory": {
"uuid": "5c502802c9633f4398e9f286d8187f49",
"name": "new name",
"description": "miao desc",
"url": "ldap://localhost:1888",
"base": "dc=example,dc=com",
"username": "",
"password": "",
"encryption": "None"
}
}| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| success | boolean | 4.3.0 | |
| error | ErrorCode | 错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error | 4.3.0 |
| inventory | LdapServerInventory | 详情参考inventory | 4.3.0 |
error
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| code | String | 错误码号,错误的全局唯一标识,例如SYS.1000, HOST.1001 | 0.6 |
| description | String | 错误的概要描述 | 0.6 |
| details | String | 错误的详细信息 | 0.6 |
| elaboration | String | 保留字段,默认为null | 0.6 |
| opaque | LinkedHashMap | 保留字段,默认为null | 0.6 |
| cause | ErrorCode | 根错误,引发当前错误的源错误,若无原错误,该字段为null | 0.6 |
inventory
| 名字 | 类型 | 描述 | 起始版本 |
|---|---|---|---|
| uuid | String | 资源的UUID,唯一标示该资源 | 4.3.0 |
| name | String | 资源名称 | 4.3.0 |
| type | String | 用户源类型,一般是ldap | 4.3.0 |
| description | String | 资源的详细描述 | 4.3.0 |
| url | String | 4.3.0 | |
| base | String | LDAP服务器访问地址 | 4.3.0 |
| username | String | 用于访问LDAP服务器的用户名 | 4.3.0 |
| password | String | 密码 | 4.3.0 |
| encryption | String | 加密方式 | 4.3.0 |
| serverType | String | 服务器类型,可能是OpenLdap或WindowsAD,如果不确定会返回Unknown | 4.3.0 |
| createDate | Timestamp | 创建时间 | 4.3.0 |
| lastOpDate | Timestamp | 最后一次修改时间 | 4.3.0 |
SDK示例
Java SDK
UpdateLdapServerAction action = new UpdateLdapServerAction();
action.ldapServerUuid = "ddd2491867273e6d8fb7c891faf0413f";
action.name = "new name";
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
UpdateLdapServerAction.Result res = action.call();
Python SDK
UpdateLdapServerAction action = UpdateLdapServerAction()
action.ldapServerUuid = "ddd2491867273e6d8fb7c891faf0413f"
action.name = "new name"
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"
UpdateLdapServerAction.Result res = action.call()