34#ifndef API_MIP_UPE_POLICY_PROFILE_H_
35#define API_MIP_UPE_POLICY_PROFILE_H_
75 const std::shared_ptr<PolicyProfile>& profile,
76 const std::shared_ptr<void>& context) { UNUSED(profile); UNUSED(context); }
85 const std::exception_ptr& error,
86 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
95 const std::vector<std::string>& engineIds,
96 const std::shared_ptr<void>& context) { UNUSED(engineIds); UNUSED(context); }
105 const std::exception_ptr& error,
106 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
122 const std::exception_ptr& error,
123 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
132 const std::shared_ptr<PolicyEngine>& engine,
133 const std::shared_ptr<void>& context) { UNUSED(engine); UNUSED(context); }
153 const std::exception_ptr& error,
154 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
170 const std::exception_ptr& error,
171 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
202 const std::shared_ptr<MipContext>& mipContext,
204 const std::shared_ptr<PolicyProfile::Observer>& observer)
205 : mMipContext(mipContext),
206 mCacheStorageType(cacheStorageType),
207 mObserver(observer) {}
221 const std::shared_ptr<PolicyProfile::Observer>&
GetObserver()
const {
return mObserver; }
242 void SetHttpDelegate(
const std::shared_ptr<HttpDelegate>& httpDelegate) { mHttpDelegate = httpDelegate; }
256 void SetStorageDelegate(
const std::shared_ptr<StorageDelegate>& storageDelegate) { mStorageDelegate = storageDelegate; }
274 mTaskDispatcherDelegate = taskDispatcherDelegate;
278 mSessionId = sessionId;
290 void SetCustomSettings(
const std::vector<std::pair<std::string, std::string>>& customSettings) {
291 mCustomSettings = customSettings;
300 return mCustomSettings;
302#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
317 mLoggerContext = loggerContext;
323 std::shared_ptr<MipContext> mMipContext;
325 std::shared_ptr<PolicyProfile::Observer> mObserver;
326 std::shared_ptr<HttpDelegate> mHttpDelegate;
327 std::shared_ptr<TaskDispatcherDelegate> mTaskDispatcherDelegate;
328 std::string mSessionId;
329 std::vector<std::pair<std::string, std::string>> mCustomSettings;
330 std::shared_ptr<void> mLoggerContext;
331 std::shared_ptr<StorageDelegate> mStorageDelegate;
342 MIP_API
static std::shared_ptr<AsyncControl> __CDECL
LoadAsync(
344 const std::shared_ptr<void>& context);
353 MIP_API
static std::shared_ptr<PolicyProfile> __CDECL
Load(
const Settings& settings);
375 virtual std::shared_ptr<AsyncControl>
ListEnginesAsync(
const std::shared_ptr<void>& context) = 0;
392 const std::string&
id,
393 const std::shared_ptr<void>& context) = 0;
411 const std::shared_ptr<void>& context) = 0;
423 const std::shared_ptr<void>& context) = 0;
433 const std::string&
id,
434 const std::shared_ptr<void>& context) = 0;
Defines the settings associated with a PolicyEngine.
Observer interface for clients to get notifications for profile related events.
virtual void OnPolicyChanged(const std::string &engineId)
Called when the policy has changed for the engine with the given ID, Or when the loaded Custom Sensit...
virtual void OnListEnginesSuccess(const std::vector< std::string > &engineIds, const std::shared_ptr< void > &context)
Called when list of engines was generated successfully.
virtual void OnDeleteEngineSuccess(const std::shared_ptr< void > &context)
Called when an engine was deleted successfully.
virtual void OnLoadFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when loading a profile caused an error.
virtual void OnAddEngineFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when adding a new engine caused an error.
virtual void OnAddEngineStarting(bool requiresPolicyFetch)
Called prior to engine creation to describe whether or not the engine's policy data must be fetched f...
virtual void OnUnloadEngineFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when unloading an engine caused an error.
virtual void OnAddEngineSuccess(const std::shared_ptr< PolicyEngine > &engine, const std::shared_ptr< void > &context)
Called when a new engine was added successfully.
virtual void OnListEnginesFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when listing engines caused an error.
virtual void OnLoadSuccess(const std::shared_ptr< PolicyProfile > &profile, const std::shared_ptr< void > &context)
Called when profile was loaded successfully.
virtual void OnDeleteEngineFailure(const std::exception_ptr &error, const std::shared_ptr< void > &context)
Called when deleting an engine caused an error.
virtual void OnUnloadEngineSuccess(const std::shared_ptr< void > &context)
Called when an engine was unloaded successfully.
Settings used by PolicyProfile during its creation and throughout its lifetime.
void SetSessionId(const std::string &sessionId)
Settings(const std::shared_ptr< MipContext > &mipContext, CacheStorageType cacheStorageType, const std::shared_ptr< PolicyProfile::Observer > &observer)
Interface for configuring the profile.
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::shared_ptr< void > & GetLoggerContext() const
Get logger context that will be opaquely passed to the logger delegate for logs associated with the c...
std::shared_ptr< StorageDelegate > GetStorageDelegate() const
Get the StorageDelegate (if any) provided by the application.
CacheStorageType GetCacheStorageType() const
Get whether caches are stored in memory or on disk.
const std::string & GetSessionId() const
void SetTaskDispatcherDelegate(const std::shared_ptr< TaskDispatcherDelegate > &taskDispatcherDelegate)
Override default asynchronous task dispatching handling with client's own.
void SetHttpDelegate(const std::shared_ptr< HttpDelegate > &httpDelegate)
Override default HTTP stack with client's own.
void SetStorageDelegate(const std::shared_ptr< StorageDelegate > &storageDelegate)
Override default storage cache with client's own implementation.
void SetCustomSettings(const std::vector< std::pair< std::string, std::string > > &customSettings)
Set the custom settings, used for feature gating and testing.
const std::shared_ptr< PolicyProfile::Observer > & GetObserver() const
Get the event observer.
std::shared_ptr< TaskDispatcherDelegate > GetTaskDispatcherDelegate() const
Get the TaskDispatcher delegate (if any) provided by the application.
const std::vector< std::pair< std::string, std::string > > & GetCustomSettings() const
Get the custom settings, used for feature gating and testing.
std::shared_ptr< MipContext > GetMipContext() const
Get MIP context which represents shared state across all profiles.
std::shared_ptr< HttpDelegate > GetHttpDelegate() const
Get the HTTP delegate (if any) provided by the application.
PolicyProfile class is the root class for using the Microsoft Information Protection operations.
virtual std::vector< std::string > ListEngines()=0
List of engines.
virtual std::shared_ptr< AsyncControl > AddEngineAsync(const PolicyEngine::Settings &settings, const std::shared_ptr< void > &context)=0
Starts adding a new policy engine to the profile.
virtual void DeleteEngine(const std::string &engineId)=0
Delete the policy engine with the given ID.
virtual std::shared_ptr< AsyncControl > DeleteEngineAsync(const std::string &id, const std::shared_ptr< void > &context)=0
Starts deleting the policy engine with the given ID.
virtual std::shared_ptr< PolicyEngine > AddEngine(const PolicyEngine::Settings &settings, const std::shared_ptr< void > &context)=0
Add a new policy engine to the profile.
virtual std::shared_ptr< AsyncControl > UnloadEngineAsync(const std::string &id, const std::shared_ptr< void > &context)=0
Starts unloading the policy engine with the given ID.
static MIP_API std::shared_ptr< PolicyProfile > __CDECL Load(const Settings &settings)
Loading a profile based on the provided settings.
static MIP_API const char *__CDECL GetVersion()
Get the library version.
virtual const Settings & GetSettings() const =0
Get the settings set on the profile.
virtual std::shared_ptr< AsyncControl > ListEnginesAsync(const std::shared_ptr< void > &context)=0
Starts list engines operation.
static MIP_API std::shared_ptr< AsyncControl > __CDECL LoadAsync(const Settings &settings, const std::shared_ptr< void > &context)
Starts loading a profile based on the provided settings.
virtual void UnloadEngine(const std::string &id)=0
Starts unloading the policy engine with the given ID.
virtual void AcquireAuthToken(Cloud cloud, const std::shared_ptr< AuthDelegate > &authDelegate) const =0
Trigger an authentication callback.
A file Containing the common types used by the upe, file and protection modules.
Cloud
Azure cloud identifier.
CacheStorageType
Storage type for the caches.
A file containing the MIP SDK error types.
Contains HttpDelegate interface definition used to override MIP HTTP stack.
A file containing the LoggerDelegate class to be used to override MIP logger.
File containing definition of MipContext.
A file export/import macros.
This file contains the PolicyEngine class which includes the PolicyEngine::Settings class.
A file containing the TaskDispatcherDelegate interface to be used to override MIP async task executor...