Working with IBM Cloud Resource lifecycle events
Event Notifications service uses the IBM Cloud platform for authentication, access, self-service instance creation, metering, and billing.
The IBM Cloud provisioning layer manages the lifecycle of IBM Cloud resources. A resource is anything that you can create from the IBM Cloud catalog that is managed by and contained within a resource group.
Resource lifecycle events are events around the IBM Cloud resources. For more information, see Creating resources.
Some example of Resource lifecycle events are:
- Creating a resource instance
- Updating a resource instance
- Deleting a resource instance
- Service key credentials updates
- Resource groups updates
Supported resource types and sub-types
-
Service instance type and sub-types
Supported service instance type and sub-types Event type Sub-type Description instanceapply_promo_codeAn event created when a promo code is applied. instancecreateAn event is generated when you provision a service instance. instancecreate_failureAn event is generated when a service instance creation failed. instancecreate_inprogressAn event is generated when a service instance creation is in progress. instancedeleteAn event is generated when a service instance deleted. instancedelete_failureAn event is generated when a service instance deletion failed. instancedelete_inprogressAn event is generated when a service instance deletion is in progress. instancerestoreAn event is generated when a service instance restored after deletion within reclamation period. instanceschedule_reclaimAn event is generated when a service instance scheduled for reclaim after deletion. instanceupdateAn event is generated when a service instance get updated. instanceupdate_failureAn event is generated when a service instance updation failed. instanceupdate_inprogressAn event is generated when a service instance updation is in progress. instanceupdate_planAn event is generated when a service instance plan get updated. instanceupdate_plan_failureAn event is generated when a service instance plan updation failed. instanceupdate_plan_inprogressAn event is generated when a service instance plan updation is in progress. instanceupdate_stateAn event is generated when a service instance state get updated. instanceupdate_state_failureAn event is generated when a service instance state updation failed. -
Service key type resources
Supported key credentials type and sub-types Event type Sub-type Description keycreateAn event is generated when a service instance credentials are created successfully. keycreate_failureAn event is generated when a service instance credentials creation failed. keydeleteAn event is generated when a service instance credentials deleted successfully. keydelete_failureAn event is generated when a service instance credentials deletion failed. -
Resource Group resources
Supported resource group type and sub-types Event type Sub-type Description Resource_groupcreateAn event is generated when a resource group get created. Resource_groupdeleteAn event is generated when a resource group get deleted. Resource_groupupdateAn event is generated when a resource group get updated.
Enabling resource lifecycle events
IBM Cloud Resource lifecycle events is a pre-defined source which publishes resource lifecycle events from IBM Cloud. IBM Cloud Resource lifecycle events is Disabled by default. You can go to the Sources page and enable it by using the toggle switch.
After enabling the source, you can publish the lifecycle events to the Topic of your choice.
To learn more about working with Topics, see here.
Event Schema for Resource Lifecycle Events
The following table describes the fields of a Resource Lifecycle event:
| Field Name | Type | Description |
|---|---|---|
account_id |
String | The Account ID of the user who initiated the event. |
event_id |
String | A unique ID identifying the event on IBM Cloud. It is a UUID. |
event_type |
String | Identifies the type of event. It can be any of the events specified here. |
timestamp |
String | Time when the Event occurred. |
context |
Object | This JSON gives the context in which the event occurred. |
context.subject_id |
String | The IAM ID of the initiator of the Event. Find your IBM Cloud IAM ID. |
context.subject_name |
String | The email ID of the initiator of the email. Find your IBM Cloud subject_name. |
context.activity |
Object | This JSON gives details of the activity performed. |
context.activity.action |
String | Identifies the action taken by the user to trigger an event. |
context.activity.message |
String | A message describing the event. |
context.activity.outcome |
String | Result or outcome of an action. |
context.activity.reason_reasonCode |
Number | The response code from the respective resource for the triggered action. |
context.activity.target_name |
String | The name of the resource on which the action was triggered. |
event_properties |
Object | A JSON object containing the properties of the current event. |
event_properties.created_at |
String | The timestamp when the resource was created. |
event_properties.created_by |
String | The IAM ID who created the resource. |
event_properties.crn |
String | The CRN of the resource. |
event_properties.guid |
String | The guid of the resource. |
event_properties.name |
String | Name of the resource. |
event_properties.resource_group_id |
String | The Resource Group ID. |
event_properties.resource_id |
String | The Resource ID. This identifies the type of the resource in the IBM Cloud catalog. |
event_properties.last_operation |
Object | JSON object identifying the last operation on the resource in question. |
event_properties.last_operation.description |
String | A message describing the last operation carried out on the resource. |
event_properties.last_operation.state |
String | Final state after the last operation was performed. |
event_properties.last_operation.type |
String | Event type of the last operation. |
event_properties.region_id |
String | The region of resource for which the action was done. |
event_properties.state |
String | The state of the resource after the action. |
event_properties.type |
String | The type of the resource: "service_instance" or "resource_instance". |
event_properties.restored_at |
String | Timestamp when the resource was restored. Available for restore resource action. |
event_properties.restored_by |
String | IAM ID who restored the resource. Available for restore resource action. |
event_properties.scheduled_reclaim_at |
String | Timestamp when the resource was reclaimed. Available for reclaim resource action. |
event_properties.scheduled_reclaim_by |
String | IAM ID who restored the resource. Available for restore resource action. |
event_properties.updated_at |
String | Timestamp which the last update on the resource was done. |
Example event
{
"account_id": "abcdef2595f4d598c1725d60fc77",
"context": {
"activity": {
"action": "apprapp.instance.create",
"message": "App Configuration: create instance App Configuration-0001",
"outcome": "success",
"reason_reasonCode": 201,
"target_name": "App Configuration-0001"
},
"subject_id": "IBMid-xxxxxQExx",
"subject_name": "xyz@ibm.com"
},
"event_id": "7ca39870-eb1b-6c50-88b1-48c04123494",
"event_properties": {
"created_at": "2022-09-30T16:18:54.926735545Z",
"created_by": "IBMid-xxxxxQExx",
"crn": "crn:v1:staging:public:apprapp:us-south:a/abcdf222595g44d598c178525i60jc77:f4fca3f2-fdd3-485e-b86c-1234dd3eabc4::",
"guid": "a4bcc3f2-dee3-485f-a86b-4818dd3eabc4",
"last_operation": {
"description": "Completed create instance operation",
"state": "succeeded",
"type": "create"
},
"name": "App Configuration-z0",
"region_id": "us-south",
"resource_group_id": "ee24533eed37412e988179fe694062bc",
"resource_id": "apprapp-a6bcce47-d840-45b0-8ab9-ad15354defgea",
"state": "active",
"type": "service_instance",
"updated_at": "2022-09-30T16:18:55.295780335Z"
},
"event_type": "resource-controller.instance.create",
"timestamp": "2022-09-30T16:18:55Z"
}