34#ifndef API_MIP_UPE_POLICY_PROFILE_H_
35#define API_MIP_UPE_POLICY_PROFILE_H_
74 virtual void OnLoadSuccess(
75 const std::shared_ptr<PolicyProfile>& profile,
76 const std::shared_ptr<void>& context) { UNUSED(profile); UNUSED(context); }
84 virtual void OnLoadFailure(
85 const std::exception_ptr& error,
86 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
94 virtual void OnListEnginesSuccess(
95 const std::vector<std::string>& engineIds,
96 const std::shared_ptr<void>& context) { UNUSED(engineIds); UNUSED(context); }
104 virtual void OnListEnginesFailure(
105 const std::exception_ptr& error,
106 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
113 virtual void OnUnloadEngineSuccess(
const std::shared_ptr<void>& context) { UNUSED(context); }
121 virtual void OnUnloadEngineFailure(
122 const std::exception_ptr& error,
123 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
131 virtual void OnAddEngineSuccess(
132 const std::shared_ptr<PolicyEngine>& engine,
133 const std::shared_ptr<void>& context) { UNUSED(engine); UNUSED(context); }
144 virtual void OnAddEngineStarting(
bool requiresPolicyFetch) { UNUSED(requiresPolicyFetch); }
152 virtual void OnAddEngineFailure(
153 const std::exception_ptr& error,
154 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
161 virtual void OnDeleteEngineSuccess(
const std::shared_ptr<void>& context) { UNUSED(context); }
169 virtual void OnDeleteEngineFailure(
170 const std::exception_ptr& error,
171 const std::shared_ptr<void>& context) { UNUSED(error); UNUSED(context); }
180 virtual void OnPolicyChanged(
const std::string& engineId) { UNUSED(engineId); }
183 virtual ~Observer() { }
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; }
228 std::shared_ptr<MipContext> GetMipContext()
const {
return mMipContext; }
235 std::shared_ptr<HttpDelegate> GetHttpDelegate()
const {
return mHttpDelegate; }
242 void SetHttpDelegate(
const std::shared_ptr<HttpDelegate>& httpDelegate) { mHttpDelegate = httpDelegate; }
249 std::shared_ptr<StorageDelegate> GetStorageDelegate()
const {
return mStorageDelegate; }
256 void SetStorageDelegate(
const std::shared_ptr<StorageDelegate>& storageDelegate) { mStorageDelegate = storageDelegate; }
263 std::shared_ptr<TaskDispatcherDelegate> GetTaskDispatcherDelegate()
const {
return mTaskDispatcherDelegate; }
273 void SetTaskDispatcherDelegate(
const std::shared_ptr<TaskDispatcherDelegate>& taskDispatcherDelegate) {
274 mTaskDispatcherDelegate = taskDispatcherDelegate;
277 void SetSessionId(
const std::string& sessionId) {
278 mSessionId = sessionId;
281 const std::string& GetSessionId()
const {
290 void SetCustomSettings(
const std::vector<std::pair<std::string, std::string>>& customSettings) {
291 mCustomSettings = customSettings;
299 const std::vector<std::pair<std::string, std::string>>& GetCustomSettings()
const {
300 return mCustomSettings;
302#if !defined(SWIG) && !defined(SWIG_DIRECTORS)
308 const std::shared_ptr<void>& GetLoggerContext()
const {
return mLoggerContext; }
316 void SetLoggerContext(
const std::shared_ptr<void>& loggerContext) {
317 mLoggerContext = loggerContext;
322 std::shared_ptr<MipContext> mMipContext;
324 std::shared_ptr<PolicyProfile::Observer> mObserver;
325 std::shared_ptr<HttpDelegate> mHttpDelegate;
326 std::shared_ptr<TaskDispatcherDelegate> mTaskDispatcherDelegate;
327 std::string mSessionId;
328 std::vector<std::pair<std::string, std::string>> mCustomSettings;
329 std::shared_ptr<void> mLoggerContext;
330 std::shared_ptr<StorageDelegate> mStorageDelegate;
341 MIP_API
static std::shared_ptr<AsyncControl> __CDECL
LoadAsync(
342 const Settings& settings,
343 const std::shared_ptr<void>& context);
352 MIP_API
static std::shared_ptr<PolicyProfile> __CDECL
Load(
const Settings& settings);
374 virtual std::shared_ptr<AsyncControl>
ListEnginesAsync(
const std::shared_ptr<void>& context) = 0;
391 const std::string&
id,
392 const std::shared_ptr<void>& context) = 0;
409 const PolicyEngine::Settings& settings,
410 const std::shared_ptr<void>& context) = 0;
421 const PolicyEngine::Settings& settings,
422 const std::shared_ptr<void>& context) = 0;
432 const std::string&
id,
433 const std::shared_ptr<void>& context) = 0;
464 virtual void AcquireAuthToken(
const std::string& domainInfo,
const std::shared_ptr<AuthDelegate>& authDelegate)
const = 0;
467 virtual ~PolicyProfile() { }
A file Containing the common types used by the upe, file and protection modules.
Cloud
Azure cloud identifier.
Definition common_types.h:752
CacheStorageType
Storage type for the caches.
Definition common_types.h:734
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.
virtual std::shared_ptr< AsyncControl > ListEnginesAsync(const std::shared_ptr< void > &context)=0
Starts list engines operation.
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< 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 > DeleteEngineAsync(const std::string &id, const std::shared_ptr< void > &context)=0
Starts deleting the policy engine with the given ID. All data for the given profile will be deleted.
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< 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 DeleteEngine(const std::string &engineId)=0
Delete the policy engine with the given ID. All data for the given engine will be deleted.
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 AcquireAuthToken(Cloud cloud, const std::shared_ptr< AuthDelegate > &authDelegate) const =0
Trigger an authentication callback.
A file containing the TaskDispatcherDelegate interface to be used to override MIP async task executor...