2.3. IdM API 命令输出结构
每个 IdM API 命令的输出都有四个部分。这些部分包含有关命令执行的各种信息。
IdM API 输出结构
result- 这部分提供命令的结果。它包含有关命令操作的各种详细信息,如传递给命令的选项和参数。
values- 这部分表示命令的参数。
messages-
这部分显示在执行命令后
ipa工具提供的各种信息。 summary- 这部分显示操作的总结。
在本例中,您的脚本执行 add_user 命令:
api.Command.user_add("test", givenname="a", sn="b")
api.Command.user_add("test", givenname="a", sn="b")
该命令的输出结构如下:
{
"result": {
"displayname": ["a b"],
"objectclass": [
"top",
"person",
"organizationalperson",
"inetorgperson",
"inetuser",
"posixaccount",
"krbprincipalaux",
"krbticketpolicyaux",
"ipaobject",
"ipasshuser",
"ipaSshGroupOfPubKeys",
"mepOriginEntry",
"ipantuserattrs",
],
"cn": ["a b"],
"gidnumber": ["1445000004"],
"mail": ["test@ipa.test"],
"krbprincipalname": [ipapython.kerberos.Principal("test@IPA.TEST")],
"loginshell": ["/bin/sh"],
"initials": ["ab"],
"uid": ["test"],
"uidnumber": ["1445000004"],
"sn": ["b"],
"krbcanonicalname": [ipapython.kerberos.Principal("test@IPA.TEST")],
"homedirectory": ["/home/test"],
"givenname": ["a"],
"gecos": ["a b"],
"ipauniqueid": ["9f9c1df8-5073-11ed-9a56-fa163ea98bb3"],
"mepmanagedentry": [
ipapython.dn.DN("cn=test,cn=groups,cn=accounts,dc=ipa,dc=test")
],
"has_password": False,
"has_keytab": False,
"memberof_group": ["ipausers"],
"dn": ipapython.dn.DN("uid=test,cn=users,cn=accounts,dc=ipa,dc=test"),
},
"value": "test",
"messages": [
{
"type": "warning",
"name": "VersionMissing",
"message": "API Version number was not sent, forward compatibility not guaranteed. Assuming server's API version, 2.248",
"code": 13001,
"data": {"server_version": "2.248"},
}
],
"summary": 'Added user "test"',
}
{
"result": {
"displayname": ["a b"],
"objectclass": [
"top",
"person",
"organizationalperson",
"inetorgperson",
"inetuser",
"posixaccount",
"krbprincipalaux",
"krbticketpolicyaux",
"ipaobject",
"ipasshuser",
"ipaSshGroupOfPubKeys",
"mepOriginEntry",
"ipantuserattrs",
],
"cn": ["a b"],
"gidnumber": ["1445000004"],
"mail": ["test@ipa.test"],
"krbprincipalname": [ipapython.kerberos.Principal("test@IPA.TEST")],
"loginshell": ["/bin/sh"],
"initials": ["ab"],
"uid": ["test"],
"uidnumber": ["1445000004"],
"sn": ["b"],
"krbcanonicalname": [ipapython.kerberos.Principal("test@IPA.TEST")],
"homedirectory": ["/home/test"],
"givenname": ["a"],
"gecos": ["a b"],
"ipauniqueid": ["9f9c1df8-5073-11ed-9a56-fa163ea98bb3"],
"mepmanagedentry": [
ipapython.dn.DN("cn=test,cn=groups,cn=accounts,dc=ipa,dc=test")
],
"has_password": False,
"has_keytab": False,
"memberof_group": ["ipausers"],
"dn": ipapython.dn.DN("uid=test,cn=users,cn=accounts,dc=ipa,dc=test"),
},
"value": "test",
"messages": [
{
"type": "warning",
"name": "VersionMissing",
"message": "API Version number was not sent, forward compatibility not guaranteed. Assuming server's API version, 2.248",
"code": 13001,
"data": {"server_version": "2.248"},
}
],
"summary": 'Added user "test"',
}