阅读479 返回首页    go 阿里云


CreatePolicy__授权策略管理接口_RAM API文档_访问控制-阿里云

接口描述

 创建一个授权策略

请求参数

Action

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

PolicyName

  • 类型:String
  • 必须:是
  • 描述:授权策略名称, 最多包含128个字符
  • 格式:^[a-zA-Z0-9-]+$

Description

  • 类型:String
  • 必须:否
  • 描述:授权策略描述,最大长度1024字字符

PolicyDocument

  • 类型:String
  • 必须:是
  • 描述:授权策略内容,最大长度2048字节

返回参数

Policy

需要的权限

Action

ram:CreatePolicy

Resource

acs:ram:*:${AccountId}:policy/*

错误信息

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.PolicyDocument.Length
  • HTTP Status:400
  • Error Message:The parameter - "PolicyName" beyond the length limit.
InvalidParameter.Description.Length
  • HTTP Status:400
  • Error Message:The parameter - "Description" beyond the length limit.
MalformedPolicyDocument
  • HTTP Status:400
  • Error Message:{The error details}
EntityAlreadyExists.Policy
  • HTTP Status:409
  • Error Message:The group does already EXIST.
LimitExceeded.Policy
  • HTTP Status:409
  • Error Message:The count of policy beyond the current limits.

操作示例

请求示例

https://ram.aliyuncs.com/?Action=CreatePolicy
&PolicyName=OSS-Administrator
&PolicyDocument={ "Statement": [{ "Action": ["oss:*"], "Effect": "Allow", "Resource": ["acs:oss:*:*:*"]}], "Version": "1"}
&Description=OSS管理员权限
&<公共请求参数>

返回示例

XML格式

<CreatePolicyResponse>
    <RequestId>9B34724D-54B0-4A51-B34D-4512372FE1BE</RequestId>
    <Policy>
        <PolicyName>OSS-Administrator</PolicyName>
        <PolicyType>Custom</PolicyType>
        <Description>OSS管理员权限</Description>
        <DefaultVersion>v1</DefaultVersion>
        <CreateDate>2015-01-23T12:33:18Z</CreateDate>
    </Policy>
</CreatePolicyResponse>

JSON格式

{
    "RequestId": "9B34724D-54B0-4A51-B34D-4512372FE1BE",
    "Policy": {
        "PolicyName": "OSS-Administrator",
        "PolicyType": "Custom",
        "Description": "OSS管理员权限",
        "DefaultVersion": "v1",
        "CreateDate": "2015-01-23T12:33:18Z"
    }
}

最后更新:2016-11-23 17:16:05

  上一篇:go DeleteRole__角色管理接口_RAM API文档_访问控制-阿里云
  下一篇:go GetPolicy__授权策略管理接口_RAM API文档_访问控制-阿里云