本頁內容適用於 Apigee 和 Apigee Hybrid。
查看
Apigee Edge 說明文件。
本頁面說明使用 Apigee Spaces 時,身分與存取權管理 (IAM) 權限階層如何套用至 Apigee API 資源 (API Proxy、共用流程和 API 產品) 及其子項。
IAM 與 Apigee Spaces 的互動
一般來說,控管資源存取權的 IAM 政策會透過 Google Cloud 資源階層繼承。套用至特定資源的具體 IAM 政策包括:
- 直接套用至資源的任何政策
- 資源從祖先繼承的任何政策
Apigee 中的資源和權限階層
在 Apigee 中,資源階層的最上層是機構資源。機構的子項資源包括 API Proxy、共用流程和 API 產品。如果您使用 Apigee 而不使用 Spaces,權限會套用至 Google Cloud 專案,這與 Apigee 機構資源直接相關。因此,管理特定 API Proxy、共用流程或 API 產品存取權的 IAM 政策,除了直接套用至特定資源的政策外,也包含從機構繼承的任何政策。
聊天室的資源和權限階層
將 Apigee 與 Spaces 搭配使用時,系統會將 Space 資源新增至階層。假設 Apigee 機構有三個 API Proxy:proxy-a
、proxy-b
和 proxy-c
。在本例中,proxy-b
和 proxy-c
分別與 space-red
和 space-blue
相關聯。將 API 資源與 Space 建立關聯時,系統會在資源上設定 space
屬性。
當您發出 API 呼叫來取得 proxy-c
的詳細資料時,API 端點會反映實際的資源階層,其中 API 代理程式是具有 Space 屬性的機構的子項,如下例所示:
curl -X GET -H "Authorization: Bearer $TOKEN" "https://apigee.googleapis.com/v1/organizations/org1/apis/proxy-c" { "metaData": { "createdAt": "1725665197737", "lastModifiedAt": "1725665462105", "subType": "Proxy" }, "name": "proxy-c", "revision": [ "1" ], "apiProxyType": "PROGRAMMABLE", "space": "space-blue" }
雖然與 Space 相關聯的 API 資源路徑維持不變,但有效的 IAM 權限階層會變更。 在我們的範例情境中,IAM 權限檢查的行為會如同 API 資源是 Space 的子項。因此,套用至 API 資源的 IAM 政策包括從空間繼承的政策,以及直接套用至空間的政策,如下圖所示:

檢查 Space 資源的 IAM 政策
如先前章節所述,當 API Proxy、共用流程和 API 產品與「空間」建立關聯時,在 IAM 政策檢查期間,這些項目會視為「空間」的子項資源。這個有效資源階層適用於 API Proxy、共用流程和 API 產品的所有子項。
舉例來說,API 產品屬性是 API 產品的子項資源。如要列出與 Apigee 空間 space-blue
相關聯的 Apigee 機構 org1
中,API 產品 product-a
的所有屬性,實際資源路徑為 GET organizations/org1/apiproduct/product-a/attributes
。不過,檢查 IAM 權限的路徑是 organizations/org1/spaces/space-blue/apiproduct/product-a/attributes
。
部署作業的身分與存取權管理政策檢查
「環境」資源未與 Spaces 建立關聯。不過,我們已更新部分現有 API,可針對 API Proxy 和共用流程,提供部署項目和偵錯工作階段的精細存取權。
以下說明對 Space 中資源進行下列部署作業時,身分與存取權管理權限檢查的變更:
方法 | 檢查空間 IAM 權限 |
---|---|
organizations.deployments.list | 沒有變更 |
organizations.apis.deployments.list | apigee.deployments.list on organizations/$ORG/spaces/$SPACE/apis/$API
|
organizations.apis.revisions.deployments.list | apigee.deployments.list on organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REV
|
organizations.environments.deployments.list | 沒有變更 |
organizations.environments.deployments.get | 沒有變更 |
organizations.environments.apis.deployments.list | organizations/$ORG/environments/$ENV 上的 apigee.deployments.list「或」
|
organizations.environments.apis.revisions.deployments.get | apigee.deployments.get on organizations/$ORG/environments/$ENV
「或」
apigee.deployments.get ( |
organizations.environments.apis.revisions.deployments.deploy | apigee.deployments.create on organizations/$ORG/environments/$ENV
AND
apigee.proxyrevisions.deploy on |
organizations.environments.apis.revisions.deployments.generateDeployChangeReport | apigee.deployments.create on organizations/$ORG/environments/$ENV
AND
apigee.proxyrevisions.deploy on |
organizations.environments.apis.revisions.deployments.generateUndeployChangeReport | apigee.deployments.delete on organizations/$ORG/environments/$ENV
AND
apigee.proxyrevisions.undeploy on |
organizations.environments.apis.revisions.deployments.undeploy | apigee.deployments.delete on organizations/$ORG/environments/$ENV
AND
apigee.proxyrevisions.undeploy on |
organizations.environments.sharedflows.deployments.list | apigee.deployments.list on organizations/$ORG/environments/$ENV OR apigee.deployments.list on organizations/$ORG/spaces/$SPACE/sharedflows/$SF
|
organizations.environments.sharedflows.revisions.deployments.deploy | apigee.deployments.create on organizations/$ORG/environments/$ENV
AND
apigee.sharedflowrevisions.deploy on |
organizations.environments.sharedflows.revisions.deployments.get | apigee.deployments.get (organizations/$ORG/environments/$ENV )
或 apigee.deployments.get on
|
organizations.environments.sharedflows.revisions.deployments.undeploy | apigee.deployments.delete on organizations/$ORG/environments/$ENV
AND
apigee.sharedflowrevisions.undeploy on |
organizations.sharedflows.deployments.list | apigee.deployments.list onorganizations/$ORG/spaces/$SPACE/sharedflows/$SF
|
organizations.sharedflows.revisions.deployments.list | apigee.deployments.list onorganizations/$ORG/spaces/$SPACE/sharedflows/$SF/revisions/$REV
|
偵錯工作階段的權限檢查
如果 API Proxy 與 Space 相關聯,Proxy 偵錯工作階段的身分與存取權管理權限檢查就會變更,如下表所示:
方法 | 空間 IAM 權限檢查 |
---|---|
organizations.environments.apis.revisions.debugsessions.create | apigee.tracesessions.create on organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REV
AND
|
organizations.environments.apis.revisions.debugsessions.get | apigee.tracesessions.get on organizations/$ORG/environments/$ENV AND organizations/$ORG/spaces/$SPACE/apis/$API
|
organizations.environments.apis.revisions.debugsessions.deleteData | organizations/$ORG/environments/$ENV 的 apigee.tracesessions.delete AND apigee.tracesessions.delete
|
organizations.environments.apis.revisions.debugsessions.list | apigee.tracesessions.list (位於 organizations/$ORG/environments/$ENV
「或」
apigee.tracesessions.list,位於 |
organizations.environments.apis.revisions.debugsessions.data.get | apigee.tracesessions.get on organizations/$ORG/environments/$ENV
AND
apigee.tracesessions.get on |
organizations.environments.apis.revisions.debugsessions.data.list | apigee.tracesessions.get on organizations/$ORG/environments/$ENV
AND
apigee.tracesessions.get on |