查询有效策略。
接口说明
使用说明
单账号模式下,当前登录账号可以查询自己已绑定的有效策略。多账号模式下,资源目录管理账号可以查询 Root 资源夹、资源夹和成员已绑定的有效策略,资源目录成员可以查询自己已绑定的有效策略。关于标签策略模式的更多信息,请参见标签策略模式。
该有效策略是根据标签策略继承关系计算得出的。更多信息,请参见标签策略继承和有效策略计算。
本文将提供一个示例,在单账号模式下,查询当前登录账号的有效策略。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
tag:GetEffectivePolicy |
get |
*全部资源
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| RegionId |
string |
否 |
地域 ID。取值:cn-shanghai。 |
cn-shanghai |
| TargetId |
string |
否 |
目标节点 ID。 说明
该参数在单账号模式下为可选,多账号模式下为必选。 |
154950938137**** |
| TargetType |
string |
否 |
目标节点类型。取值:
说明
该参数在单账号模式下为可选,多账号模式下为必选。且参数取值不区分大小写。 |
ACCOUNT |
| TagKeys |
array |
否 |
||
|
string |
否 |
关于公共请求参数的详情,请参见公共参数。
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
返回结果。 |
||
| RequestId |
string |
请求 ID。 |
BB532282-94F5-5F56-877F-32D5E2A04F3F |
| EffectivePolicy |
string |
有效策略。 |
{\"tags\":{\"costcenter\":{\"tag_value\":[\"Beijing\",\"Shanghai\"],\"tag_key\":\"CostCenter\"}}} |
| PolicyAttachments |
array<object> |
||
|
array<object> |
|||
| TagKey |
string |
||
| PolicyType |
string |
||
| PolicyList |
array<object> |
||
|
object |
|||
| PolicyId |
string |
||
| PolicyName |
string |
||
| AttachSeq |
integer |
||
| AttachTime |
string |
||
| TargetId |
string |
||
| TargetType |
string |
示例
正常返回示例
JSON格式
{
"RequestId": "BB532282-94F5-5F56-877F-32D5E2A04F3F",
"EffectivePolicy": "{\\\"tags\\\":{\\\"costcenter\\\":{\\\"tag_value\\\":[\\\"Beijing\\\",\\\"Shanghai\\\"],\\\"tag_key\\\":\\\"CostCenter\\\"}}}",
"PolicyAttachments": [
{
"TagKey": "",
"PolicyType": "",
"PolicyList": [
{
"PolicyId": "",
"PolicyName": "",
"AttachSeq": 0,
"AttachTime": "",
"TargetId": "",
"TargetType": ""
}
]
}
]
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | NoPermission.RAM | The operator is not permission for the action in ram policy. | 该账号不支持此调用。 |
| 403 | EffectivePolicy.ResourceGroupScope.TooLong | The resource group range of for effective policy is too long. | 有效策略的资源组范围太长了。 |
| 403 | ConfigRule.NotExist | Config rule id does not exist. | 配置审计不存在。 |
| 403 | RDAcount.HasOpened | As the RD master or administrator, you cannot activate the tag policy service because account has already enabled it, you can only activate it once the policy service is disabled by the aforementioned RD account. | 资源目录的成员账号开通了标签策略,需要先关闭成员账号的开通才可以开通多账号模式。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。