EnableResourceDirectory - 开通资源目录

调用EnableResourceDirectory开通资源目录。

接口说明

您可以使用当前登录账号或新创建管理账号两种方式开通资源目录。更多信息,请参见开通资源目录

本文将提供一个示例,使用当前登录账号开通资源目录。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用前面加 * 表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
resourcemanager:EnableResourceDirectorycreate
*全部资源
*

请求参数

名称类型必填描述示例值
MANamestring

新管理账号名称。

格式:<前缀>@rdadmin.aliyunid.com。其中,<前缀>允许输入英文字母、数字、特殊字符_.-,且必须以英文字母或数字开头和结尾,不能输入连续特殊字符。<前缀>的长度为 2~50 个字符。

user01@rdadmin.aliyunid.com
MASecureMobilePhonestring

新创建管理账号的安全手机号码。

置空表示采用当前登录账号的安全手机号码。该手机号码必须与 SendVerificationCodeForEnableRD 中获取验证码时使用的手机号码一致。

格式:<国家码>-<手机号码>

说明 仅支持填写86-<手机号码>的中国内地手机号码。
xx-13900001234
VerificationCodestring

验证码。

您可以调用 SendVerificationCodeForEnableRD 获取验证码。

123456
EnableModestring

开通方式。取值:

  • CurrentAccount:使用当前登录账号开通资源目录。
  • NewManagementAccount:新创建管理账号开通资源目录。该方式下,您需要配置MANameMASecureMobilePhoneVerificationCode
CurrentAccount

返回参数

名称类型描述示例值
object

返回结果。

ResourceDirectoryobject

资源目录信息。

ResourceDirectoryIdstring

资源目录 ID。

rd-54****
MasterAccountIdstring

管理账号 ID。

507408460615****
MasterAccountNamestring

管理账号名称。

alice@example.com
RootFolderIdstring

Root 资源夹 ID。

r-G9****
CreateTimestring

资源目录开通时间。

2021-12-08T02:15:31.744Z
RequestIdstring

请求 ID。

EC2FE94D-A4A2-51A1-A493-5C273A36C46A

示例

正常返回示例

JSON格式

{
  "ResourceDirectory": {
    "ResourceDirectoryId": "rd-54****",
    "MasterAccountId": "507408460615****",
    "MasterAccountName": "alice@example.com",
    "RootFolderId": "r-G9****",
    "CreateTime": "2021-12-08T02:15:31.744Z"
  },
  "RequestId": "EC2FE94D-A4A2-51A1-A493-5C273A36C46A"
}

错误码

HTTP status code错误码错误信息描述
409NotSupport.AccountInAnotherResourceDirectoryThe specified account is an Alibaba Cloud account or already exists in another resource directory.-
409Invalid.EnterpriseNameYou must specify the enterprise name.账号未设置企业名称,请您先完成企业名称设置。
409EnterpriseRealNameVerificationErrorThe specified account does not pass enterprise real-name verification. We recommend you first complete enterprise real-name verification for the account.当前账号未经过企业实名认证。请您先完成企业实名认证。
409EntityAlreadyExists.ResourceDirectoryThe resource directory for the account is already enabled. We recommend that you do not enable the resource directory again.账号已开通资源目录,请勿重复开通。
409InvalidParameter.ManagementAccountName.AlreadyUsedThe ManagementAccountName has been used.管理账号名称已被占用,请更换其他名称。
409Invalid.VerificationCodeThe verification code is invalid.验证码无效。
409InvalidParameter.ManagementAccountNameThe management account name is in the wrong format.管理账号名称格式错误。
409InvalidParameter.ManagementAccountSecurityInfoThe parameter management account secure mobile phone is invalid.安全手机号码格式不正确。
409MissingSecureMobilePhoneSecure mobile phone is missing.缺少安全手机号码。
409MissingSecurityInfoSecurity info is missing.-

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
暂无变更历史