閱讀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文檔_訪問控製-阿裏雲