访问控制(RAM)是阿里云提供的管理用户身份与资源访问权限的服务。使用RAM可以让您避免与其他用户共享阿里云账号密钥,并可按需为用户授予最小权限。RAM中使用获取最小权限策略描述授权的具体内容。

本文为您介绍API 网关(APIG)为RAM权限策略定义的操作(Action)、资源(Resource)和条件(Condition)。API 网关(APIG)的RAM代码(RamCode)为 apig,支持的授权粒度为资源级

权限策略通用结构

权限策略支持JSON格式,其通用结构如下:展开详情

操作(Action)

下表是API 网关(APIG)定义的操作,这些操作可以在RAM权限策略语句的Action元素中使用,用来授予执行该操作的权限。下面对表中的具体项提供说明:展开详情

操作API访问级别资源类型条件关键字关联操作
apig:AddGatewaySecurityGroupRule
授权网关访问服务的安全组
None
Gateway
acs:apig:{#regionId}:{#accountId}:gateway/{#GatewayId}
apig:BatchDeleteConsumerAuthorizationRule
None
全部资源
*
apig:CancelAiGenerateTask
Delete
全部资源
*
apig:ChangeResourceGroup
资源转组
None
全部资源
*
apig:CheckCommodityStatus
None
全部资源
*
apig:CheckRegularExpressions
None
全部资源
*
apig:CreateAiGenerateWebIde
Create
全部资源
*
apig:CreateAndAttachPolicy
None
Policy
acs:apig:{#regionId}:{#accountId}:policy/*
apig:CreateConsumer
Create
全部资源
*
apig:CreateConsumerAuthorizationRule
None
Domain
acs:apig:{#regionId}:{#accountId}:consumer/{#ConsumerId}
资源(Resource)

下表是API 网关(APIG)定义的资源,这些资源可以在RAM权限策略语句的Resource元素中使用,用来授予对该资源执行具体操作的权限。

其中,资源ARN是资源在阿里云上的唯一标识。具体说明如下:

  • {#}为变量标识,需要您替换为实际值。例如: {#ramcode} 需要您替换为实际的云服务RAM代码。
  • *表示全部。例如:
    • {#resourceType}/* :表示全部资源。
    • {#regionId}*时:表示全部地域。
    • {#accountId}*时:表示全部阿里云账号。
资源类型资源ARN
ConsumerAuthorizationRule
  • acs:apig:{#regionId}:{#accountId}:consumerauthorizationrule/*
Domain
  • acs:apig:{#regionId}:{#accountId}:consumer/{#ConsumerId}
  • acs:apig:{#regionId}:{#accountId}:domain/*
  • acs:apig:{#regionId}:{#accountId}:domain/{#DomainId}
  • acs:apig:{#regionId}:{#accountId}:consumer/*
Environment
  • acs:apig:{#regionId}:{#accountId}:environment/*
  • acs:apig:{#regionId}:{#accountId}:environment/{#EnvironmentId}
Gateway
  • acs:apig:{#regionId}:{#accountId}:gateway/*
  • acs:apig:{#regionId}:{#accountId}:gateway/{#GatewayId}
HttpApi
  • acs:apig:{#regionId}:{#accountId}:httpapi/{#HttpApiId}
  • acs:apig:{#regionId}:{#accountId}:httpapi/*
Policy
  • acs:apig:{#regionId}:{#accountId}:policy/{#PolicyId}
  • acs:apig:{#regionId}:{#accountId}:policy/*
Service
  • acs:apig:{#regionId}:{#accountId}:service/{#ServiceId}
  • acs:apig:{#regionId}:{#accountId}:service/*
Source
  • acs:apig:{#regionId}:{#accountId}:source/{#SourceId}
  • acs:apig:{#regionId}:{#accountId}:source/{SourceId]
  • acs:apig:{#regionId}:{#accountId}:source/*
条件(Condition)

API 网关(APIG)未定义产品级别的条件关键字。如需查看适用于所有云产品的通用条件关键字,请参见通用条件关键字

相关操作

您可以创建自定义权限策略,并将权限策略授予RAM用户、RAM用户组或RAM角色。具体操作如下: