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 产品。 如果您在未使用 Spaces 的情况下使用 Apigee,系统会将权限应用于 Google Cloud 项目,该项目与 Apigee 组织资源直接相关。因此,除了直接应用于特定资源的所有政策之外,管理对给定 API 代理、共享流或 API 产品的访问权限的 IAM 政策还包括从组织继承的所有政策。

包含聊天室的资源和权限层次结构

将 Apigee 与 Spaces 搭配使用时,系统会将 Space 资源添加到层次结构中。 假设某个 Apigee 组织有三个 API 代理:proxy-aproxy-bproxy-c。 在此示例中,proxy-bproxy-c 分别与 space-redspace-blue 相关联。将 API 资源与聊天室相关联后,系统会在资源上设置 space 属性。

当您发出 API 调用以获取 proxy-c 的详细信息时,API 端点会反映实际的资源层次结构,其中 API 代理是具有聊天室属性的组织的子级,如以下示例所示:

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/$API 上的 apigee.deployments.list
organizations.apis.revisions.deployments.list organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REV 上的 apigee.deployments.list
organizations.environments.deployments.list 无任何更改
organizations.environments.deployments.get 无任何更改
organizations.environments.apis.deployments.list organizations/$ORG/environments/$ENV 上的 apigee.deployments.list

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

organizations.environments.apis.revisions.deployments.get organizations/$ORG/environments/$ENV 上的 apigee.deployments.get

organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REV 上的 apigee.deployments.get

organizations.environments.apis.revisions.deployments.deploy organizations/$ORG/environments/$ENV 上的 apigee.deployments.create

AND

organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REV 上的 apigee.proxyrevisions.deploy

organizations.environments.apis.revisions.deployments.generateDeployChangeReport organizations/$ORG/environments/$ENV 上的 apigee.deployments.create

AND

organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REV 上的 apigee.proxyrevisions.deploy

organizations.environments.apis.revisions.deployments.generateUndeployChangeReport organizations/$ORG/environments/$ENV 上的 apigee.deployments.delete

AND

organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REV 上的 apigee.proxyrevisions.undeploy

organizations.environments.apis.revisions.deployments.undeploy organizations/$ORG/environments/$ENV 上的 apigee.deployments.delete

AND

organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REV 上的 apigee.proxyrevisions.undeploy

organizations.environments.sharedflows.deployments.list organizations/$ORG/environments/$ENV 上的 apigee.deployments.list

organizations/$ORG/spaces/$SPACE/sharedflows/$SF 上的 apigee.deployments.list
organizations.environments.sharedflows.revisions.deployments.deploy organizations/$ORG/environments/$ENV 上的 apigee.deployments.create

AND

organizations/$ORG/spaces/$SPACE/sharedflow/$SF/revisions/$REV 上的 apigee.sharedflowrevisions.deploy

organizations.environments.sharedflows.revisions.deployments.get organizations/$ORG/environments/$ENV 上的 apigee.deployments.get

apigee.deployments.get 在以下平台上受限:

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

organizations.environments.sharedflows.revisions.deployments.undeploy organizations/$ORG/environments/$ENV 上的 apigee.deployments.delete

AND

organizations/$ORG/spaces/$SPACE/sharedflow/$SF/revisions/$REV 上的 apigee.sharedflowrevisions.undeploy

organizations.sharedflows.deployments.list
organizations/$ORG/spaces/$SPACE/sharedflows/$SF 上的 apigee.deployments.list
organizations.sharedflows.revisions.deployments.list
organizations/$ORG/spaces/$SPACE/sharedflows/$SF/revisions/$REV 上的 apigee.deployments.list

调试会话的权限检查

如果 API 代理与聊天室相关联,则代理调试会话的 IAM 权限检查已发生变化,如下表所示:

方法 聊天室 IAM 权限检查
organizations.environments.apis.revisions.debugsessions.create organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REV 上的 apigee.tracesessions.create

AND

organizations/$ORG/environments/$ENV

organizations.environments.apis.revisions.debugsessions.get organizations/$ORG/environments/$ENV
上执行 apigee.tracesessions.get AND organizations/$ORG/spaces/$SPACE/apis/$API
organizations.environments.apis.revisions.debugsessions.deleteData organizations/$ORG/environments/$ENV
执行 apigee.tracesessions.delete

apigee.tracesessions.delete 权限

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

organizations.environments.apis.revisions.debugsessions.list organizations/$ORG/environments/$ENV 上的 apigee.tracesessions.list

organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REV 上的 apigee.tracesessions.list

organizations.environments.apis.revisions.debugsessions.data.get organizations/$ORG/environments/$ENV 上的 apigee.tracesessions.get

AND

organizations/$ORG/spaces/$SPACE/apis/$API/revisions/$REV 上的 apigee.tracesessions.get

organizations.environments.apis.revisions.debugsessions.data.list organizations/$ORG/environments/$ENV 上的 apigee.tracesessions.get

AND

organizations/$ORG/spaces/$SPACE/apis/$API 上的 apigee.tracesessions.get