更新LDAP服务器

PUT/zstack/v1/ldap/servers/{ldapServerUuid}

Headers

Authorization: OAuth the-session-uuid

Body

{
  "updateLdapServer": {
    "name": "new name"
  },
  "systemTags": [],
  "userTags": []
}

上述示例中systemTagsuserTags字段可以省略。列出是为了表示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(包含在updateLdapServer结构中)

资源名称

 

4.3.0

description (可选)

String

body(包含在updateLdapServer结构中)

资源的详细描述

 

4.3.0

url (可选)

String

body(包含在updateLdapServer结构中)

LDAP服务器的访问地址

 

4.3.0

base (可选)

String

body(包含在updateLdapServer结构中)

LDAP服务器的查询BaseDN

 

4.3.0

username (可选)

String

body(包含在updateLdapServer结构中)

访问LDAP服务器的用户名

 

4.3.0

password (可选)

String

body(包含在updateLdapServer结构中)

密码

 

4.3.0

encryption (可选)

String

body(包含在updateLdapServer结构中)

加密方式

  • None
  • TLS

4.3.0

systemTags (可选)

List

body

系统标签

 

4.3.0

userTags (可选)

List

body

用户标签

 

4.3.0

serverType (可选)

String

body(包含在updateLdapServer结构中)

LDAP服务器类型

  • OpenLdap
  • WindowsAD
  • Unknown

4.3.0

usernameProperty (可选)

String

body(包含在updateLdapServer结构中)

用户登录该虚拟化平台时使用哪个字段用作用户名

 

4.3.0

filter (可选)

String

body(包含在updateLdapServer结构中)

从LDAP服务器同步时,使用的过滤器,确定哪些用户是需要同步的

 

4.3.0

syncCreatedAccountStrategy (可选)

String

body(包含在updateLdapServer结构中)

在从LDAP服务器同步时,对于LDAP服务器中新创建的用户,该虚拟化平台的处理策略,是创建对应的account还是无动作

  • NoAction
  • CreateDisabledAccount
  • CreateAccount

4.3.0

syncDeletedAccountStrategy (可选)

String

body(包含在updateLdapServer结构中)

在从LDAP服务器同步时,对于LDAP服务器中已删除的用户,该虚拟化平台的处理策略,是删除对应的account、标记已删除还是无动作

  • NoAction
  • StaleAccount
  • DeleteAccount

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"
  }
}
名字类型描述起始版本
successboolean 4.3.0
errorErrorCode错误码,若不为null,则表示操作失败, 操作成功时该字段为null。 详情参考error4.3.0
inventoryLdapServerInventory详情参考inventory4.3.0

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.3.0
nameString资源名称4.3.0
typeString用户源类型,一般是ldap4.3.0
descriptionString资源的详细描述4.3.0
urlString 4.3.0
baseStringLDAP服务器访问地址4.3.0
usernameString用于访问LDAP服务器的用户名4.3.0
passwordString密码4.3.0
encryptionString加密方式4.3.0
serverTypeString服务器类型,可能是OpenLdap或WindowsAD,如果不确定会返回Unknown4.3.0
createDateTimestamp创建时间4.3.0
lastOpDateTimestamp最后一次修改时间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()