API 网关结合阿里云访问控制(RAM)来实现企业内多职员分权管理 API。API 提供者可以为员工建立子账户,并控制不同职员负责不同的 API 管理。

  • 使用 RAM 可以允许子帐号,查看、创建、管理、删除 API 分组、API、授权、流控策略等。但子帐号不是资源的所有者,其操作权限随时都可以被主帐号收回。
  • 在查看本文前,请确保您已经祥读了 RAM 帮助手册 和API 网关 API 手册.
  • 若您不无此业务场景, 请跳过此章节。

你可以使用 RAM 的控制台 或者API来添加操作。

第一部分:策略管理

授权策略(Policy),来描述授权的具体内容,授权内容主要包含效力( Effect )、资源( Resource )、对资源所授予的操作权限( Action )以及限制条件( Condition )这几个基本元素。

系统授权策略

API 网关已经预置了两个系统权限,AliyunApiGatewayFullAccess和AliyunApiGatewayReadOnlyAccess,可以到 RAM 的在 RAM 控制台-策略管理进行查看。

  • AliyunApiGatewayFullAccess: 管理员权限,拥有主帐号下包含 API 分组、API、流控策略、应用等所有资源的管理权限。
  • AliyunApiGatewayReadOnlyAccess:可以查看主帐号下包含 API 分组、API、流控策略、应用等所有资源,但不可以操作。

自定义授权策略

您可以根据需要自定义管理权限,支持更为精细化的授权,可以为某个操作,也可以是某个资源。如:API GetUsers 的编辑权限。可以在RAM 控制台-策略管理-自定义授权策略查看已经定义好的自定义授权:自定义授权查看、创建、修改、删除方法请参照:授权策略管理
授权策略内容填写方法请参照:Policy 基本元素Policy 语法结构和下文的授权策略。

第二部分:授权策略

授权策略是一组权限的集合,它以一种策略语言来描述。通过给用户或群组附加授权策略,用户或群组中的所有用户就能获得授权策略中指定的访问权限。
授权策略内容填写方法请参照:Policy 基本元素和 Policy 语法结构
示例:

  1. {
  2. "Version": "1",
  3. "Statement": [
  4. {
  5. "Action": "apigateway:Describe*",
  6. "Resource": "*",
  7. "Effect": "Allow"
  8. }
  9. ]
  10. }

此示例表示:允许所有的查看操作

Action(操作名称列表)格式为:

  1. "Action":"<service-name>:<action-name>"

其中:

  • service-name 为:阿里云产品名称,请填写 apigateway
  • action-name 为:API 接口名称,请参照下表, 支持通配符 *
  1. "Action": "apigateway:Describe*" 表示所有的查询操作
  2. " Action": "apigateway:*" 表示 API 网关所有操作

第三部分:Resource(操作对象列表)

Resource 通常指操作对象, API 网关中的 API 分组、流控策略、应用都被称为 Resource,书写格式:

  1. acs:<service-name>:<region>:<account-id>:<relative-id>

其中:

  • acs: Alibaba Cloud Service 的首字母缩写,表示阿里云的公有云平台
  • service-name 为:阿里云产品名称,请填写 apigateway
  • region: 地区信息,可以使用通配符*号来代替,*表示所有区域
  • account-id: 账号 ID,比如 1234567890123456,也可以用*代替
  • relative-id: 与 API 网关相关的资源描述部分,这部分的格式描述支持类似于一个文件路径的树状结构。

示例:

  1. acs:apigateway:$regionid:$accountid:apigroup/$groupId

书写:

  1. acs:apigateway:*:$accountid:apigroup/

请结合 API 网关的API 手册来查看下表

action-name 资源( Resource )
AbolishApi acs:apigateway:$regionid:$accountid:apigroup/$groupId
AddTrafficSpecialControl acs:apigateway:$regionid:$accountid:trafficcontrol/$trafficcontrolid
CreateApi acs:apigateway:$regionid:$accountid:apigroup/$groupId
CreateApiGroup acs:apigateway:$regionid:$accountid:apigroup/*
CreateTrafficControl acs:apigateway:$regionid:$accountid:trafficcontrol/*
DeleteAllTrafficSpecialControl acs:apigateway:$regionid:$accountid:trafficcontrol/$trafficcontrolid
DeleteApi acs:apigateway:$regionid:$accountid:apigroup/$groupId
DeleteApiGroup acs:apigateway:$regionid:$accountid:apigroup/$groupId
DeleteDomain acs:apigateway:$regionid:$accountid:apigroup/$groupId
DeleteDomainCertificate acs:apigateway:$regionid:$accountid:apigroup/$groupId
DeleteTrafficControl acs:apigateway:$regionid:$accountid:trafficcontrol/$trafficcontrolId
DeleteTrafficSpecialControl acs:apigateway:$regionid:$accountid:trafficcontrol/$trafficcontrolId
DeployApi acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeApi acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeApiError acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeApiGroupDetail acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeApiGroups acs:apigateway:$regionid:$accountid:apigroup/*
DescribeApiLatency acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeApiQps acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeApiRules acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeApis acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeApisByRule acs:apigateway:$regionid:$accountid:trafficcontrol/$trafficcontrolId oracs:apigateway:$regionid:$accountid:secretkey/$secretKeyId
DescribeApiTraffic acs:apigateway:$regionid:$accountid:apigroup/$groupid
DescribeAppsByApi acs:apigateway:$regionid:$accountid:apigroup/$groupId
AddBlackList acs:apigateway:$regionid:$accountid:blacklist/*
DescribeBlackLists acs:apigateway:$regionid:$accountid:blacklist/*
DescribeDeployedApi acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeDeployedApis acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeDomain acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeDomainResolution acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeHistoryApi acs:apigateway:$regionid:$accountid:apigroup/$groupId
DescribeHistoryApis acs:apigateway:$regionid:$accountid:apigroup/*
DescribeRulesByApi acs:apigateway:$regionid:$accountid:group/$groupId
DescribeSecretKeys acs:apigateway:$regionid:$accountid:secretkey/*
DescribeTrafficControls acs:apigateway:$regionid:$accountid:trafficcontrol/*
ModifyApi acs:apigateway:$regionid:$accountid:apigroup/$groupId
ModifyApiGroup acs:apigateway:$regionid:$accountid:apigroup/$groupId
ModifySecretKey acs:apigateway:$regionid:$accountid:secretkey/$secretKeyId
RecoverApiFromHistorical acs:apigateway:$regionid:$accountid:apigroup/$groupId
RefreshDomain acs:apigateway:$regionid:$accountid:apigroup/$groupId
RemoveAccessPermissionByApis acs:apigateway:$regionid:$accountid:apigroup/$groupId
RemoveAccessPermissionByApps acs:apigateway:$regionid:$accountid:apigroup/$groupId
RemoveAllBlackList acs:apigateway:$regionid:$accountid:blacklist/*
RemoveApiRule acs:apigateway:$regionid:$accountid:apigroup/$groupId(acs:apigateway:$regionid:$accountid:secretkey/$secretKeyId oracs:apigateway:$regionid:$accountid:trafficcontrol/$trafficcontrolId)
RemoveAppsFromApi acs:apigateway:$regionid:$accountid:apigroup/$groupId
RemoveBlackList acs:apigateway:$regionid:$accountid:blacklist/$blacklistid
SetAccessPermissionByApis acs:apigateway:$regionid:$accountid:apigroup/$groupId
SetAccessPermissions acs:apigateway:$regionid:$accountid:apigroup/$groupId
SetApiRule acs:apigateway:$regionid:$accountid:apigroup/$groupId(acs:apigateway:$regionid:$accountid:secretkey/$secretKeyId oracs:apigateway:$regionid:$accountid:trafficcontrol/$trafficcontrolId)
SetDomain acs:apigateway:$regionid:$accountid:apigroup/$groupId
SetDomainCertificate acs:apigateway:$regionid:$accountid:apigroup/$groupId
SwitchApi acs:apigateway:$regionid:$accountid:apigroup/$groupId
CreateSecretKey acs:apigateway:$regionid:$accountid:secretkey/*
DeleteSecretKey acs:apigateway:$regionid:$accountid:secretkey/$secretKeyId

阿里云API网关(12)为员工创建子账号,实现分权管理API:使用RAM管理API的更多相关文章

  1. IPsecVPN:阿里云VPN网关和深信服防火墙打通公有云和公司内网

    简介 目前许多公司网络环境为混合云(私有云,IDC,公司内网融合)的状态,通过内网ip的访问使得工作更加方便,需求也更为迫切,而本文介绍的即是实现私有云和公司内网互通的一种方法,希望对有此需求的小伙伴 ...

  2. 阿里云 Server (Ubuntu 12.04) 配置 FTP

    来自 http://blog.csdn.net/zgrjkflmkyc/article/details/45510345 这个是阿里云的官方用户手册  http://bbs.aliyun.com/re ...

  3. 阿里云对象存储 OSS,不使用主账号,使用子账号来访问存储内容

    https://help.aliyun.com/document_detail/31932.html?spm=5176.doc31929.2.5.R7sEzr 这个示例从一个没有任何Bucket的阿里 ...

  4. 阿里云php-7.2.12 安装

    安装依赖 yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml ...

  5. 阿里云学习之API网关

    注:此处仅供api的创建做一个补充参考,API网关的优缺点及创建过程中的参数详情,请参考阿里云开放文档:https://helpcdn.aliyun.com/document_detail/29478 ...

  6. 阿里云API网关(11)API的三种安全认证方式

    网关指南: https://help.aliyun.com/document_detail/29487.html?spm=5176.doc48835.6.550.23Oqbl 网关控制台: https ...

  7. 阿里云API网关(9)常见问题

    网关指南: https://help.aliyun.com/document_detail/29487.html?spm=5176.doc48835.6.550.23Oqbl 网关控制台: https ...

  8. 阿里云API网关(7)开发指南-API参考

    网关指南: https://help.aliyun.com/document_detail/29487.html?spm=5176.doc48835.6.550.23Oqbl 网关控制台: https ...

  9. 阿里云API网关(6)用户指南(开放 API )

    网关指南: https://help.aliyun.com/document_detail/29487.html?spm=5176.doc48835.6.550.23Oqbl 网关控制台: https ...

随机推荐

  1. Hive数据仓库笔记(一)

    Hive建表: CREATE TABLE records (year STRING,temperature INT, quality INT) ROW FORMAT DELIMITED FIELDS ...

  2. A Proof of Stake Design Philosophy - PoS权益证明设计理念

    之前在EthFans上看到了关于PoS(权益证明)的相关文章(原文链接),本着学习的态度,对这篇文章进行了翻译.第一次翻译关于区块链的文章,有些单词及句子的措辞还不是很准确,如果发现有翻译的不恰当的地 ...

  3. Ext概述

    Ext是一个具有丰富组件的javascript集合类库,除了自身提供的一套选择器.效果.ajax等功能,还提供了大量的javascript创建页面元素的类.方法.这个意味着:只要客户端支持javasc ...

  4. Microsoft AI - Custom Vision

    概述 前几天的 Windows Developer Day 正式发布了 Windows AI Platform,而作为 Windows AI Platform 的模型定义和训练,更多还是需要借助云端来 ...

  5. Angular.js学习范例及笔记

    一.AngularJs 1.row in order.rows <ng-bind="row.name"> 2.ng-form <form action=" ...

  6. [POJ 3764] The xor-longest Path

    Description 多组数据 给你一颗树, 然后求一条最长异或路径, 异或路径长度定义为两点间简单路径上所有边权的异或和. Solution 首先 dfs 一遍,求出所有的点到根节点(随便选一个) ...

  7. Xss问题解决方案

    xss跨站脚本攻击问题最主要是呈现在html页面的脚本被执行导致的结果,可分为两个方便作屏蔽 后台屏蔽 在前端上传的各个参数后,对其进行转义后再保存至数据库,属于暴力式转义,一般不建议.下面是写的例子 ...

  8. 笔记:Maven 私服 Nexus 权限控制

    Nexus 用户 Nexus 预定义了三个用户,这三个用户对应了三个权限级别: admin:该用户拥有对Nexus服务的完全控制,默认密码为 admin123,以下为admin用户的角色树 deplo ...

  9. es6学习笔记--promise对象

    Promise对象是为了简化异步编程.解决回调地狱情况 Promise,简单说就是一个容器,里面保存着某个未来才会结束的事件(通常是一个异步操作)的结果.从语法上说,Promise 是一个对象,从它可 ...

  10. Docker 网络管理及容器跨主机通信

    1.网络模式 docker支持四种网络模式,使用--net选项指定: host,--net=host,如果指定此模式,容器将不会获得一个独立的network namespace,而是和宿主机共用一个. ...