接口请求域名: cam.intl.tencentcloudapi.com 。
本接口(GetPolicy)可用于查询查看策略详情。
默认接口请求频率限制:20次/秒。
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
| 参数名称 | 必选 | 类型 | 描述 |
|---|---|---|---|
| Action | 是 | String | 公共参数,本接口取值:GetPolicy。 |
| Version | 是 | String | 公共参数,本接口取值:2019-01-16。 |
| Region | 否 | String | 公共参数,此参数为可选参数。 |
| PolicyId | 是 | Integer | 策略Id。 |
| 参数名称 | 类型 | 描述 |
|---|---|---|
| PolicyName | String | 策略名。 |
| Description | String | 策略描述。 |
| Type | Integer | 1 表示自定义策略,2 表示预设策略。 |
| AddTime | Timestamp | 策略创建时间。 |
| UpdateTime | Timestamp | 策略最近更新时间。 |
| PolicyDocument | String | 策略文档。 |
| PresetAlias | String | 备注。 注意:此字段可能返回 null,表示取不到有效值。 |
| IsServiceLinkedRolePolicy | Integer | 是否是服务相关策略,0代表不是服务相关策略,1代表是服务相关策略。 |
| Tags | Array of Tag | 策略关联的标签列表 |
| RequestId | String | 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 |
查看策略详情
https://cam.intl.tencentcloudapi.com/?Action=GetPolicy
&PolicyId=17698703
&<公共请求参数>
{
"Response": {
"PolicyDocument": "{\"version\":\"2.0\",\"statement\":[{\"effect\":\"allow\",\"action\":[\"name\\/cos:*\"],\"resource\":[\"*\"]}]}",
"UpdateTime": "2019-04-29 21:28:32",
"AddTime": "2019-04-29 21:18:40",
"PolicyName": "test-2019-04-29",
"Description": "测试策略",
"Type": 1,
"RequestId": "845b309d-e531-402d-a4f6-ec124f06738b",
"PresetAlias": "备注",
"IsServiceLinkedRolePolicy": 0,
"Tags": [
{
"Key": "region",
"Value": "ap-guangzhou"
}
]
}
}
云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。
以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码。
| 错误码 | 描述 |
|---|---|
| InternalError.SystemError | 内部错误。 |
| InvalidParameter.ParamError | 非法入参。 |
| InvalidParameter.PolicyIdError | 输入参数PolicyId不合法。 |
| ResourceNotFound.PolicyIdNotFound | PolicyId指定的资源不存在。 |
文档反馈