本页介绍了如何使用 Identity and Access Management (IAM) 角色和权限来控制对资源中的 Error Reporting 数据的访问权限。 Google Cloud
概览
IAM 权限和角色决定了您能否通过 Error Reporting API 和 Google Cloud 控制台访问数据。
如需在 Google Cloud 资源(例如 Google Cloud 项目、文件夹或组织)中使用 Error Reporting,您必须获得该资源的 IAM 角色。此角色必须包含适当的权限。
一个角色对应一组权限。您不能直接向主账号授予权限,而是需要向主账号授予角色。为主账号授予一个角色就是授予该角色包含的所有权限。您可以为同一主账号授予多个角色。
预定义角色
IAM 提供预定义角色,可让您授予对特定 Google Cloud 资源 Google Cloud 的精细访问权限。IAM 会创建和维护这些角色,并根据需要自动更新其权限,例如 Error Reporting 添加新功能时。
下表列出了 Error Reporting 角色、角色名称、角色说明、包含的权限以及可设置这些角色的最低级层的资源类型。您可以针对此资源类型授予特定角色,或者在大多数情况下可以针对它在 Google Cloud 层次结构中的任何上级类型授予特定角色。
如需获取角色中包含的各个权限的列表,请参阅获取角色元数据。
Role | Permissions |
---|---|
Error Reporting Admin Beta( Provides full access to Error Reporting data. Lowest-level resources where you can grant this role:
|
|
Error Reporting User Beta( Provides the permissions to read and write Error Reporting data, except for sending new error events. Lowest-level resources where you can grant this role:
|
|
Error Reporting Viewer Beta( Provides read-only access to Error Reporting data. Lowest-level resources where you can grant this role:
|
|
Error Reporting Writer Beta( Provides the permissions to send error events to Error Reporting. Lowest-level resources where you can grant this role:
|
|
API 权限
Error Reporting API 方法需要特定的 IAM 权限。下表列出并描述了 API 方法所需的权限。
方法 | 所需权限 | 说明 |
---|---|---|
deleteEvents |
errorreporting.errorEvents.delete |
删除错误事件。 |
events.list |
errorreporting.errorEvents.list |
列出错误事件。 |
events.report |
errorreporting.errorEvents.create |
创建或更新错误事件。 |
groupStats.list |
errorreporting.groups.list |
列出 ErrorGroupStats 。 |
groups.get |
errorreporting.groupMetadata.get |
检索错误组信息。 |
groups.update |
errorreporting.groupMetadata.update errorreporting.applications.list |
更改错误的解决状态。 |
其他注意事项
在决定哪些权限和角色适用于主账号的使用场景时,请考虑 Error Reporting 活动和所需权限的以下摘要:
活动 | 所需权限 |
---|---|
拥有对 Error Reporting Google Cloud 控制台页面的只读权限。 | errorreporting.applications.list errorreporting.groupMetadata.get errorreporting.groups.list |
在 Google Cloud 控制台中查看组详细信息。 | 只读访问权限的权限外加:errorreporting.errorEvents.list |
在 Google Cloud 控制台中更改元数据。更改错误解决状态,包括忽略错误在内。 | 只读访问权限的权限外加:errorreporting.groupMetadata.update |
在 Google Cloud 控制台中删除错误。 | 只读访问权限的权限外加:errorreporting.errorEvents.delete |
创建错误(无需 Google Cloud 控制台权限)。 | errorreporting.errorEvents.create |
订阅通知。 | 只读访问权限的权限外加:cloudnotifications.activities.list |
授予和管理角色
您可以使用 Google Cloud 控制台、IAM API 或 Google Cloud CLI 授予和管理 IAM 角色。有关授予和管理角色的说明,请参阅授予、更改和撤消访问权限。
您可以为同一位用户授予多个角色。如需获取角色中包含的权限的列表,请参阅获取角色元数据。
如果您尝试访问某个 Google Cloud 资源但缺少必要的权限,请与列为相应资源的 Owner 的用户联系。
自定义角色
如需创建具备 Error Reporting 权限的自定义角色,请从 API 权限中选择权限,然后按照创建自定义角色中的说明操作。
角色更改延迟时间
Error Reporting 会将 IAM 权限缓存 5 分钟,因此角色更改需要 5 分钟才能生效。