將資訊傳遞至 MIP SDK,以根據目前狀態和所需狀態計算應採取的動作,是透過 mip::ExecutionState 類來實作的。 與SDK中的其他類別一樣,是 ExecutionState 抽象類別,必須由開發人員實作。
如需實作的完整
ExecutionState範例,請檢閱下列範例來源:
mip::ExecutionState 成員
ExecutionState 公開下列虛擬成員。 每一個都會提供一些內容給原則引擎,以傳回應用程式應該採取哪些動作的資訊。 此外,此資訊可用來提供稽核資訊給 Microsoft Purview。
| 成員 | 退貨 |
|---|---|
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::pair 的 std::vector。 |
std::shared_ptr<mip::ProtectionDescriptor> GetProtectionDescriptor() |
傳回 mip::ProtectionDescriptor 的指標 |
std::string GetContentFormat() |
傳回字串 |
mip::ActionType GetSupportedActions() |
傳回標籤的 mip::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 提供的數據也會顯示在 Microsoft Purview 稽核報告中。
後續步驟
- 瞭解如何根據目前和所需的狀態,決定 新標籤或現有標籤的計算動作。
- 從 GitHub 下載原則 SDK 範例並試用原則 SDK