全部产品
存储与CDN 数据库 安全 应用服务 数加·人工智能 数加·大数据基础服务 互联网中间件 视频服务 开发者工具 解决方案 物联网
访问控制

GetPolicyVersion

更新时间:2017-06-07 13:26:11

接口描述

 获取某个授权策略的版本

请求参数

Action

  • 类型:String
  • 必须:是
  • 描述:系统规定参数,取值:GetPolicyVersion

PolicyType

  • 类型:String
  • 必须:是
  • 描述:指定Policy的类型, 取值System或Custom

PolicyName

  • 类型:String
  • 必须:是
  • 描述:授权策略名称

VersionId

  • 类型:String
  • 必须:是
  • 描述:指定目标版本的Id

返回参数

PolicyVersion

需要的权限

Action

ram:GetPolicyVersion

Resource

acs:ram:*:${AccountId} or system:group/${PolicyName}

错误信息

InvalidParameter.PolicyType
  • HTTP Status:400
  • Error Message:The parameter - "PolicyType" is incorrect.
InvalidParameter.PolicyName.InvalidChars
  • HTTP Status:400
  • Error Message:The parameter - "PolicyNam" contains invalid chars.
InvalidParameter.PolicyName.Length
  • HTTP Status:400
  • Error Message:The parameter - "PolicyName" beyond the length limit.
InvalidParameter.VersionId.Format
  • HTTP Status:400
  • Error Message:The format of the parameter - "VersionId" is incorrect.
EntityNotExist.Policy
  • HTTP Status:404
  • Error Message:The policy does not exist.
EntityNotExist.Policy.Version
  • HTTP Status:404
  • Error Message:The policy version does not exist.

操作示例

请求示例

https://ram.aliyuncs.com/?Action=GetPolicyVersion
&PolicyName=OSS-Administrator
&PolicyType=Custom
&VersionId=v3
&<公共请求参数>

返回示例

XML格式

<GetPolicyVersionResponse>
    <RequestId>9B34724D-54B0-4A51-B34D-4512372FE1BE</RequestId>
    <PolicyVersion>
        <VersionId>v3</VersionId>
        <IsDefaultVersion>false</IsDefaultVersion>
        <CreateDate>2015-01-23T12:33:18Z</CreateDate>
        <PolicyDocument>
            { "Statement": [{ "Action": ["oss:*"], "Effect": "Allow", "Resource": ["acs:oss:*:*:*"]}], "Version": "1"}
        </PolicyDocument>
    </PolicyVersion>
</GetPolicyVersionResponse>

JSON格式

{
    "RequestId": "9B34724D-54B0-4A51-B34D-4512372FE1BE",
    "PolicyVersion": {
        "VersionId": "v3",
        "IsDefaultVersion": false,
        "CreateDate": "2015-01-23T12:33:18Z",
        "PolicyDocument": "{ \"Statement\": [{ \"Action\": [\"oss:*\"], \"Effect\": \"Allow\", \"Resource\": [\"acs:oss:*:*:*\"]}], \"Version\": \"1\"}"
    }
}
本文导读目录