すべてのプロダクト
Search
ドキュメントセンター

:API Gateway と RAM

最終更新日:Mar 20, 2020

API Gateway および Resource Access Management(RAM) を連携し、企業内の複数の従業員が権限に基づいた API 管理ができます。 API プロバイダは、従業員のためのサブアカウントを作成し、それぞれの従業員に別々の API を管理できるようにすることができます。

  • RAM を使用することで、従業員はサブアカウントを使用して、API グループ、API、承認、およびスロットリング ポリシーを作成、表示、管理、および削除できます。 ただし、サブアカウントはリソースのオーナーではなく、操作権限をいつでもプライマリ アカウントに取り消される可能性があります。
  • 本ドキュメントを読む前に、必ず RAM ヘルプ マニュアル および API Gateway の API マニュアルに注意深く目を通しておきます。
  • 上述のサービス シナリオのニーズがない場合は、このセクションをスキップします。

RAM コンソール または API で操作を追加します。

パート 1: ポリシー管理

認証ポリシー(Policy)は、認証内容の記述です。 内容には、効果、リソース、アクション、条件といった、いくつかの基本的な要素が含まれます。

システム認証ポリシー

API Gateway には、AliyunApiGatewayFullAccess および AliyunApiGatewayReadOnlyAccess の 2 つのシステム権限が予め設定されています。権限の確認方法は、 RAM コンソール ポリシー管理をご参照ください 。!system preset

  • AliyunApiGatewayFullAccess:API グループ、API、スロットリング ポリシー、アプリなど、プライマリアカウントのすべてのリソースを管理するために使用する管理者権限です。
  • AliyunApiGatewayReadOnlyAccess:API グループ、API、スロットリング ポリシー、アプリなど、プライマリアカウントのすべてのリソースを表示するのに使用しますが、リソースを操作することはできません。

カスタム認証ポリシー

必要に応じて操作またはリソースの管理権限を詳細にカスタマイズできます。 たとえば、API GetUsers の編集権限をカスタマイズできます。 定義されたカスタム認証は、RAM コンソール ポリシー管理-カスタマイズ権限付与ポリシーで確認できます。カスタム認証を表示、作成、変更、および削除する方法の詳細は、認証ポリシーの管理をご参照ください。

認証ポリシーのコンテンツの入力方法の詳細は、ポリシーの基本要素ポリシーの構文構造および以下のように記述されている認証ポリシーをご参照ください。

パート 2: 承認ポリシー

承認ポリシーは、ポリシー言語で記述された一連の権限です。 承認ポリシーがユーザーまたはグループに関連付けらると、ユーザーまたはグループ内のすべてのユーザーは、ポリシーで指定されたアクセス権限を取得できます。
承認ポリシーのコンテンツを入力する方法の詳細は、ポリシーのベーシック要素 および ポリシー構文の構造をご参照ください。

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

すべてのビュー操作が認証されている例です。

アクション(アクション名リスト)形式

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

以下のとおりです。

  • service-nameは、プロダクト名を示します。 このパラメーターを apigateway に設定します。
  • action-nameは API 名を示します。 下表を参照。 ワイルドカード*も入力できます。
  1. "Action": "apigateway:Describe*" は、すべての照会操作を示します。
  2. " Action": "apigateway:*" は、API Gateway のすべての操作を示します。

パート 3: リソース(操作オブジェクトリスト)

リソースは、通常、API グループ、スロットリング ポリシー、および API Gateway のアプリであるアクション オブジェクトを示します。 形式は次のとおりです。

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

以下のとおりです。

  • acsは Alibaba Cloud Service の頭文字をとったもので、Alibaba Cloud のパブリック クラウド プラットフォームを表します。
  • service-name は、プロダクト名を示します。 このパラメーターは apigateway と設定します。
  • region はリージョンを表します。 ワイルドカード*を入力するとすべてのリージョンを示します。
  • account-id は、1234567890123456 といったアカウント ID を示します。 ワイルドカード*も入力できます。
  • relative-id は、API Gateway に関連するリソースの詳細を示します。 形式は、ファイルパスの木構造に似ています。

例:

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

書き出し:

  1. acs:apigateway:*:$accountid:apigroup/
アクション名 リソース
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