CreateServiceLinkedRole - 创建服务关联角色

调用CreateServiceLinkedRole创建服务关联角色。

调试

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

授权信息

当前API暂无授权信息透出。

请求参数

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

服务名称。

具体信息,请参见支持服务关联角色的云服务

polardb.aliyuncs.com
CustomSuffixstring

角色名称后缀。

角色名称(含后缀)的总长度为 1~64 个字符,可包含英文字母、数字、半角句号(.)和短划线(-)。

例如:假设后缀为Example,则角色名称为ServiceLinkedRoleName_Example,且最大长度不能超过 64 个字符。

Example
Descriptionstring

服务关联角色描述。

只有允许自定义后缀的服务关联角色才能填写角色描述,否则,角色描述将使用预设值且不能修改。

长度为 1~1024 个字符。

Service Linked Role for PolarDB. PolarDB will use this role to access your resources in other services.

返回参数

名称类型描述示例值
object

返回结果。

RequestIdstring

请求 ID。

FE58D7CF-03BC-432A-B42D-BC3390C8C2E1
Roleobject

角色信息。

Arnstring

角色的资源描述符。

acs:ram::177242285274****:role/aliyunserviceroleforpolardb
AssumeRolePolicyDocumentstring

角色的信任策略内容。

{\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"polardb.aliyuncs.com\"]}}],\"Version\":\"1\"}
CreateDatestring

角色创建时间(UTC 时间)。

2020-06-30T08:14:16Z
Descriptionstring

角色描述。

Service Linked Role for PolarDB. PolarDB will use this role to access your resources in other services.
IsServiceLinkedRoleboolean

是否为服务关联角色。取值:

  • true:是服务关联角色。
  • false:不是服务关联角色。
true
RoleIdstring

角色 ID。

32833240981067****
RoleNamestring

角色名称。

AliyunServiceRoleForPolarDB
RolePrincipalNamestring

带域名后缀的角色名称。

AliyunServiceRoleForPolarDB@role.test.onaliyunservice.com

示例

正常返回示例

JSON格式

{
  "RequestId": "FE58D7CF-03BC-432A-B42D-BC3390C8C2E1",
  "Role": {
    "Arn": "acs:ram::177242285274****:role/aliyunserviceroleforpolardb",
    "AssumeRolePolicyDocument": "{\\\"Statement\\\":[{\\\"Action\\\":\\\"sts:AssumeRole\\\",\\\"Effect\\\":\\\"Allow\\\",\\\"Principal\\\":{\\\"Service\\\":[\\\"polardb.aliyuncs.com\\\"]}}],\\\"Version\\\":\\\"1\\\"}",
    "CreateDate": "2020-06-30T08:14:16Z",
    "Description": "Service Linked Role for PolarDB. PolarDB will use this role to access your resources in other services.",
    "IsServiceLinkedRole": true,
    "RoleId": "32833240981067****",
    "RoleName": "AliyunServiceRoleForPolarDB",
    "RolePrincipalName": "AliyunServiceRoleForPolarDB@role.test.onaliyunservice.com"
  }
}

错误码

HTTP status code错误码错误信息描述
400InvalidParameter.CustomSuffix.NotAllowedCustom suffix is not allowed for this Service Linked Role.该服务关联角色不支持自定义后缀。
400InvalidParameter.CustomSuffix.InvalidCharsThe parameter CustomSuffix contains invalid characters.参数CustomSuffix包含无效字符。
400InvalidParameter.CustomSuffix.LengthThe maximum length of the parameter CustomSuffix is exceeded.参数CustomSuffix长度超限。
400InvalidParameter.Description.NotAllowedCustom description is not allowed for default service linked role.-
400InvalidParameter.Description.LengthThe maximum length of the description is exceeded. It must not exceed 1024 characters.描述长度超限。最大不得超过1024个字符。
404EntityNotExist.ServiceThe service does not exist.该服务不存在。
409EntityAlreadyExists.RoleThe role already exists.角色已存在。
409LimitExceeded.RoleThe maximum number of roles is exceeded.角色数量超出限制。

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

变更历史

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