閱讀500 返回首頁    go 阿裏雲


AttachPolicyToUser__授權策略管理接口_RAM API文檔_訪問控製-阿裏雲

接口描述

 為指定用戶附加授權

請求參數

Action

  • 類型:String
  • 必須:是
  • 描述:係統規定參數,取值:AttachPolicyToUser

PolicyType

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

PolicyName

  • 類型:String
  • 必須:是
  • 描述:指定授權策略名稱

UserName

  • 類型:String
  • 必須:是
  • 描述:指定用戶名。例:zhangqiang

返回參數

  隻有公共返回參數,詳見公共返回參數

需要的權限

Action

ram:AttachPolicyToUser

Resource

acs:ram:*:${AccountId}:user/${UserName}

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

錯誤信息

InvalidParameter.UserName.InvalidChars
  • HTTP Status:400
  • Error Message:The parameter - "UserName" contains invalid chars.
InvalidParameter.UserName.Length
  • HTTP Status:400
  • Error Message:The parameter - "UserName" beyond the length limit.
EntityNotExist.User
  • HTTP Status:404
  • Error Message:The user does not exist.
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.
EntityNotExist.Policy
  • HTTP Status:404
  • Error Message:The policy does not exist.
EntityAlreadyExists.User.Policy
  • HTTP Status:409
  • Error Message:The user has already been attached this policy.
LimitExceeded.User.Policy
  • HTTP Status:409
  • Error Message:The policy count of the user attached policies beyond the current limits.

操作示例

請求示例

https://ram.aliyuncs.com/?Action=AttachPolicyToUser
&PolicyType=Custom
&PolicyName=OSS-Administrator
&UserName=zhangqiang
&<公共請求參數>

返回示例

XML格式

<AttachPolicyToUserResponse>
    <RequestId>697852FB-50D7-44D9-9774-530C31EAC572</RequestId>
</AttachPolicyToUserResponse>

JSON格式

{
    "RequestId": "697852FB-50D7-44D9-9774-530C31EAC572"
}

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

  上一篇:go SetDefaultPolicyVersion__授權策略管理接口_RAM API文檔_訪問控製-阿裏雲
  下一篇:go DetachPolicyFromUser__授權策略管理接口_RAM API文檔_訪問控製-阿裏雲