调用CreateServiceLinkedRole创建服务关联角色。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| ServiceName |
string |
是 |
服务名称。 具体信息,请参见支持服务关联角色的云服务。 |
polardb.aliyuncs.com |
| CustomSuffix |
string |
否 |
角色名称后缀。 角色名称(含后缀)的总长度为 1~64 个字符,可包含英文字母、数字、半角句号(.)和短划线(-)。 例如:假设后缀为 |
Example |
| Description |
string |
否 |
服务关联角色描述。 只有允许自定义后缀的服务关联角色才能填写角色描述,否则,角色描述将使用预设值且不能修改。 长度为 1~1024 个字符。 |
Service Linked Role for PolarDB. PolarDB will use this role to access your resources in other services. |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
返回结果。 |
||
| RequestId |
string |
请求 ID。 |
FE58D7CF-03BC-432A-B42D-BC3390C8C2E1 |
| Role |
object |
角色信息。 |
|
| Arn |
string |
角色的资源描述符。 |
acs:ram::177242285274****:role/aliyunserviceroleforpolardb |
| AssumeRolePolicyDocument |
string |
角色的信任策略内容。 |
{\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Effect\":\"Allow\",\"Principal\":{\"Service\":[\"polardb.aliyuncs.com\"]}}],\"Version\":\"1\"} |
| CreateDate |
string |
角色创建时间(UTC 时间)。 |
2020-06-30T08:14:16Z |
| Description |
string |
角色描述。 |
Service Linked Role for PolarDB. PolarDB will use this role to access your resources in other services. |
| IsServiceLinkedRole |
boolean |
是否为服务关联角色。取值:
|
true |
| RoleId |
string |
角色 ID。 |
32833240981067**** |
| RoleName |
string |
角色名称。 |
AliyunServiceRoleForPolarDB |
| RolePrincipalName |
string |
带域名后缀的角色名称。 |
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 |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidParameter.CustomSuffix.NotAllowed | Custom suffix is not allowed for this Service Linked Role. | 该服务关联角色不支持自定义后缀。 |
| 400 | InvalidParameter.CustomSuffix.InvalidChars | The parameter CustomSuffix contains invalid characters. | 参数CustomSuffix包含无效字符。 |
| 400 | InvalidParameter.CustomSuffix.Length | The maximum length of the parameter CustomSuffix is exceeded. | 参数CustomSuffix长度超限。 |
| 400 | InvalidParameter.Description.NotAllowed | Custom description is not allowed for default service linked role. | |
| 400 | InvalidParameter.Description.Length | The maximum length of the description is exceeded. It must not exceed 1024 characters. | 描述长度超限。最大不得超过1024个字符。 |
| 404 | EntityNotExist.Service | The service does not exist. | 该服务不存在。 |
| 409 | EntityAlreadyExists.Role | The role already exists. | 角色已存在。 |
| 409 | LimitExceeded.Role | The maximum number of roles is exceeded. | 角色数量超出限制。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。