将信息传递到 MIP SDK 以根据当前状态和所需状态来计算应采取的操作,是通过 mip::ExecutionState
类来实现的。 与 SDK 中的其他类一样,ExecutionState
是一个抽象类,必须由开发人员来实现。
有关
ExecutionState
实现的完整示例,详见以下示例源:
mip::ExecutionState 成员
ExecutionState
会公开以下虚拟成员。 每个成员都会向策略引擎提供一些上下文,以返回有关应用程序应执行的操作的信息。 此外,此信息还可用于向 Azure 信息保护报告功能提供审核信息。
成员 | 返回 |
---|---|
std::shared_ptr<mip::Label> GetNewLabel() |
返回要应用于对象的标签。 |
mip::DataState GetDataState() |
返回对象的 mip::DataState。 |
std::pair<bool, std::string> IsDowngradeJustified() |
返回一个 std::pair,表示降级是否合理以及相应的理由。 |
std::string GetContentIdentifier() |
返回内容标识符。 应为一个人类可读的标识符,指示对象的位置。 |
mip::ActionSource GetNewLabelActionSource() |
返回标签的 mip::ActionSource。 |
mip::AssignmentMethod GetNewLabelAssignmentMethod() |
返回标签的 mip::AssignmentMethod |
std::vector<std::pair<std::string, std::string>> GetNewLabelExtendedProperties() |
返回字符串的 std::pairs 的 std::vector,其中包含将应用到文档的自定义元数据。 |
std::vector<std::pair<std::string, std::string>> GetContentMetadata() |
返回包含当前内容元数据的字符串的 std::pairs 的 std::vector。 |
std::shared_ptr<mip::ProtectionDescriptor> GetProtectionDescriptor() |
返回指向 mip::ProtectionDescriptor 的指针 |
std::string GetContentFormat() |
返回字符串 |
mip::ActionType GetSupportedActions() |
返回标签的 mip::ActionSourcemip::ActionTypes。 |
std::shared_ptr<mip::ClassificationResults> |
如果执行,则返回分类结果列表。 |
对于派生自 mip::ExecutionState
的类,必须在其实现中重写每个成员。 在上面链接的示例应用程序中,此过程是通过实现一个名为 ExecutionStateOptions
的结构并将其传递给派生类的构造函数来实现的。
在此示例中,名为 ExecutionStateOptions
的结构定义为:
struct ExecutionStateOptions {
std::unordered_map<std::string, std::string> metadata;
std::string newLabelId;
std::string contentIdentifier;
mip::ActionSource actionSource = mip::ActionSource::MANUAL;
mip::DataState dataState = mip::DataState::USE;
mip::AssignmentMethod assignmentMethod = mip::AssignmentMethod::STANDARD;
bool isDowngradeJustified = false;
std::string downgradeJustification;
std::string templateId;
std::string contentFormat = mip::GetFileContentFormat();
mip::ActionType supportedActions;
bool generateAuditEvent;
};
每个属性由应用程序设置,然后 ExecutionStateOptions
将被传递给派生自 mip::ExecutionState
的类的构造函数。 此信息可用来确定要执行的操作。 mip::ExecutionState
中提供的数据也将在 Azure 信息保护分析中显示。
后续步骤
- 了解如何根据当前状态和期望的状态确定新标签或现有标签的计算操作。
- 下载 GitHub 的策略 SDK 示例并试用该策略 SDK