ALIYUN::RAM::AttachPolicyToUser类型用于为指定用户添加权限。

语法

{
  "Type": "ALIYUN::RAM::AttachPolicyToUser",
  "Properties": {
    "PolicyType": String,
    "UserName": String,
    "PolicyName": String
  }
}

属性

属性名称 类型 必须 允许更新 描述 约束
PolicyType String 权限策略类型 取值:
  • System
  • Custom
UserName String 用户名
PolicyName String 权限策略名称

返回值

Fn::GetAtt

无。

示例

JSON格式

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "PolicyType": {
      "Type": "String",
      "Description": "Authorization policy type. Value: \"System\" or \"Custom\".",
      "AllowedValues": [
        "System",
        "Custom"
      ]
    },
    "UserName": {
      "Type": "String",
      "Description": "User name.Example: dev."
    },
    "PolicyName": {
      "Type": "String",
      "Description": "Authorization policy name."
    }
  },
  "Resources": {
    "AttachPolicyToUser": {
      "Type": "ALIYUN::RAM::AttachPolicyToUser",
      "Properties": {
        "PolicyType": {
          "Ref": "PolicyType"
        },
        "UserName": {
          "Ref": "UserName"
        },
        "PolicyName": {
          "Ref": "PolicyName"
        }
      }
    }
  }
}

YAML格式

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  PolicyType:
    Type: String
    Description: 'Authorization policy type. Value: "System" or "Custom".'
    AllowedValues:
      - System
      - Custom
  UserName:
    Type: String
    Description: 'User name.Example: dev.'
  PolicyName:
    Type: String
    Description: Authorization policy name.
Resources:
  AttachPolicyToUser:
    Type: 'ALIYUN::RAM::AttachPolicyToUser'
    Properties:
      PolicyType:
        Ref: PolicyType
      UserName:
        Ref: UserName
      PolicyName:
        Ref: PolicyName