组 APIGroups API
通过 Groups API,可以管理用户组。The Groups API allows you to manage groups of users.
备注
必须是 Azure Databricks 管理员才能调用此 API。You must be an Azure Databricks administrator to invoke this API.
重要
要访问 Databricks REST API,必须进行身份验证。To access Databricks REST APIs, you must authenticate.
添加成员 Add member
端点Endpoint | HTTP 方法HTTP Method |
---|---|
2.0/groups/add-member |
POST |
将用户或组添加到一个组。Add a user or group to a group. 如果具有给定名称的用户或组不存在,或者具有给定父名称的组不存在,则此调用将返回错误 RESOURCE_DOES_NOT_EXIST
。This call returns an error RESOURCE_DOES_NOT_EXIST
if a user or group with the given name does not exist, or if a group with the given parent name does not exist.
例如,请求:Example requests:
{
"user_name": "hermione@hogwarts.edu",
"parent_name": "Gryffindor"
}
{
"group_name": "Dumbledore's Army",
"parent_name": "Students"
}
请求结构 Request structure
字段名称Field Name | 类型Type | 描述Description |
---|---|---|
user_name 或 group_nameuser_name OR group_name | STRING 或 STRING STRING OR STRING |
如果 user_name,则用户名。If user_name, the user name. 如果 group_name,则组名。If group_name, the group name. |
parent_nameparent_name | STRING |
要向其添加新成员的父组的名称。Name of the parent group to which the new member will be added. 此字段为必需字段。This field is required. |
创建 Create
端点Endpoint | HTTP 方法HTTP Method |
---|---|
2.0/groups/create |
POST |
使用给定名称创建一个新组。Create a new group with the given name. 如果具有给定名称的组已经存在,则此调用返回错误 RESOURCE_ALREADY_EXISTS
。This call returns an error RESOURCE_ALREADY_EXISTS
if a group with the given name already exists.
示例请求:Example request:
{
"group_name": "Muggles"
}
示例响应:Example response:
{
"group_name": "Muggles"
}
请求结构 Request structure
字段名称Field Name | 类型Type | 描述Description |
---|---|---|
group_namegroup_name | STRING |
组的名称;在该组织拥有的组中必须是唯一的。Name for the group; must be unique among groups owned by this organization. 此字段为必需字段。This field is required. |
响应结构 Response structure
创建组。Creates a group.
字段名称Field Name | 类型Type | 描述Description |
---|---|---|
group_namegroup_name | STRING |
组名称。The group name. |
列出成员 List members
端点Endpoint | HTTP 方法HTTP Method |
---|---|
2.0/groups/list-members |
GET |
返回特定组的所有成员。Return all of the members of a particular group. 如果具有给定名称的组不存在,则此调用返回错误 RESOURCE_DOES_NOT_EXIST
。This call returns an error RESOURCE_DOES_NOT_EXIST
if a group with the given name does not exist.
示例请求:Example request:
{
"group_name": "Gryffindor"
}
示例响应:Example response:
{
"members": [
{ "user_name": "hjp@hogwarts.edu" },
{ "user_name": "hermione@hogwarts.edu" },
{ "user_name": "rweasley@hogwarts.edu" },
{ "group_name": "Gryffindor Faculty" }
]
}
请求结构 Request structure
字段名称Field Name | 类型Type | 描述Description |
---|---|---|
group_namegroup_name | STRING |
我们要检索其成员的组。The group whose members we want to retrieve. 此字段为必需字段。This field is required. |
响应结构 Response structure
检索属于给定组的所有用户和组。Retrieve all users and groups that belong to a given group. 此方法是非递归的;它返回属于给定组的所有组,但不返回属于那些子组的主体。This method is non-recursive; it return all groups that belong to the given group but not the principals that belong to those child groups.
字段名称Field Name | 类型Type | 描述Description |
---|---|---|
membersmembers | PrincipalName 的数组An array of PrincipalName | 属于给定组的用户和组。The users and groups that belong to the given group. |
列表 List
端点Endpoint | HTTP 方法HTTP Method |
---|---|
2.0/groups/list |
GET |
返回组织中的所有组。Return all of the groups in an organization.
示例响应:Example response:
{
"group_names": [
"admin",
"Gryffindor",
"Hufflepuff",
"Ravenclaw",
"Slytherin"
]
}
响应结构 Response structure
返回该组织中的所有组的列表。Return a list of all groups in this organization.
字段名称Field Name | 类型Type | 描述Description |
---|---|---|
group_namesgroup_names | 一个由 STRING 构成的数组An array of STRING |
该组织中的组。The groups in this organization. |
列出父级 List parents
端点Endpoint | HTTP 方法HTTP Method |
---|---|
2.0/groups/list-parents |
GET |
检索给定用户或组是成员的所有组。Retrieve all groups in which a given user or group is a member. 此方法是非递归的;它返回给定用户或组是成员的所有组,但不返回那些组是成员的组。This method is non-recursive; it returns all groups in which the given user or group is a member but not the groups in which those groups are members. 如果具有给定名称的用户或组不存在,则此调用返回错误 RESOURCE_DOES_NOT_EXIST
。This call returns an error RESOURCE_DOES_NOT_EXIST
if a user or group with the given name does not exist.
示例请求:Example request:
{
"user_name": "hermione@hogwarts.edu"
}
示例响应:Example response:
{
"group_names": [
"users",
"Wizards",
"Gryffindor",
"Dumbledore's Army"
]
}
示例请求:Example request:
{
"group_name": "Gryffindor Faculty"
}
示例响应:Example response:
{
"group_names": [
"Faculty",
"Gryffindor"
]
}
请求结构 Request structure
字段名称Field Name | 类型Type | 描述Description |
---|---|---|
user_name 或 group_nameuser_name OR group_name | STRING 或 STRING STRING OR STRING |
如果 user_name,则用户名。If user_name, the user name. 如果 group_name,则组名。If group_name, the group name. |
响应结构 Response structure
检索给定用户或组是成员的所有组。Retrieve all groups in which a given user or group is a member. 此方法是非递归的;它返回给定用户或组是成员的所有组,但不返回那些组是成员的组。This method is non-recursive; it returns all groups in which the given user or group is a member but not the groups in which those groups are members.
字段名称Field Name | 类型Type | 描述Description |
---|---|---|
group_namesgroup_names | 一个由 STRING 构成的数组An array of STRING |
给定用户或组是成员的组。The groups in which the given user or group is a member. |
删除成员 Remove member
端点Endpoint | HTTP 方法HTTP Method |
---|---|
2.0/groups/remove-member |
POST |
从组中删除用户或组。Remove a user or group from a group. 如果具有给定名称的用户或组不存在,或者具有给定父名称的组不存在,则此调用将返回错误 RESOURCE_DOES_NOT_EXIST
。This call returns an error RESOURCE_DOES_NOT_EXIST
if a user or group with the given name does not exist or if a group with the given parent name does not exist.
例如,请求:Example requests:
{
"user_name": "quirrell@hogwarts.edu",
"parent_name": "Faculty"
}
{
"group_name": "Inquisitorial Squad",
"parent_name": "Students"
}
请求结构 Request structure
字段名称Field Name | 类型Type | 描述Description |
---|---|---|
user_name 或 group_nameuser_name OR group_name | STRING 或 STRING STRING OR STRING |
如果 user_name,则用户名。If user_name, the user name. 如果 group_name,则组名。If group_name, the group name. |
parent_nameparent_name | STRING |
要从中删除成员的父组的名称。Name of the parent group from which the member will be removed. 此字段为必需字段。This field is required. |
删除 Delete
端点Endpoint | HTTP 方法HTTP Method |
---|---|
2.0/groups/delete |
POST |
从该组织中删除一个组。Remove a group from this organization. 如果具有给定名称的组不存在,则此调用返回错误 RESOURCE_DOES_NOT_EXIST
。This call returns an error RESOURCE_DOES_NOT_EXIST
if a group with the given name does not exist.
示例请求:Example request:
{
"group_name": "Inquisitorial Squad"
}
请求结构 Request structure
字段名称Field Name | 类型Type | 描述Description |
---|---|---|
group_namegroup_name | STRING |
要删除的组。The group to remove. 此字段为必需字段。This field is required. |
数据结构 Data structures
本节内容:In this section:
PrincipalName PrincipalName
用户名或组名的容器类型。Container type for a name that is either a user name or a group name.
字段名称Field Name | 类型Type | 描述Description |
---|---|---|
user_name 或 group_nameuser_name OR group_name | STRING 或 STRING STRING OR STRING |
如果 user_name,则用户名。If user_name, the user name. 如果 group_name,则组名。If group_name, the group name. |