API Gateway API 存取權總覽

本頁面說明 API Gateway 中可用的 API 存取權控管選項。

總覽

API Gateway 會使用身分與存取權管理 (IAM) 控管 API 存取權。您可以在專案層級和服務消費者層級授予 API 存取權。舉例來說,您可以執行下列操作:

  • 將存取權授予您的 API 使用者,讓他們能在自己的Google Cloud 專案中啟用您的 API。
  • 允許使用者檢視所有 API Gateway 資源。
  • 允許使用者建立、更新或刪除 API Gateway 資源。

控管服務和資源存取權的角色

您可以使用 Google Cloud 主控台的「API Gateway」 >「API」或「Gateway」詳細資料頁面中的權限面板,查看及授予角色。您也可以使用 API 或 Google Cloud CLI 授予角色。

IAM 角色名稱 角色稱號 說明
roles/servicemanagement.serviceConsumer 服務消費者 授予 Google 帳戶、Google 群組或服務帳戶的權限,可讓他們在自己的專案中查看及啟用 API。如需這個角色的相關資訊,請參閱 Service Management API 存取權控管主題。
roles/apigateway.viewer API Gateway Viewer 具備 API Gateway 和相關資源的唯讀存取權。這個角色包含取得及列出 API、API 設定、閘道和位置的權限。
roles/apigateway.admin API Gateway Admin 具備 API 閘道及其相關資源的完整存取權。這個角色包含取得、建立、更新及刪除 API、API 設定、閘道和位置的權限。

API Gateway 權限和角色

下表列出可授予 API Gateway 資源存取權的專案層級角色,以及相關權限:

角色 權限
API Gateway Viewer apigateway.apiconfigs.get
apigateway.apiconfigs.getIamPolicy
apigateway.apiconfigs.list
apigateway.apis.get
apigateway.apis.getIamPolicy
apigateway.apis.list
apigateway.gateways.get
apigateway.gateways.getIamPolicy
apigateway.gateways.list
apigateway.locations.get
apigateway.locations.list
apigateway.operations.get
apigateway.operations.list
resourcemanager.projects.get
resourcemanager.projects.list
API Gateway Admin API Gateway Viewer 角色包含的所有權限,加上:
apigateway.apiconfigs.create
apigateway.apiconfigs.delete
apigateway.apiconfigs.setIamPolicy
apigateway.apiconfigs.update
apigateway.apis.create
apigateway.apis.delete
apigateway.apis.setIamPolicy
apigateway.apis.update
apigateway.gateways.create
apigateway.gateways.delete
apigateway.gateways.setIamPolicy
apigateway.gateways.update
apigateway.operations.cancel
apigateway.operations.delete

自訂角色

如果基本角色或預先定義角色無法滿足您的特定需求,API Gateway 支援使用自訂角色。您可以使用 IAM 為 API Gateway 建立自訂角色