閱讀1013 返回首頁    go iPhone_iPad_Mac_apple


使用RAM管理API__使用手冊(開放API)_API 網關-阿裏雲

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*"

表示所有的查詢操作

  1. " Action": "apigateway:*"

表示API網關所有操作

Resource(操作對象列表)

Resource通常指操作對象,API網關中的API分組、流控策略、應用都被稱為Resource,書寫格式:

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

其中:

  • acs: Aliyun 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

最後更新:2016-12-06 14:07:00

  上一篇:go OpenID Connect認證__使用手冊(開放API)_API 網關-阿裏雲
  下一篇:go 創建API分組__快速入門(開放API)_API 網關-阿裏雲