Todos os produtos
Search
Central de documentação

Resource Orchestration Service:ALIYUN::CS::GrantPermissions

Última atualização: Jun 27, 2026

Concede permissões de controle de acesso baseado em função (RBAC) a um usuário do Resource Access Management (RAM) ou a uma função do RAM.

Sintaxe

{
  "Type": "ALIYUN::CS::GrantPermissions",
  "Properties": {
    "Permissions": List,
    "UserId": String
  }
}

Propriedades

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

Permissions

List

Sim

Sim

Permissões RBAC concedidas ao usuário do RAM.

Para mais informações, consulte Propriedades de Permissions.

UserId

String

Sim

Sim

ID da função do RAM.

Nenhuma.

Sintaxe de Permissions

"Permissions": [
  {
    "RoleName": String,
    "ClusterId": String,
    "RoleType": String,
    "IsCustom": Boolean,
    "IsRamRole": Boolean,
    "Namespace": String
  }
]

Propriedades de Permissions

Propriedade

Tipo

Obrigatória

Editável

Descrição

Restrição

ClusterId

String

Sim

Sim

ID do cluster que receberá as permissões RBAC.

Deixe esta propriedade vazia quando RoleType estiver definido como all-clusters.

RoleName

String

Sim

Sim

Nome da função predefinida.

Valores válidos:

  • admin: administrador

  • ops: engenheiro de O&M

  • dev: desenvolvedor

  • restricted: usuário restrito

  • Função de cluster: função de cluster especificada por você

RoleType

String

Sim

Sim

Escopo da autorização.

Valores válidos:

  • cluster

  • namespace

  • all-clusters

IsCustom

Boolean

Não

Sim

Indica se a autorização é personalizada.

Valores válidos:

  • true

  • false

IsRamRole

Boolean

Não

Sim

Indica se as permissões são concedidas a uma função do RAM.

Valores válidos:

  • true

  • false

Namespace

String

Não

Sim

Namespace ao qual as permissões se aplicam.

Por padrão, esta propriedade fica vazia quando RoleType está definido como cluster.

Valores de retorno

Fn::GetAtt

Nenhum.

Exemplos

Formato YAML

ROSTemplateFormatVersion: '2015-09-01'
Parameters:
  UserId:
    Type: String
    Description:
      en: The ID of the RAM user.
    Required: true
  Permissions:
    AssociationPropertyMetadata:
      Parameters:
        RoleName:
          Type: String
          Description:
            en: |-
              he predefined role name. Valid values:
              admin: administrator
              ops: O&M engineer
              dev: developer
              restricted: restricted user
              The custom cluster role.
          Required: true
        ClusterId:
          Type: String
          Description:
            en: The ID of the cluster that you want to manage. When the role_type parameter is set to all-clusters, this parameter is set to an empty string.
          Required: true
        RoleType:
          Type: String
          Description:
            en: |-
              The authorization type. Valid values:
              cluster: indicates that the permissions are scoped to a cluster.
              namespace: specifies that the permissions are scoped to a namespace of a cluster.
              all-clusters: specifies that the permissions are scoped to all clusters.
          AllowedValues:
            - cluster
            - namespace
            - all-clusters
          Required: true
    AssociationProperty: List[Parameters]
    Type: Json
    Description:
      en: 'The permissions that you want to grant to the RAM user. '
    Required: true
    MinLength: 0
    MaxLength: 20
Resources:
  GrantPermissions:
    Type: ALIYUN::CS::GrantPermissions
    Properties:
      UserId:
        Ref: UserId
      Permissions:
        Ref: Permissions

Formato JSON

{
  "ROSTemplateFormatVersion": "2015-09-01",
  "Parameters": {
    "UserId": {
      "Type": "String",
      "Description": {
        "en": "The ID of the RAM user."
      },
      "Required": true
    },
    "Permissions": {
      "AssociationPropertyMetadata": {
        "Parameters": {
          "RoleName": {
            "Type": "String",
            "Description": {
              "en": "he predefined role name. Valid values:\nadmin: administrator\nops: O&M engineer\ndev: developer\nrestricted: restricted user\nThe custom cluster role."
            },
            "Required": true
          },
          "ClusterId": {
            "Type": "String",
            "Description": {
              "en": "The ID of the cluster that you want to manage. When the role_type parameter is set to all-clusters, this parameter is set to an empty string."
            },
            "Required": true
          },
          "RoleType": {
            "Type": "String",
            "Description": {
              "en": "The authorization type. Valid values:\ncluster: indicates that the permissions are scoped to a cluster.\nnamespace: specifies that the permissions are scoped to a namespace of a cluster.\nall-clusters: specifies that the permissions are scoped to all clusters."
            },
            "AllowedValues": [
              "cluster",
              "namespace",
              "all-clusters"
            ],
            "Required": true
          }
        }
      },
      "AssociationProperty": "List[Parameters]",
      "Type": "Json",
      "Description": {
        "en": "The permissions that you want to grant to the RAM user. "
      },
      "Required": true,
      "MinLength": 0,
      "MaxLength": 20
    }
  },
  "Resources": {
    "GrantPermissions": {
      "Type": "ALIYUN::CS::GrantPermissions",
      "Properties": {
        "UserId": {
          "Ref": "UserId"
        },
        "Permissions": {
          "Ref": "Permissions"
        }
      }
    }
  }
}