接口约束
5.6.6 管理员创建 IAM 用户(推荐)
"users": [ {
"pwd_status": true,
"domain_id": "d78cbac186b744899480f25bd...", "last_project_id": "065a7c66da0010992ff7c0031e...", "name": "IAMUserA",
"self": "https://iam.myhuaweicloud.com/v3/users/07609fb9358010e21f7bc00375..."
},
"domain_id": "d78cbac186b744899480f25bd022...", "last_project_id": "065a7c66da0010992ff7c0031e5a...", "name": "IAMUserB",
"self": "https://iam.myhuaweicloud.com/v3/users/076837351e80251c1f0fc003af..."
},
该接口可以使用全局区域的Endpoint和其他区域的Endpoint调用。IAM的Endpoint请 参见:地区和终端节点。
调试
您可以在API Explorer中调试该接口。
URI
POST /v3.0/OS-USER/users
请求参数
表5-232 请求 Header 参数
参数 是否必选 参数
类型
描述
Content-Type 是 String 该字段内容填为“application/
json;charset=utf8”。
X-Auth-Token 是 String 拥有Security Administrator权限的 token。
表5-233 请求 Body 参数
参数 是否
必选
参数类型 描述
user 是 Object IAM用户信息。
表5-234 user
参数 是否
必选
参数类型 描述
name 是 String IAM用户名,长度1~32之间,只能包含 如下字符:大小写字母、空格、数字或 特殊字符(-_.)且不能以数字开头。
domain_id 是 String IAM用户所属的帐号ID,获取方式请参 见:获取帐号、IAM用户、项目、用户 组、区域、委托的名称和ID。
password 否 String IAM用户密码。
email 否 String IAM用户邮箱,需符合邮箱格式,长度小 于等于255位。
areacode 否 String 国家码。必须与手机号同时存在。中国 大陆为“0086”。
参数 是否 必选
参数类型 描述
phone 否 String IAM用户手机号,纯数字,长度小于等于 32位。必须与国家码同时存在。
enabled 否 Boolean 是否启用IAM用户。true为启用,false为 停用,默认为true。
pwd_status 否 Boolean IAM用户首次登录是否重置密码,默认需 要重置。
xuser_type 否 String IAM用户在外部系统中的类型。长度小于 等于64位。xuser_type如果存在,则需
xuser_id 否 String IAM用户在外部系统中的ID。长度小于 等于128位,须与xuser_type同时存在。
access_mode 否 String IAM用户访问方式。
● default:默认访问模式,编程访问和 管理控制台访问。
● programmatic:编程访问。
● console:管理控制台访问。
description 否 String IAM用户描述信息。
响应参数
表5-235 响应 Body 参数
参数 参数类型 描述
user Object IAM用户信息。
表5-236 user
参数 参数类型 描述
status Integer IAM用户状态信息。
pwd_status Boolean IAM用户首次登录是否重置密码。
xuser_id String IAM用户在外部系统中的ID。
说明
外部系统指与华为云对接的外部企业管理系统,
xaccount_type、xaccount_id、xdomain_type、
xdomain_id、xuser_type、xuser_id等参数值,无法在 华为云获取,请咨询企业管理员。
xuser_type String 用户在外部系统中的类型。
说明
外部系统指与华为云对接的外部企业管理系统,
xaccount_type、xaccount_id、xdomain_type、
xdomain_id、xuser_type、xuser_id等参数值,无法在 华为云获取,请咨询企业管理员。
access_mode String IAM用户访问方式。
● default:默认访问模式,编程访问和管理控制 台访问。
● programmatic:编程访问。
● console:管理控制台访问。
description String IAM用户描述信息。
name String IAM用户名,长度5~32之间,首位不能为数字,
特殊字符只能包含下划线“_”、中划线“-”和 空格。
phone String IAM用户手机号,纯数字,长度小于等于32位。
必须与国家码同时存在。
is_domain_ow
ner Boolean IAM用户是否为帐号管理员。
domain_id String IAM用户所属帐号ID。
enabled Boolean 是否启用IAM用户。true为启用,false为停用,
默认为true。
areacode String 国家码。中国大陆为“0086”。
email String IAM用户邮箱。
create_time String IAM用户创建时间。
xdomain_id String 运营主体的客户编码。
xdomain_type String 运营主体。
id String IAM用户ID。
参数 参数类型 描述 password_exp
ires_at String 密码过期时间(UTC时间),“null”表示密码不 过期。
请求示例
POST https://iam.myhuaweicloud.com/v3.0/OS-USER/users { "user": {
"domain_id": "d78cbac186b744899480f25...", "name": "IAMUser",
"password": "IAMPassword@", "email": "[email protected]", "areacode": "0086", "description": "IAMDescription"
} "description": "IAMDescription", "name": "IAMUser",
"phone": "12345678910", "is_domain_owner": false, "enabled": true,
"domain_id": "d78cbac186b744899480f25bd...", "areacode": "0086",
"email": "[email protected]",
"create_time": "2020-01-06T08:05:16.000000", "xdomain_id": "",
"xdomain_type": "",
"id": "07664aec578026691f00c003a..."
}
返回值 描述
403 没有操作权限。
404 未找到相应的资源。
405 不允许的方法。
409 资源冲突。
413 请求体过大。
500 内部服务错误。
503 服务不可用。
错误码
请参考错误码。