Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In the Policy SDK, mip::PolicyHandler exposes operations that compute policy actions and submit audit events.
Policy handler functions
mip::PolicyHandler exposes methods for reading, writing, and removing both labels and protection information. For the full list, consult the API reference.
This article covers the following methods:
ComputeActionsNotifyCommittedActions
Requirements
To create a PolicyHandler, provide:
- A
mip::MipContext - A
mip::PolicyProfile - A
mip::PolicyEngineadded to themip::PolicyProfile - A class that implements
mip::PolicyHandler::Observer
Create a policy handler
The first step in obtaining policy actions is to create a PolicyHandler object. This class implements the functionality required to get the list of actions that a specific label requires. It also implements the function to trigger an audit event.
Create the PolicyHandler by calling the PolicyEngine's CreatePolicyHandlerAsync function by using the promise/future pattern.
CreatePolicyHandlerAsync accepts a single parameter: isAuditDiscoveryEnabled. Set this value to true if the application should surface heartbeat and discovery events in audit logging.
Note
Implement the mip::PolicyHandler::Observer class in a derived class because CreatePolicyHandler requires the Observer object.
auto createPolicyHandlerPromise = std::make_shared<std::promise<std::shared_ptr<mip::PolicyHandler>>>();
auto createPolicyHandlerFuture = createPolicyHandlerPromise->get_future();
PolicyEngine->CreatePolicyHandlerAsync(true);
auto handler = createPolicyHandlerFuture.get();
After you create the PolicyHandler object, you can compute actions and submit audit events.
Next steps
Now that you know how to create a policy handler, you can:
- Learn how to create an execution state class, which determines compute actions.
- Download the Policy SDK samples from GitHub and try out the Policy SDK.
- Explore the MIP Policy SDK C++ sample on GitHub.