更新时间:2024-10-09 GMT+08:00

权限策略和授权项

如果您需要对您所拥有的API网关服务进行精细的权限管理,您可以使用统一身份认证服务(Identity and Access Management,简称IAM)。

  • 如果账号已经能满足您的要求,不需要创建独立的IAM用户,您可以跳过本章节,不影响您使用API网关服务的其它功能。
  • 仅API网关专享版支持精细的细粒度授权。

默认情况下,新建的IAM用户没有任何权限,您需要将其加入用户组,并给用户组授予策略(以JSON格式描述权限集的语言),才能使用户组中的用户获得策略定义的权限,这一过程称为授权。授权后,用户就可以基于策略对云服务进行操作。

账号具备所有接口的调用权限,如果使用账号下的IAM用户发起API请求时,该IAM用户必须具备调用该接口所需的权限,否则,API请求将调用失败。每个接口所需要的权限,与各个接口所对应的授权项相对应,只有发起请求的IAM用户被授予授权项所对应的策略,该用户才能成功调用该接口。例如,IAM用户要调用接口来创建API,那么这个IAM用户被授予的策略中必须包含允许“apig:apis:create”的授权项,该接口才能调用成功。

支持的授权项

细粒度策略支持的操作与API相对应,授权项列表说明如下:

  • 权限:自定义策略中授权项定义的内容即为权限。
  • 授权项:自定义策略中支持的Action,在自定义策略中的Action中写入授权项,可以实现授权项对应的权限功能。
  • 对应API接口:自定义策略实际调用的API接口。
  • 授权范围:自定义策略的授权范围,包括IAM项目与企业项目。授权范围如果同时支持IAM项目和企业项目,表示此授权项对应的自定义策略,可以在IAM和企业管理两个服务中给用户组授权并生效。如果仅支持IAM项目,不支持企业项目,表示仅能在IAM中给用户组授权并生效,如果在企业管理中授权,则该自定义策略不生效。

API网关服务管理控制操作相关的授权项,明细如下表所示。用户调用如下API时,需要获取对应的权限。

表1 API网关权限明细

权限

对应的API接口

授权项(Action)

依赖的授权项

IAM项目(Project)

企业项目(Enterprise Project)

创建API网关专享版实例

POST /v2/{project_id}/apigw/instances

apig:instances:create

-

删除API网关专享版实例

DELETE /v2/{project_id}/apigw/instances/{instance_id}

apig:instances:delete

-

更新API网关专享版实例

PUT

/v2/{project_id}/apigw/instances/{instance_id}

apig:instances:update

-

查看API网关专享版实例

GET

/v2/{project_id}/apigw/instances/{instance_id}

apig:instances:get

-

查看API网关专享版实例列表

GET /v2/{project_id}/apigw/instances

apig:instances:list

-

通过标签查询实例列表

POST

/V2/{project_id}/apigw/resource-instances/filter

apig:instance:listByTags

-

x

通过标签查询实例数量

POST

/V2/{project_id}/apigw/resource-instances/count

apig:instance:getNumByTags

-

x

查看实例标签列表

GET /v2/{project_id}/apigw/instance-tags

apig:instanceTags:list

-

x

删除实例标签

POST /v2/{project_id}/apigw/instances/{instance_id}/instance-tags/action

apig:instanceTags:delete

apig:instances:get

创建实例标签

POST

/V2/{project_id}/apigw/instances/{instance_id}/instance-tags/action

apig:instanceTags:create

apig:instances:get

创建API分组

POST /v2/{project_id}/apigw/instances/{instance_id}/api-groups

apig:groups:create

apig:instances:get

删除API分组

DELETE /v2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}

apig:groups:delete

apig:instances:get

查看API分组

GET

/v2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}

apig:groups:get

apig:instances:get

查看API分组列表

GET

/v2/{project_id}/apigw/instances/{instance_id}/api-groups

apig:groups:list

apig:instances:get

更新API分组

PUT

/V2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}

apig:groups:update

apig:instances:get

创建分组域名

POST

/v2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/domains

apig:domains:create

apig:instances:get

apig:groups:get

删除分组域名

DELETE

/v2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/domains/{domain_id}

apig:domains:delete

apig:instances:get

apig:groups:get

分组域名绑定证书

POST

/v2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/domains/{domain_id}/certificate

apig:domains:bindCertificate

apig:instances:get

apig:groups:get

apig:domains:get

分组域名解绑证书

DELETE

/v2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/domains/{domain_id}/certificate/{certificate_id}

apig:domains:unbindCertificate

apig:instances:get

apig:groups:get

apig:domains:get

查看分组域名绑定的证书

GET

/v2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/domains/{domain_id}/certificate/{certificate_id}

apig:domains:getCertificate

apig:instances:get

apig:groups:get

apig:domains:get

设置调试域名是否可以访问

PUT /v2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/sl-domain-access-settings

apig:domains:updateSLDomainSetting

apig:instances:get

apig:groups:get

创建环境变量

POST

/v2/{project_id}/apigw/instances/{instance_id}/env-variables

apig:variables:create

apig:instances:get

apig:groups:get

apig:envs:list

删除环境变量

DELETE

/v2/{project_id}/apigw/instances/{instance_id}/env-variables/{env_variable_id}

apig:variables:delete

apig:instances:get

apig:groups:get

apig:envs:list

查看环境变量

GET

/v2/{project_id}/apigw/instances/{instance_id}/env-variables/{env_variable_id}

apig:variables:get

apig:instances:get

apig:groups:get

apig:envs:list

查看环境变量列表

GET

/v2/{project_id}/apigw/instances/{instance_id}/env-variables

apig:variables:list

apig:instances:get

apig:groups:get

apig:envs:list

创建API

POST

/v2/{project_id}/apigw/instances/{instance_id}/apis

apig:apis:create

apig:instances:get

apig:groups:get

删除API

DELETE /v2/{project_id}/apigw/instances/{instance_id}/apis/{api_id}

apig:apis:delete

apig:instances:get

apig:groups:get

发布API

POST /v2/{project_id}/apigw/instances/{instance_id}/apis/action

apig:apis:publish

apig:instances:get

apig:groups:get

apig:envs:list

下线API

POST /v2/{project_id}/apigw/instances/{instance_id}/apis/action

apig:apis:offline

apig:instances:get

apig:groups:get

apig:envs:list

调试API

POST /v2/{project_id}/apigw/instances/{instance_id}/apis/debug/{api_id}

apig:apis:debug

apig:instances:get

apig:groups:get

导入API

POST /v2/{project_id}/apigw/instances/{instance_id}/openapi/import

apig:apis:import

apig:instances:get

apig:apis:create

apig:apis:bindAcls

apig:apis:bindThrottles

apig:groups:get

apig:acls:create

apig:throttles:create

导出API

POST /v2/{project_id}/apigw/instances/{instance_id}/openapi/export

apig:apis:export

apig:instances:get

apig:apis:list

apig:apis:get

apig:apis:listBindedTrottles

apig:apis:listBindedAcls

apig:groups:get

apig:acls:get

apig:throttles:get

更新API

PUT

/V2/{project_id}/apigw/instances/{instance_id}/apis/{api_id}

apig:apis:update

apig:instances:get

apig:groups:get

授权API

POST /v2/{project_id}/apigw/instances/{instance_id}/app-auths

apig:apis:grantAppAccess

apig:instances:get

apig:apps:get

apig:apis:get

解授权API

DELETE /v2/{project_id}/apigw/instances/{instance_id}/app-auths/{app_auth_id}

apig:apis:relieveAppAccess

apig:instances:get

apig:apps:get

apig:apis:get

API绑定签名

POST /v2/{project_id}/apigw/instances/{instance_id}/sign-bindings

apig:apis:bindSigns

apig:instances:get

apig:apis:get

apig:signs:list

API解绑签名

DELETE /v2/{project_id}/apigw/instances/{instance_id}/sign-bindings/{sign_bindings_id}

apig:apis:unbindSigns

apig:instances:get

apig:apis:get

apig:signs:list

API绑定访问控制

POST /v2/{project_id}/apigw/instances/{instance_id}/acl-bindings

apig:apis:bindAcls

apig:instances:get

apig:apis:get

apig:acls:get

API解绑访问控制

DELETE /v2/{project_id}/apigw/instances/{instance_id}/acl-bindings/{acl_bindings_id}

apig:apis:unbindAcls

apig:instances:get

apig:apis:get

apig:acls:get

API绑定流量控制

POST /v2/{project_id}/apigw/instances/{instance_id}/throttle-bindings

apig:apis:bindThrottles

apig:instances:get

apig:apis:get

apig:throttles:get

API解绑流量控制

DELETE /v2/{project_id}/apigw/instances/{instance_id}/throttle-bindings/{throttle_binding_id}

apig:apis:unbindThrottles

apig:instances:get

apig:apis:get

apig:throttles:get

查看API

GET /v2/{project_id}/apigw/instances/{instance_id}/apis/{api_id}

apig:apis:get

apig:instances:get

apig:groups:get

查看API列表

GET /v2/{project_id}/apigw/instances/{instance_id}/apis

apig:apis:list

apig:instances:get

apig:groups:get

查看API绑定的应用列表

GET /v2/{project_id}/apigw/instances/{instance_id}/app-auths/binded-apps

apig:apis:listBindedApps

apig:instances:get

apig:apis:get

查看API绑定的签名列表

GET /v2/{project_id}/apigw/instances/{instance_id}/sign-bindings/binded-signs

apig:apis:listBindedSigns

apig:instances:get

apig:apis:get

查看API绑定的访问控制列表

GET /v2/{project_id}/apigw/instances/{instance_id}/acl-bindings/binded-acls

apig:apis:listBindedAcls

apig:instances:get

apig:apis:get

查看API绑定的流量控制列表

GET /v2/{project_id}/apigw/instances/{instance_id}/throttle-bindings/binded-throttles

apig:apis:listBindedThrottles

apig:instances:get

apig:apis:get

查看API绑定的插件列表

GET /v2/{project_id}/apigw/instances/{instance_id}/apis/{api_id}/attached-plugins

apig:apis:listBindedPlugins

apig:instances:get

apig:apis:get

API绑定插件

POST /v2/{project_id}/apigw/instances/{instance_id}/apis/{api_id}/plugins/attach

apig:apis:bindPlugins

apig:instances:get

apig:plugins:get

apig:apis:get

API解绑插件

PUT /v2/{project_id}/apigw/instances/{instance_id}/plugins/{plugin_id}/detach

apig:apis:unbindPlugins

apig:instances:get

apig:plugins:get

apig:apis:get

创建环境

POST /v2/{project_id}/apigw/instances/{instance_id}/envs

apig:envs:create

apig:instances:get

删除环境

DELETE /v2/{project_id}/apigw/instances/{instance_id}/envs/{env_id}

apig:envs:delete

apig:instances:get

查看环境列表

GET /v2/{project_id}/apigw/instances/{instance_id}/envs

apig:envs:list

apig:instances:get

更新环境

PUT

/V2/{project_id}/apigw/instances/{instance_id}/envs/{env_id}

apig:envs:update

apig:instances:get

创建应用

POST /v2/{project_id}/apigw/instances/{instance_id}/apps

apig:apps:create

apig:instances:get

删除应用

DELETE /v2/{project_id}/apigw/instances/{instance_id}/apps/{app_id}

apig:apps:delete

apig:instances:get

查看应用

GET /v2/{project_id}/apigw/instances/{instance_id}/apps/{app_id}

apig:apps:get

apig:instances:get

查看应用列表

GET /v2/{project_id}/apigw/instances/{instance_id}/apps

apig:apps:list

apig:instances:get

查看应用绑定的API列表

GET /v2/{project_id}/apigw/instances/{instance_id}/app-auths/binded-apis

apig:apps:listBindedApis

apig:instances:get

apig:apps:get

查看应用未绑定的API列表

GET /v2/{project_id}/apigw/instances/{instance_id}/app-auths/unbinded-apis

apig:apps:listUnbindedApis

apig:instances:get

apig:apps:get

更新应用

PUT

/V2/{project_id}/apigw/instances/{instance_id}/apps/{app_id}

apig:apps:update

apig:instances:get

创建签名

POST /v2/{project_id}/apigw/instances/{instance_id}/signs

apig:signs:create

apig:instances:get

删除签名

DELETE /v2/{project_id}/apigw/instances/{instance_id}/signs/{sign_id}

apig:signs:delete

apig:instances:get

查看签名列表

GET /v2/{project_id}/apigw/instances/{instance_id}/signs

apig:signs:list

apig:instances:get

查看签名绑定的API列表

GET /v2/{project_id}/apigw/instances/{instance_id}/sign-bindings/binded-apis

apig:signs:listBindedApis

apig:instances:get

apig:signs:list

查看签名未绑定的API列表

GET /v2/{project_id}/apigw/instances/{instance_id}/sign-bindings/unbinded-apis

apig:signs:listUnbindedApis

apig:instances:get

apig:signs:list

更新签名

PUT

/V2/{project_id}/apigw/instances/{instance_id}/signs/{sign_id}

apig:signs:update

apig:instances:get

创建访问控制

POST /v2/{project_id}/apigw/instances/{instance_id}/acls

apig:acls:create

apig:instances:get

删除访问控制

DELETE /v2/{project_id}/apigw/instances/{instance_id}/acls/{acl_id}

apig:acls:delete

apig:instances:get

查看访问控制

GET /v2/{project_id}/apigw/instances/{instance_id}/acls/{acl_id}

apig:acls:get

apig:instances:get

查看访问控制列表

GET /v2/{project_id}/apigw/instances/{instance_id}/acls

apig:acls:list

apig:instances:get

查看访问控制绑定的API列表

GET /v2/{project_id}/apigw/instances/{instance_id}/acl-bindings/binded-apis

apig:acl:listBoundApi

apig:instances:get

apig:acls:get

查看访问控制未绑定的API列表

GET /v2/{project_id}/apigw/instances/{instance_id}/acl-bindings/unbinded-apis

apig:acls:listUnbindedApis

apig:instances:get

apig:acls:get

更新访问控制

PUT

/V2/{project_id}/apigw/instances/{instance_id}/acls/{acl_id}

apig:acls:update

apig:instances:get

创建流量控制

POST /v2/{project_id}/apigw/instances/{instance_id}/throttles

apig:throttles:create

apig:instances:get

删除流量控制

DELETE /v2/{project_id}/apigw/instances/{instance_id}/throttles/{throttle_id}

apig:throttles:delete

apig:instances:get

查看流量控制详情

GET /v2/{project_id}/apigw/instances/{instance_id}/throttles/{throttle_id}

apig:specialThrottles:get

apig:instances:get

查看流量控制列表

GET /v2/{project_id}/apigw/instances/{instance_id}/throttles

apig:throttles:list

apig:instances:get

查看流量控制绑定的API列表

GET /v2/{project_id}/apigw/instances/{instance_id}/throttle-bindings/binded-apis

apig:throttles:listBindedApis

apig:instances:get

apig:throttles:get

查看流量控制未绑定的API列表

GET /v2/{project_id}/apigw/instances/{instance_id}/throttle-bindings/unbinded-apis

apig:throttles:listUnbindedApis

apig:instances:get

apig:throttles:get

更新流量控制

PUT

/V2/{project_id}/apigw/instances/{instance_id}/throttles/{throttle_id}

apig:throttles:update

apig:instances:get

创建特殊流量控制

POST /v2/{project_id}/apigw/instances/{instance_id}/throttles/{throttle_id}/throttle-specials

apig:specialThrottles:create

apig:instances:get

apig:throttles:get

删除特殊流量控制

DELETE /v2/{project_id}/apigw/instances/{instance_id}/throttles/{throttle_id}/throttle-specials/{strategy_id}

apig:specialThrottles:delete

apig:instances:get

apig:throttles:get

查看特殊流量控制

GET /v2/{project_id}/apigw/instances/{instance_id}/throttles/{throttle_id}/throttle-specials

apig:specialThrottles:get

apig:instances:get

apig:throttles:get

更新特殊流量控制

PUT

/{project_id}/apigw/instances/{instance_id}/throttles/{throttle_id}/throttle-specials/{strategy_id}

apig:specialThrottles:update

apig:instances:get

apig:throttles:get

创建负载通道

POST /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels

apig:vpcChannels:create

apig:instances:get

删除负载通道

DELETE /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels/{vpc_channel_id}

apig:vpcChannels:delete

apig:instances:get

更新负载通道

PUT /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels/{vpc_channel_id}

apig:vpcChannels:update

apig:instances:get

负载通道添加后端实例

POST /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels/{vpc_channel_id}/members

apig:vpcChannels:addInstance

apig:instances:get

apig:vpcChannels:get

删除后端实例

DELETE /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels/{vpc_channel_id}/members/{member_id}

apig:vpcChannels:deleteInstance

apig:instances:get

apig:vpcChannels:get

查看负载通道详情

GET /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels/{vpc_channel_id}

apig:vpcChannels:get

apig:instances:get

查看负载通道列表

GET /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels

apig:vpcChannels:list

apig:instances:get

更新VPC通道后端服务器组

PUT /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels/{vpc_channel_id}/member-groups/{member_group_id}

apig:vpcChannels:updateMemberGroup

apig:instances:get

apig:vpcChannels:get

添加或更新VPC通道后端服务器组

POST /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels/{vpc_channel_id}/member-groups

apig:vpcChannels:addOrUpdateMemberGroups

apig:instances:get

apig:vpcChannels:get

批量修改后端服务器状态不可用

POST /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels/{vpc_channel_id}/members/batch-disable

apig:vpcChannels:batchEnableInstance

apig:instances:get

apig:vpcChannels:get

删除VPC通道后端服务器组

DELETE /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels/{vpc_channel_id}/member-groups/{member_group_id}

apig:vpcChannels:deleteMemberGroup

apig:instances:get

apig:vpcChannels:get

批量修改后端服务器状态可用

POST /v2/{project_id}/apigw/instances/{instance_id}/vpc-channels/{vpc_channel_id}/members/batch-enable

apig:vpcChannels:batchDisableInstance

apig:instances:get

apig:vpcChannels:get

创建自定义认证

POST /v2/{project_id}/apigw/instances/{instance_id}/authorizers

apig:authorizers:create

functiongraph:function:getConfig

apig:instances:get

删除自定义认证

DELETE /v2/{project_id}/apigw/instances/{instance_id}/authorizers/{authorizer_id}

apig:authorizers:delete

apig:instances:get

查看自定义认证详情

GET /v2/{project_id}/apigw/instances/{instance_id}/authorizers/{authorizer_id}

apig:authorizers:get

apig:instances:get

查看自定义认证列表

GET /v2/{project_id}/apigw/instances/{instance_id}/authorizers

apig:authorizers:list

apig:instances:get

更新自定义认证

PUT

/V2/{project_id}/apigw/instances/{instance_id}/authorizers/{authorizer_id}

apig:authorizers:update

apig:instances:get

查看标签列表

GET /v2/{project_id}/apigw/instances/{instance_id}/tags

apig:tags:list

apig:instances:get

查看实例特性列表

GET /v2/{project_id}/apigw/instances/{instance_id}/features

apig:features:list

apig:instances:get

创建实例特性

POST /v2/{project_id}/apigw/instances/{instance_id}/features

apig:features:create

apig:instances:get

查看监控数据

GET /v2/{project_id}/apigw/instances/{instance_id}/metric-data

apig:metricData:get

apig:instances:get

创建网关响应

POST

/V2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/gateway-responses

apig:gatewayResponses:create

apig:instances:get

apig:groups:get

查看网关响应

GET

/V2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/gateway-responses/{response_id}

apig:gatewayResponses:get

apig:instances:get

apig:groups:get

更新网关响应

PUT

/V2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/gateway-responses/{response_id}

apig:gatewayResponses:update

apig:instances:get

apig:groups:get

删除网关响应

DELETE

/V2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/gateway-responses/{response_id}

apig:gatewayResponses:delete

apig:instances:get

apig:groups:get

查看网关响应列表

GET

/V2/{project_id}/apigw/instances/{instance_id}/api-groups/{group_id}/gateway-responses

apig:gatewayResponses:list

apig:instances:get

apig:groups:get

创建应用的AppCode

POST /v2/{project_id}/apigw/instances/{instance_id}/apps/{app_id}/app-codes

apig:appCodes:create

apig:instances:get

apig:apps:get

查看应用的AppCode列表

GET /v2/{project_id}/apigw/instances/{instance_id}/apps/{app_id}/app-codes

apig:appCodes:list

apig:instances:get

apig:apps:get

查看应用的AppCode

GET /v2/{project_id}/apigw/instances/{instance_id}/apps/{app_id}/app-codes/{app_code_id}

apig:appCodes:get

apig:instances:get

apig:apps:get

更新应用的AppCode

PUT

/V2/{project_id}/apigw/instances/{instance_id}/apps/{app_id}/app-codes

apig:appCodes:update

apig:instances:get

apig:apps:get

删除应用的AppCode

DELETE /v2/{project_id}/apigw/instances/{instance_id}/apps/{app_id}/app-codes/{app_code_id}

apig:appCodes:delete

apig:instances:get

apig:apps:get

创建插件

POST /v2/{project_id}/apigw/instances/{instance_id}/plugins

apig:plugins:create

apig:instances:get

更新插件

PUT

/V2/{project_id}/apigw/instances/{instance_id}/plugins/{plugin_id}

apig:plugins:update

apig:instances:get

查看插件列表

GET /v2/{project_id}/apigw/instances/{instance_id}/plugins

apig:plugins:list

apig:instances:get

查看插件绑定的API列表

GET /v2/{project_id}/apigw/instances/{instance_id}/plugins/{plugin_id}/attached-apis

apig:plugins:listBindedApis

apig:instances:get

apig:plugins:get

查看插件

GET /v2/{project_id}/apigw/instances/{instance_id}/plugins/{plugin_id}

apig:plugins:get

apig:instances:get

查看插件未绑定的API列表

GET /v2/{project_id}/apigw/instances/{instance_id}/plugins/{plugin_id}/attachable-apis

apig:plugins:listUnbindedApis

apig:instances:get

apig:plugins:get

删除插件

DELETE /v2/{project_id}/apigw/instances/{instance_id}/plugins/{plugin_id}

apig:plugins:delete

apig:instances:get