使用 IAM 进行访问权限控制
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本文档介绍 Pub/Sub Lite 的访问权限控制选项。Pub/Sub Lite 使用 Identity and Access Management 进行访问权限控制。
要向用户或应用授予 Pub/Sub Lite 资源的访问权限,请向应用使用的用户或服务账号授予至少一个预定义或自定义角色。这些角色包括对 Pub/Sub Lite 资源执行特定操作的权限。
预定义角色
下表列出了可让您访问 Pub/Sub Lite 资源的预定义角色:
角色 |
名称 |
说明 |
权限 |
roles/pubsublite.admin |
Pub/Sub Lite Admin
|
拥有精简版主题和精简版订阅的完全访问权限。 |
pubsublite.*
|
|
roles/pubsublite.editor |
Pub/Sub Lite Editor
|
修改精简版主题和精简版订阅,向精简版主题发布消息,以及接收来自精简版订阅的消息。 |
pubsublite.*
|
roles/pubsublite.publisher |
Pub/Sub Lite Publisher
|
向精简版主题发布消息。 |
pubsublite.topics.getPartitions
pubsublite.topics.publish
pubsublite.locations.openKafkaStream
|
roles/pubsublite.subscriber |
Pub/Sub Lite Subscriber
|
从精简版订阅接收消息。 |
pubsublite.operations.get
pubsublite.subscriptions.getCursor
pubsublite.subscriptions.seek
pubsublite.subscriptions.setCursor
pubsublite.subscriptions.subscribe
pubsublite.topics.computeHeadCursor
pubsublite.topics.computeMessageStats
pubsublite.topics.computeTimeCursor
pubsublite.topics.getPartitions
pubsublite.topics.subscribe
pubsublite.locations.openKafkaStream
|
roles/pubsublite.viewer |
Pub/Sub Lite Viewer
|
查看精简版主题和精简版订阅。 |
pubsublite.operations.get
pubsublite.operations.list
pubsublite.subscriptions.get
pubsublite.subscriptions.getCursor
pubsublite.subscriptions.list
pubsublite.topics.get
pubsublite.topics.getPartitions
pubsublite.topics.list
pubsublite.topics.listSubscriptions
|
自定义角色
自定义角色可以包含您指定的任何权限。您可以创建包含执行特定管理操作权限的自定义角色,例如更新精简版主题或删除精简版订阅。如需创建自定义角色,请参阅创建和管理自定义角色。
下表列出了自定义角色示例:
说明 |
权限 |
创建和管理精简版预留。 |
pubsublite.reservations.create
pubsublite.reservations.update
pubsublite.reservations.get
pubsublite.reservations.list
pubsublite.reservations.delete
|
创建和管理精简版主题。 |
pubsublite.topics.create
pubsublite.topics.update
pubsublite.topics.get
pubsublite.topics.getPartitions
pubsublite.topics.list
pubsublite.topics.listSubscriptions
pubsublite.topics.delete
|
创建和管理精简版订阅。 |
pubsublite.subscriptions.create
pubsublite.topics.subscribe
pubsublite.subscriptions.update
pubsublite.subscriptions.get
pubsublite.subscriptions.list
pubsublite.subscriptions.delete
|
创建精简版主题和精简版订阅。 |
pubsublite.topics.create
pubsublite.subscriptions.create
pubsublite.topics.subscribe
|
修改精简版主题和精简版订阅。 |
pubsublite.topics.update
pubsublite.subscriptions.update
|
删除精简版主题和精简版订阅。 |
pubsublite.topics.delete
pubsublite.subscriptions.delete
|
授予角色
您可以授予角色在项目级层访问 Pub/Sub Lite 资源的权限。例如,您可以授予服务账号查看项目中的任何精简版主题的权限,但无法授予服务账号查看单个精简版主题的权限。
如需授予项目角色,您可以使用 Google Cloud 控制台或 Google Cloud CLI。
控制台
如需向用户、服务账号或其他成员授予角色,请按以下步骤操作:
- 在 Google Cloud 控制台中,前往 IAM 页面。
转到 IAM
点击添加。
输入用户、服务账号或其他成员的电子邮件地址。
选择角色。
点击保存。
您还可以获取当前 IAM 政策的 JSON 或 YAML 文件,向该文件添加多个角色或成员,然后更新该政策。如需读取和管理政策,请使用 Google Cloud CLI、IAM API 或 IAM。如需了解详情,请参阅以编程方式控制访问权限。
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-01-30。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-01-30。"],[],[]]