管理Event Notifications的 IAM 訪問

身為帳戶擁有者,您可以透過 IBM Cloud® Identity and Access Management 來管理您帳戶中 Event Notifications 實例的存取權限。

作為帳戶擁有者,您可以在帳戶內設定原則,以便為不同使用者建立不同層次的存取權。 舉例來說,某些使用者對某個執行個體可能擁有「Read only」權限,但對另一個執行個體則擁有「Write」權限。 您可以決定誰有權建立、更新和刪除 Event Notifications 的實例。

Event Notifications 已採用 IAM。 新實例不會產生應用程式密鑰。 請改用 API 金鑰。

使用者角色

存取原則的範圍是以使用者的受指派角色為基礎。

原則讓您能在不同層次授與存取權。 以下是部分選項:

  • 在您的帳戶中跨所有服務實例存取
  • 對帳戶中個別服務實例的存取權
  • 對實例中特定資源的存取權
  • 對您帳戶中所有已啟用 IAM 功能之服務的存取權

平台管理角色可讓使用者在平台層次對服務資源執行作業。 例如,可以指派角色來決定誰可以建立或刪除 ID、建立實例,以及將實例連結至應用程式。 下表將指派給平台管理角色的動作分類。

平台管理角色及許可權
平台角色 許可權 範例動作
檢視者 檢視 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 的來源整合
  • Perform service to service registration,of source
  • View,edit,and delete sources and events
  • Send notifications
Event Notifications 發佈者 建立通知及檢視通知計數 傳送通知及檢視通知計數
裝置管理程式 使用 Event Notifications 服務處理推送裝置登錄的自訂角色

如需在使用者介面中指派使用者角色的相關資訊,請參閱管理 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} 管理員、管理者、事件-來源-管理員、通道-編輯者 取得 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 管理員、撰寫者、管理員、通路編輯者 建立 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} 管理員、撰寫者、管理員、通路編輯者 更新 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 管理員、撰寫者、管理員、事件-來源-管理員、事件-通知-發佈者 將通知傳送至 Event Notifications 實例
event-notifications.counts.get GET /event-notifications/v1/instances/{instanceID}/counts 管理程式、讀取器、事件-來源-管理程式、通道-編輯器、事件-通知-發佈者 取得 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} 管理員、管理員、裝置管理員 取得單一 Key Management Services 整合
event-notifications.integrations.update PUT /event-notifications/v1/instances/{instance_id}/integrations/{id} 管理員、管理員、裝置管理員 更新現有的金鑰管理服務整合

使用 API 金鑰

建立服務憑證時,您可能會注意到顯示的是 apiKey,而非 appSecret。

若要使用任何 REST API,您必須透過以下 cURL 指令來產生存取 token:

參數

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.eyJpYW1faWQiOiJpYW0tU2VydmljZUlkLTcwMTgzMDYwLWY3NWUtNGQ5Yy04NjY5LTA4NTNkYzc2NDQyMSIsImlkIjoiaWFtLVNlcnZpY2VJZC03MDE4MzA2MC1mNzVlLTRkOWMtODY2OS0wODUzZGM3NjQ0MjEiLCJyZWFsbWlkIjoiaWFtIiwiaWRlbnRpZmllciI6IlNlcnZpY2VJZC03MDE4MzA2MC1mNzVlLTRkOWMtODY2OS0wODUzZGM3NjQ0MjEiLCJzdWIiOiJTZXJ2aWNlSWQtNzAxODMwNjAtZjc1ZS00ZDljLTg2NjktMDg1M2RjNzY0NDIxIiwic3ViX3R5cGUiOiJTZXJ2aWNlSWQiLCJhY2NvdW50Ijp7ImJzcyI6IjJmZDIwM2E1M2Q5MDI1ZDI4NTU5YjZhZDFhM2JhMTNjIn0sImlhdCI6MTUzNDc2MDIwNywiZXhwIjoxNTM0NzYzODA3LCJpc3MiOiJodHRwczovL2lhbS5ibHVlbWl4Lm5ldC9pZGVudGl0eSIsImdyYW50X3R5cGUiOiJ1cm46aWJtOnBhcmFtczpvYXV0aDpncmFudC10eXBlOmFwaWtleSIsInNjb3BlIjoiaWJtIG9wZW5pZCIsImNsaWVudF9pZCI6ImltZnB1c2giLCJhY3IiOjEsImFtciI6WyJwd2QiXX0.MSUIk3KvFKeidTa4Qf9Ydf-7_boRwPRyigRjBkF0KWT2AVxeQ7oDVOgSEvApzy1tKSoi4N-bAIDpsOkd-BYnYtZnAFJxn9IGSnHli4Y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qv7N4QEf2VIWLI5UWjbuj1IFi_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 'Authorization: Bearer eyJraWQiOiIyMDE3MTAzMC0wMDowMDowMCIsImFsZyI6IlJTMjU2In0.eyJpYW1faWQiOiJpYW0tU2VydmljZUlkLTYxZDdhNzJkLWM3YzAtNGNlZS05Zjg0LWI2ZDc1NzgzMWM2NSIsImlkIjoiaWFtLVNlcnZpY2VJZC02MWQ3YTcyZC1jN2MwLTRjZWUtOWY4NC1iNmQ3NTc4MzFjNjUiLCJyZWFsbWlkIjoiaWFtIiwiaWRlbnRpZmllciI6IlNlcnZpY2VJZC02MWQ3YTcyZC1jN2MwLTRjZWUtOWY4NC1iNmQ3NTc4MzFjNjUiLCJzdWIiOiJTZXJ2aWNlSWQtNjFkN2E3MmQtYzdjMC00Y2VlLTlmODQtYjZkNzU3ODMxYzY1Iiwic3ViX3R5cGUiOiJTZXJ2aWNlSWQiLCJhY2NvdW50Ijp7ImJzcyI6Ijk3MDg5MjkzNTg0OTg1NzBhYjYxMjUwNDk3ZjBmMDI2In0sImlhdCI6MTUzNTM2NTQ5MywiZXhwIjoxNTM1MzY5MDkzLCJpc3MiOiJodHRwczovL2lhbS5ibHVlbWl4Lm5ldC9pZGVudGl0eSIsImdyYW50X3R5cGUiOiJ1cm46aWJtOnBhcmFtczpvYXV0aDpncmFudC10eXBlOmFwaWtleSIsInNjb3BlIjoiaWJtIG9wZW5pZCIsImNsaWVudF9pZCI6ImRlZmF1bHQiLCJhY3IiOjEsImFtciI6WyJwd2QiXX0.ASKxD9Wrz5--OYVkPIsufKK9RNKKhJKuvRldm5mnGNv6PSH7sPBB6NiRG-SSGzEC0ZIei1WqtRE-0TRHwzSnIjXPb3yffBcvNtXuG9wT8GT8zsvxQ7bJk0ovge_0Xrrcym4cCTq2jO6ROWzOZ275wkH0h4fIzukbPv7YpT2Z-DdxIwHY_uALxqcCY83xODtMIs21PO6YwQ3KX4YfNEpKUminJpo45T8po4k049PODQKEK65YrqHYK1_voCJUu9xt9uVoGd-r962fhnbuxeEAe6di9KGVfOGfEdZFHgexoG__wXHa0Rmv9dCl-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 存取。