Event Manager Post Event
Posts the specified event, optionally associating it with a task.
The event being posted should have the following info in it:
- The ManagedEntity on which the event is being posted should be set in the appropriate EntityEventArgument field of the base Event class. It is OK to not set any entity, in which case the event is treated as an event about the system.
- Some Event fields (key, chainId, createdTime) are mandatory because of the nature of the structure, but any caller-supplied values will be overwritten by the system.
If the event being posted is to be associated with an existing Task, the appropriate TaskInfo needs to be passed in. This task can either be one returned from a vSphere API operation or an extension task created by calling CreateTask.
Audit-record posting requires the additional
Global.SetAuditId privilege. A caller is treated as
posting an audit record (and the additional privilege is enforced)
when either of the following is true:
- auditId is supplied on the event.
- The event type is registered in the server's audit-id mapping (see EventManager#auditMappings); for these types the server populates auditId automatically.
Callers that hold only Global.LogEvent may continue to
post non-audit events without an explicit auditId.
Required privileges: Global.LogEvent
The unique identifier for the managed object to which the method attaches; the serialized managed object reference for a request has the form moType/moId, in this case EventManager/{moId}.
The vSphere release schema. The current specification covers vSphere 9.1.1.0 APIs.
Show optional properties
{
"eventToPost": {}
}
{
"eventToPost": {
"_typeName": "string",
"key": 0,
"chainId": 0,
"createdTime": "string",
"userName": "string",
"datacenter": {
"_typeName": "string",
"name": "string",
"datacenter": {
"_typeName": "string",
"type": "string",
"value": "string"
}
},
"computeResource": {
"_typeName": "string",
"name": "string",
"computeResource": {
"_typeName": "string",
"type": "string",
"value": "string"
}
},
"host": {
"_typeName": "string",
"name": "string",
"host": {
"_typeName": "string",
"type": "string",
"value": "string"
}
},
"vm": {
"_typeName": "string",
"name": "string",
"vm": {
"_typeName": "string",
"type": "string",
"value": "string"
}
},
"ds": {
"_typeName": "string",
"name": "string",
"datastore": {
"_typeName": "string",
"type": "string",
"value": "string"
}
},
"net": {
"_typeName": "string",
"name": "string",
"network": {
"_typeName": "string",
"type": "string",
"value": "string"
}
},
"dvs": {
"_typeName": "string",
"name": "string",
"dvs": {
"_typeName": "string",
"type": "string",
"value": "string"
}
},
"tgw": {
"_typeName": "string",
"name": "string",
"tgw": {
"_typeName": "string",
"type": "string",
"value": "string"
}
},
"fullFormattedMessage": "string",
"changeTag": "string",
"auditId": "string"
},
"taskInfo": {
"_typeName": "string",
"key": "string",
"task": {
"_typeName": "string",
"type": "string",
"value": "string"
},
"description": {
"_typeName": "string",
"key": "string",
"arg": [
{
"_typeName": "string",
"key": "string",
"value": {
"_typeName": "string"
}
}
],
"message": "string"
},
"name": "string",
"descriptionId": "string",
"entity": {
"_typeName": "string",
"type": "string",
"value": "string"
},
"entityName": "string",
"locked": [
{
"_typeName": "string",
"type": "string",
"value": "string"
}
],
"state": "string",
"cancelled": false,
"cancelable": false,
"error": {
"_typeName": "string",
"faultCause": {
"_typeName": "string",
"faultCause": "MethodFault Object",
"faultMessage": [
{
"_typeName": "string",
"key": "string",
"arg": [
{
"_typeName": "string",
"key": "string",
"value": {
"_typeName": "string"
}
}
],
"message": "string"
}
]
},
"faultMessage": [
{
"_typeName": "string",
"key": "string",
"arg": [
{
"_typeName": "string",
"key": "string",
"value": {
"_typeName": "string"
}
}
],
"message": "string"
}
]
},
"result": {
"_typeName": "string"
},
"progress": 0,
"progressDetails": [
{
"_typeName": "string",
"key": "string",
"value": {
"_typeName": "string"
}
}
],
"reason": {
"_typeName": "string"
},
"queueTime": "string",
"startTime": "string",
"completeTime": "string",
"eventChainId": 0,
"changeTag": "string",
"parentTaskKey": "string",
"rootTaskKey": "string",
"activationId": "string"
}
}
Fully-specified event to post
optional task associated with the event
No Content
InvalidArgument: if
- an invalid reference to a managed object is passed in to one of the EntityEventArgument fields
- an invalid severity value is passed in an EventEx.
NoPermission: if the caller supplies an explicit
auditId or posts an audit-mapped event type without
holding Global.SetAuditId on the root folder.
InvalidEvent: no longer thrown by this API
{
"_typeName": "string",
"faultCause": "MethodFault Object",
"faultMessage": [
{
"_typeName": "string",
"key": "string",
"arg": [
{
"_typeName": "string",
"key": "string",
"value": {
"_typeName": "string"
}
}
],
"message": "string"
}
]
}
curl -X POST -H 'Authorization: <value>' -H 'Content-Type: application/json' -d '{"eventToPost":"{}"}' https://{api_host}/sdk/vim25/{release}/EventManager/{moId}/PostEvent