管理Event Notifications的 IAM 访问权限

作为账户所有者,您可以通过 IBM Cloud® Identity and Access Management 管理您账户中 Event Notifications 实例的访问权限。

作为帐户所有者,您可以在帐户内设置策略,以便为不同用户创建不同级别的访问权。 例如,某些用户对某个实例可能拥有 Read only 权限,但对另一个实例则拥有 Write 权限。 您可以决定哪些用户有权创建、更新和删除 Event Notifications 的实例。

Event Notifications 已采用IAM。 新实例不会生成应用密钥。 请改用 API 密钥。

用户角色

访问策略的作用域基于用户的已分配角色。

策略支持在不同级别授予访问权。 部分选项如下:

  • 对帐户中所有服务实例的访问权
  • 对帐户中个别服务实例的访问权
  • 对实例中特定资源的访问权
  • 对帐户中所有启用 IAM 的服务的访问权

平台管理角色支持用户对平台级别的服务资源执行任务。 例如,可以分配角色以确定谁可以创建或删除标识、创建实例以及将实例绑定到应用程序。 下表对分配给平台管理角色的操作进行了分类。

平台管理角色和许可权
平台角色 许可权 操作示例
查看者 查看 Event Notifications 实例。 您可以查看 Cloud Directory 用户数据或身份提供者配置。
编辑者 查看和绑定 Event Notifications 实例。 您可以将应用程序绑定到 Event Notifications 的实例中。
运算符 创建、删除、编辑、暂挂、恢复,查看或绑定 Event Notifications 实例。 您可以从目录中创建或删除 Event Notifications 实例。
管理员 帐户中所有服务的管理操作。 您可以执行所有操作员操作,并可以将策略分配给其他用户。

下表详细描述了映射到服务访问角色的操作。 服务访问角色使用户能够访问 Event Notifications,并且还可以调用 Event Notifications API。

与服务访问角色相对应的行动
服务角色 许可权 操作示例
读取者 查看 Event Notifications 实例数据 查看服务实例的详细信息,例如源,规则,主题和通道
写入者 查看和编辑 Event Notifications 实例
  • 执行所有“读者”操作
  • 编辑服务实例数据,例如源,规则,主题和通道
通道编辑器 查看,创建和删除 Event Notifications 预订 查看,创建,更新和删除 Event Notifications 预订
管理者 查看,编辑和删除 Event Notifications 实例中的数据
  • 执行所有写入者操作
  • 删除服务实例数据,例如源,规则,主题和通道
服务配置读取者 读取监管管理的服务配置 查看服务配置
事件源管理器 通过使用服务到服务授权与 Event Notifications 进行源集成
  • 执行服务到源
    的服务注册 * 查看,编辑和删除源和事件
  • 发送通知
Event Notifications 发布者 创建通知和查看通知计数 发送通知和查看通知计数
设备管理器 用于处理向 Event Notifications 服务进行推送设备注册的定制角色

有关在 UI 中分配用户角色的更多信息,请参阅管理 IAM 访问权。

Event Notifications 访问策略

必须为帐户中访问 Event Notifications 服务的每一个用户分配定义了 IAM 用户角色的访问策略。 该策略确定用户可在您所选服务或实例的上下文中执行的操作。

这些操作是由 IBM Cloud 服务根据该服务允许的操作进行自定义和定义的。 然后,这些操作将映射到 IAM 用户角色。 可使用 Activity Tracker 服务来跟踪所执行的某些操作。 在下表中,Event Notifications 的操作和必需的许可权一一对应。

与不同角色相对应的行动
服务操作 显示名称 角色 描述
event-notifications.sources.create POST /event-notifications/v1/instances/{instanceID}/sources 经理,管理员,事件-源-经理 为 Event Notifications 实例创建源
event-notifications.sources.read GET /event-notifications/v1/instances/{instanceID}/sources/{sourceID} Manager,Administrator,Event-Source-Manager,Channel-Editor 获取 Event Notifications 实例的源
event-notifications.sources.update PUT /event-notifications/v1/instances/{instanceID}/sources/{sourceID} 经理,管理员,事件-源-经理 更新 Event Notifications 实例的源
event-notifications.sources.delete DELETE /event-notifications/v1/instances/{instanceID}/sources/{sourceID} 经理,管理员,事件-源-经理 从 Event Notifications 实例中删除源
event-notifications.sources.list GET /event-notifications/v1/instances/{instanceID}/sources 经理,管理员,事件-源-经理,渠道编辑器 获取 Event Notifications 实例的所有源
event-notifications.topics.create POST /event-notifications/v1/instances/{instanceID}/topics 经理,编写者,管理员 为 Event Notifications 实例创建主题
event-notifications.topics.read GET /event-notifications/v1/instances/{instanceID}/topics/{topicID} 经理,读者,作者,管理员,渠道-编辑者 获取 Event Notifications 实例的主题
event-notifications.topics.update PUT /event-notifications/v1/instances/{instanceID}/topic/{topicID} 经理,编写者,管理员 更新 Event Notifications 实例的主题
event-notifications.topics.delete DELETE /event-notifications/v1/instances/{instanceID}/topic/{topicID} 经理,管理员 从 Event Notifications 实例中删除主题
event-notifications.topics.list GET /event-notifications/v1/instances/{instanceID}/topics 经理,读者,作者,管理员,渠道-编辑者 获取 Event Notifications 实例的所有主题
event-notifications.rules.create POST /event-notifications/v1/instances/{instanceID}/rules 经理,编写者,管理员 为 Event Notifications 实例创建规则
event-notifications.rules.read GET /event-notifications/v1/instances/{instanceID}/rules/{ruleID} 经理,读者,作者,管理员,渠道-编辑者 获取 Event Notifications 实例的规则
event-notifications.rules.update PUT /event-notifications/v1/instances/{instanceID}/rules/{ruleID} 经理,编写者,管理员 更新 Event Notifications 实例的规则
event-notifications.rules.delete DELETE /event-notifications/v1/instances/{instanceID}/rules/{ruleID} 经理,管理员 从 Event Notifications 实例中删除规则
event-notifications.rules.list GET /event-notifications/v1/instances/{instanceID}/rules 经理,读者,作者,管理员,渠道-编辑者 获取 Event Notifications 实例的所有规则
event-notifications.destinations.create POST /event-notifications/v1/instances/{instanceID}/destinations 经理,编写者,管理员 为 Event Notifications 实例创建目标
event-notifications.destinations.read GET /event-notifications/v1/instances/{instanceID}/destinations/{destinationID} 经理,读者,作者,管理员,渠道-编辑者 获取 Event Notifications 实例的目标
event-notifications.destinations.update PUT /event-notifications/v1/instances/{instanceID}/destinations/{destinationID} 经理,编写者,管理员 更新 Event Notifications 实例的目标
event-notifications.destinations.delete DELETE /event-notifications/v1/instances/{instanceID}/destinations/{destinationID} 经理,管理员 从 Event Notifications 实例中删除目标
event-notifications.destinations.list GET /event-notifications/v1/instances/{instanceID}/destinations 经理,读者,作者,管理员,渠道-编辑者 获取 Event Notifications 实例的所有目标
event-notifications.subscriptions.create POST /event-notifications/v1/instances/{instanceID}/subscriptions Manager,Writer,Administrator 和 Channel-Editor 为 Event Notifications 实例创建预订
event-notifications.subscriptions.read GET /event-notifications/v1/instances/{instanceID}/subscriptions/{subscriptionID} 经理,读者,作者,管理员,渠道-编辑者 获取 Event Notifications 实例的预订
event-notifications.subscriptions.update PUT /event-notifications/v1/instances/{instanceID}/subscriptions/{subscriptionID} Manager,Writer,Administrator 和 Channel-Editor 更新 Event Notifications 实例的预订
event-notifications.subscriptions.delete DELETE /event-notifications/v1/instances/{instanceID}/subscriptions/{subscriptionID} 经理,管理员,通道-编辑器 从 Event Notifications 实例删除预订
event-notifications.subscriptions.list GET /event-notifications/v1/instances/{instanceID}/subscriptions 经理,读者,作者,管理员,渠道-编辑者 获取 Event Notifications 实例的所有预订
event-notifications.notifications.post POST /event-notifications/v1/instances/{{instance_id}}/notifications Manager,Writer,Administrator,Event-Source-Manager,Event-Notification-Publisher 向 Event Notifications 实例发送通知
event-notifications.counts.get GET /event-notifications/v1/instances/{instanceID}/counts Manager,Reader,Event-Source-Manager,Channel-Editor,Event-Notification-Publisher 获取 Event Notifications 实例的所有通知
event-notifications.events.create GET /event-notifications/v1/instances/{instanceID}/events/{eventID}?sourceID=* 经理,管理员,事件-源-经理 获取 Event Notifications 实例的事件
event-notifications.events.read POST /event-notifications/v1/instances/{instanceID}/sources 经理,管理员,事件-源-经理
event-notifications.events.list GET /event-notifications/v1/instances/{instanceID}/events?sourceID=* 经理,管理员,事件-源-经理 获取 Event Notifications 实例的所有事件
event-notifications.events.delete DELETE /event-notifications/v1/instances/{instanceID}/events/{eventID}?sourceID=* 经理,管理员,事件-源-经理 从 Event Notifications 实例中删除事件
event-notifications.publickey.read GET /event-notifications/v1/instances/{instanceID}/destinations/{destinationID}/public_key 经理,读者,作者,管理员,渠道-编辑者 读取用于签署 Webhook 的公用密钥
event-notifications.severities.create POST /event-notifications/v1/instances/{instanceID}/severities 事件-源-管理器 创建定制严重性
event-notifications.severities.read GET /event-notifications/v1/instances/{instanceID}/severities/{severity_id}?sourceID=* 事件-源-管理器 根据源获取严重性
event-notifications.severities.list GET /event-notifications/v1/instances/{instanceID}/severities?sourceID=* 经理,读者,管理员,事件-源-经理 根据源获取所有严重性
event-notifications.severities.delete DELETE /event-notifications/v1/instances/{instanceID}/severities/{severity_id}?sourceID=* 事件-源-管理器 根据源删除严重性
event-notifications.email-status.create POST /event-notifications/v1/instances/{instanceID}/email-status/sources/{sourceID}/notifications/{notificationID} 状态-报告者 创建/更新已分派电子邮件的当前状态
event-notifications.sms-status.create POST /event-notifications/v1/instances/{instanceID}/sms-status/sources/{sourceID}/notifications/{notificationID} 状态-报告者 创建/更新已分派 SMS 的当前状态
event-notifications.webhook-status.create POST /event-notifications/v1/instances/{instanceID}/webhook-status/sources/{sourceID}/notifications/{notificationID} 状态-报告者 创建/更新已分派 Webhook 的当前状态
event-notifications.devices.create POST /event-notifications/v1/instances/{instanceID}/destinations/{id}/devices 经理,管理员,设备-经理 在推送通知 FCM 目标下创建设备
event-notifications.devices.read GET /event-notifications/v1/instances/{instanceID}/destinations/{id}/devices/{device_id} 经理,管理员,设备-经理 在推送通知 FCM 目标下获取单个设备
event-notifications.devices.list GET /event-notifications/v1/instances/{instanceID}/destinations/{id}/devices 经理,管理员,设备-经理 在推送通知 FCM 目标下创建所有设备
event-notifications.devices.update PUT /event-notifications/v1/instances/{instanceID}/destinations/{id}/devices/{device_id} 经理,管理员,设备-经理 更新推送通知 FCM 目标下的现有设备
event-notifications.devices.delete POST /event-notifications/v1/instances/{instanceID}/destinations/{id}/devices/{device_id} 经理,管理员,设备-经理 在推送通知 FCM 目标下删除现有设备
event-notifications.tag-subscriptions.list GET /event-notifications/v1/instances/{instanceID}/destinations/{id}/tag_subscriptions 经理,管理员 列示推送 DCM 目标下的所有预订
event-notifications.tag-subscriptions.devices.list GET /event-notifications/v1/instances/{instanceID}/destinations/{id}/tag_subscriptions/devices/{device_id} 经理,管理员,设备-经理 从推送通知 FCM 目标下的标记预订获取单个设备
event-notifications.tag-subscriptions.create POST /event-notifications/v1/instances/{instanceID}/destinations/{id}/tag_subscriptions 经理,管理员,设备-经理 在推送通知 FCM 目标下创建标记预订
event-notifications.tag-subscriptions.delete DELETE /event-notifications/v1/instances/{instanceID}/destinations/{id}/tag_subscriptions 经理,管理员,设备-经理 在推送通知 FCM 目标下删除标记预订
event-notifications.channel-groups.create POST /event-notifications/v1/instances/{instance_id}/destinations/{id}/fcm_channel_groups 经理,管理员,设备-经理 在推送通知 FCM 目标下创建通道组
event-notifications.channel-groups.read POST /event-notifications/v1/instances/{instance_id}/destinations/{id}/fcm_channel_groups/{group_id} 经理,管理员,设备-经理 获取推送通知 FCM 目标下的新通道组
event-notifications.channel-groups.list GET /event-notifications/v1/instances/{instance_id}/destinations/{id}/fcm_channel_groups 经理,管理员,设备-经理 列出推送通知 FCM 目标下的所有通道组
event-notifications.channel-groups.update PUT /event-notifications/v1/instances/{instance_id}/destinations/{id}/fcmChannelGroups/{group_id} 经理,管理员,设备-经理 更新推送通知 FCM 目标下的现有通道组
event-notifications.channel-groups.delete DELETE /event-notifications/v1/instances/{instance_id}/destinations/{id}/fcm_channel_groups/{group_id} 经理,管理员 删除推送通知 FCM 目标下的现有通道组
event-notifications.integrations.list GET /event-notifications/v1/instances/{instance_id}/integrations 经理,管理员,设备-经理 列出所有密钥管理服务集成
event-notifications.integrations.read GET /event-notifications/v1/instances/{instance_id}/integrations/{id} 经理,管理员,设备-经理 获取单一密钥管理服务集成
event-notifications.integrations.update PUT /event-notifications/v1/instances/{instance_id}/integrations/{id} 经理,管理员,设备-经理 更新现有密钥管理服务集成

使用 API 密钥

在创建服务凭据时,您可能会注意到显示的是 apiKey,而不是 appSecret。

要使用任何 REST API,您必须使用以下 cURL 命令生成访问令牌:

参数

curl -k -X POST \
--header "Content-Type: application/x-www-form-urlencoded" \
--header "Accept: application/json" \
--data-urlencode "grant_type=urn:ibm:params:oauth:grant-type:apikey" \
--data-urlencode "apikey=G2c7oaUuOjul1RbmbjAeI7YwJSUCW_hmfif3GhLabYPE" \
"https://iam.cloud.ibm.com/identity/token"

响应

{
   "access_token": "eyJraWQiOiIyMDE3MTAzMC0wMDowMDowMCIsImFsZyI6IlJTMjU2In0.eyJpYW1faWQiOiJpYW0tU2VydmljZUlkLTcwMTgzMDYwLWY3NWUtNGQ5Yy04NjY5L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ZtcBGx3sL5THYUxU-PlkxELZ3gKX78dWf4P7lYDLDXR2x_n48fPIvRQoDD0ZJAKewO3o1IcegmNdf_InSgvu2M3Ra3FwlJPDN9mRH6-2e8pHnvq4e1rdY6pV0ufxweKc9dGqU-U7VU765BCg84kr8tkb9kpZnnPseDJ89gf5lhkZteKoNVkn-uiLUF0L-yv33tgtoDrdU5-FqaV00TUbLBoJEeTTnUD1fgIGB6SfphIImCQ0368gTU2emGBe3lzlQBnvkOXaMoBds3Nc2YL6px2LhqBWFd_ho68P4ahz1cbTn1rhqIjZMokeN88sreAKsRWhH7nVgBpfN3FS7OJBrVTx55j44vrZdH3vFJ-glLNb3FBwI6_6N_i2lVz7W-_W9xHW2CTYO7e3PYEZorQDBRZFIPImES6v7UV7YyaYG5ikktHHsOZsMzb6UYP-Kg1k2z_UTOumBkCDYxeV9GxukgSSK7Nckpysi5DJt4VgEnyxlbnfmWhtVeSzl8vjIBLJFE7oe7QDn3YyfCDP4QS4cIkTAvvpE5916pXk-rU9NLbIp6mmJw4PwY8__ao6CmCZJ4IDlr6GsDu4Ocn72yGgsNSwI-sq-dJyMuYG494CQ3MOooWsUjzhLTIHGsuHOkouMh07yR-v-D0dNrBeRmXM-JyF6BmtAS-rcivztjjbfJV3NNZcjC9RJvgf7OW5kp7dSRXMlohHu4tAxgVy16ON3Hm1TFnZt5jsaYLcwxuC6s2Qv7N4QEf2VIWLI5UWjbuj1IFi_Jq4RAkCCNgdvKo6RWaMbvZ8XL-3VKaDiJ60oy7wjGwZmWAWIFBZ1S3Br5waaT51T6mFV_s0VTu-68HhFpdIb1WFCXrU8DEcsamkUU7XRiTtBEIFNWQWnDDGMtn_vFGJCFygOd8CMsj",
   "token_type": "Bearer",
   "expires_in": 3600,
   "expiration": 1534763807,
   "scope": "ibm openid"
}

使用前面的 curl 命令生成访问令牌后,请在 Authorization 头中传入 Bearer <value of access_token> 来调用 REST API。

例如:

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Author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Rmv9dCl-nNI4WMZfCTj8jgfEOhuZstpW7pW2g' --header 'Accept-Language: en-US' -d '{ \
   "message": { \
     "alert": "Notification alert message" \
   } \
 }' 'https://us-east.imfpush.cloud.ibm.com/imfpush/v1/apps/4809d407-85ff-4d11-ae4b-0fcdf8a833f1/messages'

有关 IAM 的更多信息,请参阅 IAM 访问权。