12.5. 将应用程序订阅到裸机事件 REST API 参考
使用裸机事件 REST API 订阅应用程序到父节点上生成的裸机事件。
				使用资源地址 /cluster/node/<node_name>/redfish/event 将应用程序订阅到 Redfish 事件,其中 <node_name> 是运行应用程序的集群节点。
			
				在单独的应用程序 pod 中部署 cloud-event-consumer 应用程序容器和 cloud-event-proxy sidecar 容器。cloud-event-consumer 应用订阅应用容器集中的 cloud-event-proxy 容器。
			
				使用以下 API 端点,将 cloud-event-consumer 应用程序订阅到 Redfish 事件,这些事件由 cloud-event-proxy 容器发布,位于应用程序 pod 中的 http://localhost:8089/api/ocloudNotifications/v1/:
			
- /api/ocloudNotifications/v1/subscriptions- 
								POST:创建新订阅
- 
								GET:删除订阅列表
 
- 
								
- /api/ocloudNotifications/v1/subscriptions/<subscription_id>- 
								PUT:为指定订阅 ID 创建新状态 ping 请求
 
- 
								
- /api/ocloudNotifications/v1/health- 
								GET:返回ocloudNotificationsAPI 的健康状况
 
- 
								
					9089 是在应用程序 Pod 中部署的 cloud-event-consumer 容器的默认端口。您可以根据需要为应用程序配置不同的端口。
				
api/ocloudNotifications/v1/subscriptions
HTTP 方法
				GET api/ocloudNotifications/v1/subscriptions
			
描述
				返回订阅列表。如果订阅存在,则返回 200 OK 状态代码以及订阅列表。
			
API 响应示例
HTTP 方法
				POST api/ocloudNotifications/v1/subscriptions
			
描述
				创建新订阅。如果订阅成功创建,或者已存在,则返回 201 Created 状态代码。
			
| 参数 | 类型 | 
|---|---|
| subscription | data | 
有效负载示例
{
  "uriLocation": "http://localhost:8089/api/ocloudNotifications/v1/subscriptions",
  "resource": "/cluster/node/openshift-worker-0.openshift.example.com/redfish/event"
}
{
  "uriLocation": "http://localhost:8089/api/ocloudNotifications/v1/subscriptions",
  "resource": "/cluster/node/openshift-worker-0.openshift.example.com/redfish/event"
}api/ocloudNotifications/v1/subscriptions/<subscription_id>
HTTP 方法
				GET api/ocloudNotifications/v1/subscriptions/<subscription_id>
			
描述
				返回 ID 为 <subscription_id> 的订阅详情
			
| 参数 | 类型 | 
|---|---|
| 
								 | string | 
API 响应示例
api/ocloudNotifications/v1/health/
HTTP 方法
				GET api/ocloudNotifications/v1/health/
			
描述
				返回 ocloudNotifications REST API 的健康状况。
			
API 响应示例
OK
OK