Apigee 空间中的 IAM 权限层次结构

本页面适用于 ApigeeApigee Hybrid

查看 Apigee Edge 文档。

本页面介绍了在使用 Apigee 空间时,Identity and Access Management (IAM) 权限层次结构如何应用于 Apigee API 资源(API 代理、共享流和 API 产品)及其子资源。

IAM 与 Apigee 空间的交互

一般来说,控制资源访问权限的 IAM 政策会通过 Google Cloud 资源层次结构继承。应用给定资源的具体 IAM 政策包括以下两项政策:

  • 直接应用于资源的任何政策
  • 资源从其祖先继承的任何政策

Apigee 中的资源和权限层次结构

在 Apigee 中,资源层次结构的顶层是组织资源。组织的子资源包括 API 代理共享流API 产品。如果您在不使用空间的情况下使用 Apigee,则权限会应用于 Google Cloud 项目,该项目直接与 Apigee 组织资源相关联。因此,除了直接应用于特定资源的任何政策之外,管理对给定 API 代理、共享流或 API 产品访问权限的 IAM 政策还包括从组织继承的任何政策。

使用空间的资源和权限层次结构

将 Apigee 与空间搭配使用时,空间资源会添加到层次结构中。假设 Apigee 组织有三个 API 代理:proxy-aproxy-bproxy-c。在此示例中,proxy-bproxy-c 分别与 space-redspace-blue 相关联。将 API 资源与空间相关联后,系统会对该资源上设置 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"
}

虽然与空间关联的 API 资源的路径保持不变,但有效的 IAM 权限层次结构会更改。在我们的示例场景中,IAM 权限检查的行为方式就好像 API 资源是空间的子级一样。因此,应用于 API 资源的 IAM 政策包括从空间继承的政策,以及直接应用于空间的任何政策,如下图所示:

空间的 IAM 层次结构
图 1:使用空间时 API 资源的有效 IAM 权限层次结构

针对空间资源的 IAM 政策检查

如上一部分中所述,API 代理、共享流和 API 产品与空间相关联后,在 IAM 政策检查期间,它们会被视为空间的子资源。此有效资源层次结构适用于 API 代理、共享流和 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

针对部署的 IAM 政策检查

环境资源与空间无关联。不过,我们已更新一些现有 API,以便启用对 API 代理和共享流的部署和调试会话的精细访问权限。

下面介绍了对空间中资源的以下部署操作的 IAM 权限检查所做的更改:

方法 空间 IAM 权限检查
organizations.deployments.list 没有变化
organizations.apis.deployments.list 针对 organizations/$ORG/spaces/$SPACE/apis/$APIapigee.deployments.list
organizations.apis.revisions.deployments.list 针对 organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REVapigee.deployments.list
organizations.environments.deployments.list 没有变化
organizations.environments.deployments.get 没有变化
organizations.environments.apis.deployments.list 针对 organizations/$ORG/environments/$ENVapigee.deployments.list
或者

organizations/$ORG/spaces/$SPACE/apis/$API

organizations.environments.apis.revisions.deployments.get 针对 organizations/$ORG/environments/$ENVapigee.deployments.get

针对 organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REVapigee.deployments.get

organizations.environments.apis.revisions.deployments.deploy 针对 organizations/$ORG/environments/$ENVapigee.deployments.create

针对 organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REVapigee.proxyrevisions.deploy

organizations.environments.apis.revisions.deployments.generateDeployChangeReport 针对 organizations/$ORG/environments/$ENVapigee.deployments.create

针对 organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REVapigee.proxyrevisions.deploy

organizations.environments.apis.revisions.deployments.generateUndeployChangeReport 针对 organizations/$ORG/environments/$ENVapigee.deployments.delete

针对 organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REVapigee.proxyrevisions.undeploy

organizations.environments.apis.revisions.deployments.undeploy 针对 organizations/$ORG/environments/$ENVapigee.deployments.delete

针对 organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REVapigee.proxyrevisions.undeploy

organizations.environments.sharedflows.deployments.list 针对 organizations/$ORG/environments/$ENVapigee.deployments.list
或者
针对
organizations/$ORG/spaces/$SPACE/sharedflows/$SFapigee.deployments.list
organizations.environments.sharedflows.revisions.deployments.deploy 针对 organizations/$ORG/environments/$ENVapigee.deployments.create

针对 organizations/$ORG/spaces/$SPACE/sharedflow/$SF/revisions/$REVapigee.sharedflowrevisions.deploy

organizations.environments.sharedflows.revisions.deployments.get 针对 organizations/$ORG/environments/$ENVapigee.deployments.get

针对以下项的 apigee.deployments.get

organizations/$ORG/spaces/$SPACE/sharedflows/$SF/revisions/$REV

organizations.environments.sharedflows.revisions.deployments.undeploy 针对 organizations/$ORG/environments/$ENVapigee.deployments.delete

针对 organizations/$ORG/spaces/$SPACE/sharedflow/$SF/revisions/$REVapigee.sharedflowrevisions.undeploy

organizations.sharedflows.deployments.list 针对
organizations/$ORG/spaces/$SPACE/sharedflows/$SFapigee.deployments.list
organizations.sharedflows.revisions.deployments.list 针对
organizations/$ORG/spaces/$SPACE/sharedflows/$SF/revisions/$REVapigee.deployments.list

针对调试会话的权限检查

如果 API 代理与空间相关联,则表示该代理的调试会话的 IAM 权限检查已发生更改,如下表中所述:

方法 空间 IAM 权限检查
organizations.environments.apis.revisions.debugsessions.create 针对 organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REVapigee.tracesessions.create

organizations/$ORG/environments/$ENV

organizations.environments.apis.revisions.debugsessions.get 针对 organizations/$ORG/environments/$ENVapigee.tracesessions.get
organizations/$ORG/spaces/$SPACE/apis/$API
organizations.environments.apis.revisions.debugsessions.deleteData 针对 organizations/$ORG/environments/$ENVapigee.tracesessions.delete

针对以下项的 apigee.tracesessions.delete

organizations/$ORG/spaces/$SPACE/apis/$API

organizations.environments.apis.revisions.debugsessions.list 针对 organizations/$ORG/environments/$ENVapigee.tracesessions.list

针对 organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REVapigee.tracesessions.list

organizations.environments.apis.revisions.debugsessions.data.get 针对 organizations/$ORG/environments/$ENVapigee.tracesessions.get

针对 organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REVapigee.tracesessions.get

organizations.environments.apis.revisions.debugsessions.data.list 针对 organizations/$ORG/environments/$ENVapigee.tracesessions.get

针对 organizations/$ORG/spaces/$SPACE/apis/$APIapigee.tracesessions.get