28#ifndef API_MIP_FILE_FILE_ENGINE_H_
29#define API_MIP_FILE_FILE_ENGINE_H_
69 const std::string& engineId,
70 const std::shared_ptr<AuthDelegate>& authDelegate,
71 const std::string& clientData,
72 const std::string& locale =
"",
73 bool loadSensitivityTypes =
false)
74 : mEngineId(engineId),
75 mAuthDelegate(authDelegate),
76 mClientData(clientData),
78 mIsLoadSensitivityTypesEnabled(loadSensitivityTypes) {
79 if (mLocale.compare(
"") == 0) {
99 const std::shared_ptr<AuthDelegate>& authDelegate,
100 const std::string& clientData,
101 const std::string& locale =
"",
102 bool loadSensitivityTypes =
false)
103 : mIdentity(identity),
104 mAuthDelegate(authDelegate),
105 mClientData(clientData),
107 mIsLoadSensitivityTypesEnabled(loadSensitivityTypes) {
108 if (mLocale.compare(
"") == 0) {
143 const std::string&
GetLocale()
const {
return mLocale; }
148 void SetCustomSettings(
const std::vector<std::pair<std::string, std::string>>& value) { mCustomSettings = value; }
153 const std::vector<std::pair<std::string, std::string>>&
GetCustomSettings()
const {
return mCustomSettings; }
159 mSessionId = sessionId;
197 mDataBoundary = dataBoundary;
206 return mDataBoundary;
217 mProtectionCloudEndpointBaseUrl = protectionCloudEndpointBaseUrl;
228 return mProtectionCloudEndpointBaseUrl;
237 mPolicyCloudEndpointBaseUrl = policyCloudEndpointBaseUrl;
246 return mPolicyCloudEndpointBaseUrl;
253 mProtectionOnlyEngine = protectionOnly;
260 return mProtectionOnlyEngine;
269 return mIsLoadSensitivityTypesEnabled;
276 mEnablePFile = value;
314#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
315 [[deprecated(
"SetLabelFilter is deprecated, use ConfigureFunctionality")]]
317 void SetLabelFilter(
const std::vector<LabelFilterType>& deprecatedLabelFilters) { mDeprecatedLabelFilters = deprecatedLabelFilters; }
326 const std::vector<LabelFilterType>&
GetLabelFilter()
const {
return mDeprecatedLabelFilters; }
339 "FunctionalityFilterType::None is not supported");
342 mConfiguredFunctionality[functionalityFilterType] = enabled;
351 return mConfiguredFunctionality;
360 mAuthDelegate = authDelegate;
370#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
385 mLoggerContext = loggerContext;
389 std::string mEngineId;
393 std::shared_ptr<AuthDelegate> mAuthDelegate;
394 std::string mClientData;
395 std::vector<std::pair<std::string, std::string>> mCustomSettings;
396 std::vector<LabelFilterType> mDeprecatedLabelFilters;
397 std::map<FunctionalityFilterType, bool> mConfiguredFunctionality;
398 std::string mProtectionCloudEndpointBaseUrl;
399 std::string mPolicyCloudEndpointBaseUrl;
401 std::string mSessionId;
402 bool mProtectionOnlyEngine =
false;
403 bool mIsLoadSensitivityTypesEnabled;
404 bool mEnablePFile =
true;
405 std::string mDelegatedUserEmail;
406 std::shared_ptr<void> mLoggerContext;
435 virtual std::shared_ptr<Label>
GetLabelById(
const std::string&
id)
const = 0;
497 const std::string& inputFilePath,
498 const std::string& filePathForAuditReporting,
499 bool isAuditDiscoveryEnabled,
500 const std::shared_ptr<FileHandler::Observer>& fileHandlerObserver,
501 const std::shared_ptr<void>& context,
502 const std::shared_ptr<FileExecutionState>& fileExecutionState =
nullptr,
503 bool isGetSensitivityLabelAuditDiscoveryEnabled =
true) = 0;
520 const std::shared_ptr<Stream>& inputStream,
521 const std::string& actualFilePath,
522 bool isAuditDiscoveryEnabled,
523 const std::shared_ptr<FileHandler::Observer>& fileHandlerObserver,
524 const std::shared_ptr<void>& context,
525 const std::shared_ptr<FileExecutionState>& fileExecutionState =
nullptr,
526 bool isGetSensitivityLabelAuditDiscoveryEnabled =
true) = 0;
536 const std::string& level,
537 const std::string& eventType,
538 const std::string& eventData) = 0;
Settings(const Identity &identity, const std::shared_ptr< AuthDelegate > &authDelegate, const std::string &clientData, const std::string &locale="", bool loadSensitivityTypes=false)
FileProfile::Settings constructor for creating a new engine.
const std::string & GetProtectionCloudEndpointBaseUrl() const
Gets the protection cloud endpoint base url.
const std::shared_ptr< void > & GetLoggerContext() const
Get logger context that will be opaquely passed to the logger delegate for logs associated with the c...
void SetProtectionCloudEndpointBaseUrl(const std::string &protectionCloudEndpointBaseUrl)
Sets the protection cloud endpoint base URL for custom cloud.
void ConfigureFunctionality(FunctionalityFilterType functionalityFilterType, bool enabled)
Enables or disables functionality.
const bool IsPFileEnabled()
Get the flag indicating if produce PFiles.
const std::string & GetClientData() const
Returns the engine client data.
void EnablePFile(bool value)
Sets the flag indicating if produce PFiles.
const std::string & GetSessionId() const
Return the engine session ID.
const std::vector< std::pair< std::string, std::string > > & GetCustomSettings() const
Gets a list of name/value pairs used for testing and experimentation.
void SetPolicyCloudEndpointBaseUrl(const std::string &policyCloudEndpointBaseUrl)
Sets the policy cloud endpoint base URL for custom cloud.
void SetLoggerContext(const std::shared_ptr< void > &loggerContext)
Sets the logger context that will be opaquely passed to the logger delegate for logs associated with ...
const std::vector< LabelFilterType > & GetLabelFilter() const
Gets the label filters set through deprecated function SetLabelFilter.
const std::string & GetDelegatedUserEmail() const
Gets the delegated user.
DataBoundary GetDataBoundary() const
Gets the data boundary region.
Cloud GetCloud() const
Gets the target cloud used by all service requests.
void SetLabelFilter(const std::vector< LabelFilterType > &deprecatedLabelFilters)
Sets the label filter.
bool IsLoadSensitivityTypesEnabled() const
Get the the flag indicating if load sensitivity labels is enabled.
const std::string & GetPolicyCloudEndpointBaseUrl() const
Gets the policy cloud endpoint base url.
void SetAuthDelegate(const std::shared_ptr< AuthDelegate > &authDelegate)
Set the Engine Auth Delegate.
void SetDataBoundary(DataBoundary dataBoundary)
Optionally sets the target diagnostic region.
const std::string & GetEngineId() const
Returns the engine ID.
void SetCustomSettings(const std::vector< std::pair< std::string, std::string > > &value)
Sets a list of name/value pairs used for testing and experimentation.
void SetIdentity(const Identity &identity)
Sets the engine identity.
void SetDelegatedUserEmail(const std::string &delegatedUserEmail)
Sets the delegated user.
const Identity & GetIdentity() const
Returns the engine Identity.
void SetProtectionOnlyEngine(bool protectionOnly)
Sets protection only engine indicator - no policy/label.
std::shared_ptr< AuthDelegate > GetAuthDelegate() const
Get the Engine Auth Delegate.
const std::map< FunctionalityFilterType, bool > & GetConfiguredFunctionality() const
Gets the configured functionality.
Settings(const std::string &engineId, const std::shared_ptr< AuthDelegate > &authDelegate, const std::string &clientData, const std::string &locale="", bool loadSensitivityTypes=false)
FileEngine::Settings constructor for loading an existing engine.
void SetCloud(Cloud cloud)
Optionally sets the target cloud.
void SetSessionId(const std::string &sessionId)
Sets the engine session ID.
void SetEngineId(const std::string &id)
Set the engine ID.
const std::string & GetLocale() const
Return the engine locale.
const bool IsProtectionOnlyEngine() const
Return protection only engine indicator - no policy/label.
This class provides an interface for all engine functions.
virtual std::chrono::time_point< std::chrono::system_clock > GetLastPolicyFetchTime() const =0
Gets the time when the policy was last fetched.
virtual const std::string & GetPolicyDataXml() const =0
Gets policy data XML which describes the settings, labels, and rules associated with this policy.
virtual bool IsLabelingRequired() const =0
Checks if the policy dictates that a document must be labeled.
virtual void SendApplicationAuditEvent(const std::string &level, const std::string &eventType, const std::string &eventData)=0
Logs an application specific event to the audit pipeline.
virtual std::shared_ptr< AsyncControl > CreateFileHandlerAsync(const std::shared_ptr< Stream > &inputStream, const std::string &actualFilePath, bool isAuditDiscoveryEnabled, const std::shared_ptr< FileHandler::Observer > &fileHandlerObserver, const std::shared_ptr< void > &context, const std::shared_ptr< FileExecutionState > &fileExecutionState=nullptr, bool isGetSensitivityLabelAuditDiscoveryEnabled=true)=0
Starts creating a file handler for given file stream.
virtual std::shared_ptr< AsyncControl > CreateFileHandlerAsync(const std::string &inputFilePath, const std::string &filePathForAuditReporting, bool isAuditDiscoveryEnabled, const std::shared_ptr< FileHandler::Observer > &fileHandlerObserver, const std::shared_ptr< void > &context, const std::shared_ptr< FileExecutionState > &fileExecutionState=nullptr, bool isGetSensitivityLabelAuditDiscoveryEnabled=true)=0
Starts creating a file handler for given file path.
virtual const std::string & GetMoreInfoUrl() const =0
Provide a url for looking up more information about the policy/labels.
virtual bool HasWorkloadConsent(Workload workload) const =0
Checks if user has consented to specific workload,.
virtual const std::vector< std::shared_ptr< Label > > ListSensitivityLabels()=0
Returns a list of sensitivity labels.
virtual std::shared_ptr< Label > GetLabelById(const std::string &id) const =0
Gets the label according to the provided id.
virtual const std::vector< std::shared_ptr< SensitivityTypesRulePackage > > & ListSensitivityTypes() const =0
list the sensitivity types associated with the policy engine.
virtual const std::string & GetPolicyFileId() const =0
Gets the policy file ID.
virtual const std::shared_ptr< Label > GetDefaultSensitivityLabel() const =0
Get the default sensitivity label.
virtual bool HasClassificationRules() const =0
Gets if the policy has automatic or recommendation rules.
virtual const Settings & GetSettings() const =0
Returns the engine settings.
virtual const std::vector< std::pair< std::string, std::string > > & GetCustomSettings() const =0
Gets a list of custom settings.
virtual const std::string & GetSensitivityFileId() const =0
Gets the sensitivity file ID.
Abstraction for identity.
A file Containing the common types used by the upe, file and protection modules.
Cloud
Azure cloud identifier.
Workload
The workload the application is working on, used primary to check for consent.
LabelFilterType
Label filter types, optional set of properties that can be used to filter labels or label behavior wh...
DataBoundary
Diagnostic region identifier.
A file containing the MIP SDK error types.
This file contains the ExecutionState class.
This file contains the Label class.