Microsoft Information Protection (MIP) SDK for C++: Reference 1.15
Doxygen-generated documentation for MIP SDK written in C++
Loading...
Searching...
No Matches
PolicyEngine::Settings Class Reference

Defines the settings associated with a PolicyEngine. More...

#include <src/api/mip/upe/policy_engine.h>

Public Member Functions

void ConfigureFunctionality (FunctionalityFilterType functionalityFilterType, bool enabled)
 Enables or disables functionality.
 
std::shared_ptr< AuthDelegateGetAuthDelegate () const
 Get the Engine Auth Delegate.
 
const std::string & GetClientData () const
 Get the Client Data set in the settings.
 
Cloud GetCloud () const
 Gets the target cloud used by all service requests.
 
const std::string & GetCloudEndpointBaseUrl () const
 Gets the cloud base URL used by all service requests, if specified.
 
const std::map< FunctionalityFilterType, bool > & GetConfiguredFunctionality () const
 Gets the configured functionality.
 
const std::vector< std::pair< std::string, std::string > > & GetCustomSettings () const
 Get the custom settings, used for feature gating and testing.
 
DataBoundary GetDataBoundary () const
 Gets the data boundary region.
 
const std::string & GetDelegatedUserEmail () const
 Gets the delegated user.
 
const std::string & GetEngineId () const
 Get the engine ID.
 
const IdentityGetIdentity () const
 Get the Identity object.
 
const std::vector< LabelFilterType > & GetLabelFilter () const
 Gets the label filters set through deprecated function SetLabelFilter.
 
const std::string & GetLocale () const
 Get the Locale set in the settings.
 
const std::shared_ptr< void > & GetLoggerContext () const
 Get logger context that will be opaquely passed to the logger delegate for logs associated with the created engine.
 
const std::string & GetSessionId () const
 Get the session ID, a unique identifier.
 
VariableTextMarkingType GetVariableTextMarkingType () const
 Gets the variable text marking type.
 
bool IsLoadSensitivityTypesEnabled () const
 Get the the flag indicating if load sensitivity labels is enabled.
 
void SetAuthDelegate (const std::shared_ptr< AuthDelegate > &authDelegate)
 Set the Engine Auth Delegate.
 
void SetClientData (const std::string &clientData)
 Set the Client Data string.
 
void SetCloud (Cloud cloud)
 Optionally sets the target cloud.
 
void SetCloudEndpointBaseUrl (const std::string &cloudEndpointBaseUrl)
 Sets the cloud endpoint base URL for custom cloud.
 
void SetCustomSettings (const std::vector< std::pair< std::string, std::string > > &customSettings)
 Set the custom settings, used for feature gating and testing.
 
void SetDataBoundary (DataBoundary dataBoundary)
 Optionally sets the target diagnostic region.
 
void SetDelegatedUserEmail (const std::string &delegatedUserEmail)
 Sets the delegated user.
 
void SetEngineId (const std::string &id)
 Set the engine ID.
 
void SetIdentity (const Identity &identity)
 Set the Identity object.
 
void SetLabelFilter (const std::vector< LabelFilterType > &deprecatedLabelFilters)
 Sets the label filter.
 
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 the created engine.
 
void SetSessionId (const std::string &sessionId)
 Set the session ID, used for client defined telemetry and to make it easier to correlate application events with the corresponding policy service REST requests.
 
 Settings (const Identity &identity, const std::shared_ptr< AuthDelegate > &authDelegate, const std::string &clientData, const std::string &locale="", bool loadSensitivityTypes=false)
 PolicyEngine::Settings constructor for creating a new engine.
 
 Settings (const std::string &engineId, const std::shared_ptr< AuthDelegate > &authDelegate, const std::string &clientData, const std::string &locale="", bool loadSensitivityTypes=false)
 PolicyEngine::Settings constructor for loading an existing engine.
 
void SetVariableTextMarkingType (VariableTextMarkingType variableTextMarkingType)
 Sets the variable text marking type.
 

Detailed Description

Defines the settings associated with a PolicyEngine.

Definition at line 60 of file policy_engine.h.

Constructor & Destructor Documentation

◆ Settings() [1/2]

PolicyEngine::Settings::Settings ( const std::string & engineId,
const std::shared_ptr< AuthDelegate > & authDelegate,
const std::string & clientData,
const std::string & locale = "",
bool loadSensitivityTypes = false )
inline

PolicyEngine::Settings constructor for loading an existing engine.

Parameters
engineIdSet it to the unique engine ID generated by AddEngineAsync or one self-generated. When loading an existing engine, reuse the ID else a new engine will be created.
authDelegateThe authentication delegate used by the SDK to acquire authentication tokens, will override the PolicyProfile::Settings::authDelegate if both provided
clientDatacustomizable client data that can be stored with the engine when unloaded, can be retrieved from a loaded engine.
localeengine localizable output will be provided in this locale.
Optionalflag indicating when the engine is loaded should load also custom sensitivity types, if true OnPolicyChange Observer on the profile will be invoked on updates to custom sensitivity types as well as policy changes. if false ListSensitivityTypes call will always return an empty list.

Definition at line 76 of file policy_engine.h.

82 : mEngineId(engineId),
83 mAuthDelegate(authDelegate),
84 mClientData(clientData),
85 mLocale(locale),
86 mIsLoadSensitivityTypesEnabled(loadSensitivityTypes) {
87 if (mLocale.compare("") == 0) {
88 mLocale = "en-US";
89 }
90 }

◆ Settings() [2/2]

PolicyEngine::Settings::Settings ( const Identity & identity,
const std::shared_ptr< AuthDelegate > & authDelegate,
const std::string & clientData,
const std::string & locale = "",
bool loadSensitivityTypes = false )
inline

PolicyEngine::Settings constructor for creating a new engine.

Parameters
identityIdentity info of the user associated with the new engine.
authDelegateThe authentication delegate used by the SDK to acquire authentication tokens, will override the PolicyProfile::Settings::authDelegate if both provided
clientDatacustomizable client data that can be stored with the engine when unloaded, can be retrieved from a loaded engine.
localeengine localizable output will be provided in this locale.
Optionalflag indicating when the engine is loaded should load also custom sensitivity types, if true OnPolicyChange Observer on the profile will be invoked on updates to custom sensitivity types as well as policy changes. if false ListSensitivityTypes call will always return an empty list.

Definition at line 105 of file policy_engine.h.

111 : mIdentity(identity),
112 mAuthDelegate(authDelegate),
113 mClientData(clientData),
114 mLocale(locale),
115 mIsLoadSensitivityTypesEnabled(loadSensitivityTypes) {
116 if (mLocale.compare("") == 0) {
117 mLocale = "en-US";
118 }
119 }

Member Function Documentation

◆ ConfigureFunctionality()

void PolicyEngine::Settings::ConfigureFunctionality ( FunctionalityFilterType functionalityFilterType,
bool enabled )
inline

Enables or disables functionality.

Parameters
functionalityFilterTypethe type of functionality.
enabledTrue to enable, false to disable
Note
HyokProtection, DoubleKeyProtection, DoubleKeyUserDefinedProtection are disabled by default and must be enabled

Definition at line 327 of file policy_engine.h.

327 {
328 if(functionalityFilterType == FunctionalityFilterType::None) {
329 throw BadInputError(
330 "FunctionalityFilterType::None is not supported");
331 }
332
333 mConfiguredFunctionality[functionalityFilterType] = enabled;
334 }
Bad input error, thrown when the input to an SDK API is invalid.
Definition error.h:247
@ None
Disable default labeling filtration.

References None.

◆ GetAuthDelegate()

std::shared_ptr< AuthDelegate > PolicyEngine::Settings::GetAuthDelegate ( ) const
inline

Get the Engine Auth Delegate.

Returns
the Engine Auth Delegate.

Definition at line 377 of file policy_engine.h.

377{ return mAuthDelegate; }

◆ GetClientData()

const std::string & PolicyEngine::Settings::GetClientData ( ) const
inline

Get the Client Data set in the settings.

Returns
a string of data specified by the client.

Definition at line 156 of file policy_engine.h.

156{ return mClientData; }

◆ GetCloud()

Cloud PolicyEngine::Settings::GetCloud ( ) const
inline

Gets the target cloud used by all service requests.

Returns
cloud

Definition at line 234 of file policy_engine.h.

234 {
235 return mCloud;
236 }

◆ GetCloudEndpointBaseUrl()

const std::string & PolicyEngine::Settings::GetCloudEndpointBaseUrl ( ) const
inline

Gets the cloud base URL used by all service requests, if specified.

Returns
base URL

Definition at line 274 of file policy_engine.h.

274 {
275 return mCloudEndpointBaseUrl;
276 }

◆ GetConfiguredFunctionality()

const std::map< FunctionalityFilterType, bool > & PolicyEngine::Settings::GetConfiguredFunctionality ( ) const
inline

Gets the configured functionality.

Returns
A map of the types to a boolean value indicating whether or not it is enabled

Definition at line 341 of file policy_engine.h.

341{ return mConfiguredFunctionality; }

◆ GetCustomSettings()

const std::vector< std::pair< std::string, std::string > > & PolicyEngine::Settings::GetCustomSettings ( ) const
inline

Get the custom settings, used for feature gating and testing.

Returns
List of name/value pairs.

Definition at line 186 of file policy_engine.h.

186 {
187 return mCustomSettings;
188 }

◆ GetDataBoundary()

DataBoundary PolicyEngine::Settings::GetDataBoundary ( ) const
inline

Gets the data boundary region.

Returns
DataBoundary

Definition at line 254 of file policy_engine.h.

254 {
255 return mDataBoundary;
256 }

◆ GetDelegatedUserEmail()

const std::string & PolicyEngine::Settings::GetDelegatedUserEmail ( ) const
inline

Gets the delegated user.

Returns
Delegated user
Note
A delegated user is specified when the authenticating user/application is acting on behalf of another user

Definition at line 294 of file policy_engine.h.

294{ return mDelegatedUserEmail; }

◆ GetEngineId()

const std::string & PolicyEngine::Settings::GetEngineId ( ) const
inline

Get the engine ID.

Returns
a unique string identifying the engine.

Definition at line 126 of file policy_engine.h.

126{ return mEngineId; }

◆ GetIdentity()

const Identity & PolicyEngine::Settings::GetIdentity ( ) const
inline

Get the Identity object.

Returns
a reference to the identity in the settings object.
See also
mip::Identity

Definition at line 141 of file policy_engine.h.

141{ return mIdentity; }

◆ GetLabelFilter()

const std::vector< LabelFilterType > & PolicyEngine::Settings::GetLabelFilter ( ) const
inline

Gets the label filters set through deprecated function SetLabelFilter.

Returns
the label filter.
Note
Labels are by default filter to scope, this api is to allow filtering by possible actions.

Definition at line 317 of file policy_engine.h.

317{ return mDeprecatedLabelFilters; }

◆ GetLocale()

const std::string & PolicyEngine::Settings::GetLocale ( ) const
inline

Get the Locale set in the settings.

Returns
the locale.

Definition at line 170 of file policy_engine.h.

170{ return mLocale; }

◆ GetLoggerContext()

const std::shared_ptr< void > & PolicyEngine::Settings::GetLoggerContext ( ) const
inline

Get logger context that will be opaquely passed to the logger delegate for logs associated with the created engine.

Returns
The logger context

Definition at line 385 of file policy_engine.h.

385{ return mLoggerContext; }

◆ GetSessionId()

const std::string & PolicyEngine::Settings::GetSessionId ( ) const
inline

Get the session ID, a unique identifier.

Returns
the session ID.

Definition at line 205 of file policy_engine.h.

205 {
206 return mSessionId;
207 }

◆ GetVariableTextMarkingType()

VariableTextMarkingType PolicyEngine::Settings::GetVariableTextMarkingType ( ) const
inline

Gets the variable text marking type.

Returns
the variable text marking type.

Definition at line 359 of file policy_engine.h.

359 {
360 return mVariableTextMarkingType;
361 }

◆ IsLoadSensitivityTypesEnabled()

bool PolicyEngine::Settings::IsLoadSensitivityTypesEnabled ( ) const
inline

Get the the flag indicating if load sensitivity labels is enabled.

Returns
true if enabled else false.

Definition at line 214 of file policy_engine.h.

214 {
215 return mIsLoadSensitivityTypesEnabled;
216 }

◆ SetAuthDelegate()

void PolicyEngine::Settings::SetAuthDelegate ( const std::shared_ptr< AuthDelegate > & authDelegate)
inline

Set the Engine Auth Delegate.

Parameters
authDelegatethe Auth delegate

Definition at line 368 of file policy_engine.h.

368 {
369 mAuthDelegate = authDelegate;
370 }

◆ SetClientData()

void PolicyEngine::Settings::SetClientData ( const std::string & clientData)
inline

Set the Client Data string.

Parameters
clientDatauser specified data.

Definition at line 163 of file policy_engine.h.

163{ mClientData = clientData; }

◆ SetCloud()

void PolicyEngine::Settings::SetCloud ( Cloud cloud)
inline

Optionally sets the target cloud.

Parameters
cloudCloud
Note
If cloud is not specified, then it will default to commercial cloud.

Definition at line 225 of file policy_engine.h.

225 {
226 mCloud = cloud;
227 }

◆ SetCloudEndpointBaseUrl()

void PolicyEngine::Settings::SetCloudEndpointBaseUrl ( const std::string & cloudEndpointBaseUrl)
inline

Sets the cloud endpoint base URL for custom cloud.

Parameters
cloudEndpointBaseUrlthe base URL used by all service requests (for example, "https://dataservice.protection.outlook.com")
Note
This value will only be read and must be set for Cloud = Custom

Definition at line 265 of file policy_engine.h.

265 {
266 mCloudEndpointBaseUrl = cloudEndpointBaseUrl;
267 }

◆ SetCustomSettings()

void PolicyEngine::Settings::SetCustomSettings ( const std::vector< std::pair< std::string, std::string > > & customSettings)
inline

Set the custom settings, used for feature gating and testing.

Parameters
customSettingsList of name/value pairs.

Definition at line 177 of file policy_engine.h.

177 {
178 mCustomSettings = customSettings;
179 }

◆ SetDataBoundary()

void PolicyEngine::Settings::SetDataBoundary ( DataBoundary dataBoundary)
inline

Optionally sets the target diagnostic region.

Parameters
dataBoundaryData boundary region
Note
If dataBoundary is not specified, then it will default to global diagnostic region.

Definition at line 245 of file policy_engine.h.

245 {
246 mDataBoundary = dataBoundary;
247 }

◆ SetDelegatedUserEmail()

void PolicyEngine::Settings::SetDelegatedUserEmail ( const std::string & delegatedUserEmail)
inline

Sets the delegated user.

Parameters
delegatedUserEmailthe delegation email.
Note
A delegated user is specified when the authenticating user/application is acting on behalf of another user

Definition at line 285 of file policy_engine.h.

285{ mDelegatedUserEmail = delegatedUserEmail; }

◆ SetEngineId()

void PolicyEngine::Settings::SetEngineId ( const std::string & id)
inline

Set the engine ID.

Parameters
idengine ID.

Definition at line 133 of file policy_engine.h.

133{ mEngineId = id; }

◆ SetIdentity()

void PolicyEngine::Settings::SetIdentity ( const Identity & identity)
inline

Set the Identity object.

Parameters
identitythe unique identity of a user.
See also
mip::Identity

Definition at line 149 of file policy_engine.h.

149{ mIdentity = identity; }

◆ SetLabelFilter()

void PolicyEngine::Settings::SetLabelFilter ( const std::vector< LabelFilterType > & deprecatedLabelFilters)
inline

Sets the label filter.

Parameters
labelFilterthe label filter.
Note
Labels are by default filter to scope, this api is to allow filtering by possible actions.
If not set HyokProtection and DoubleKeyProtection are filtered.

Definition at line 307 of file policy_engine.h.

307 {
308 mDeprecatedLabelFilters = deprecatedLabelFilters;
309 }

◆ SetLoggerContext()

void PolicyEngine::Settings::SetLoggerContext ( const std::shared_ptr< void > & loggerContext)
inline

Sets the logger context that will be opaquely passed to the logger delegate for logs associated with the created engine.

Parameters
loggerContextThe logger context

Definition at line 393 of file policy_engine.h.

393 {
394 mLoggerContext = loggerContext;
395 }

◆ SetSessionId()

void PolicyEngine::Settings::SetSessionId ( const std::string & sessionId)
inline

Set the session ID, used for client defined telemetry and to make it easier to correlate application events with the corresponding policy service REST requests.

Parameters
sessionIdAn identifier (usually specified as a GUID) to uniquely identify this operation.

Definition at line 196 of file policy_engine.h.

196 {
197 mSessionId = sessionId;
198 }

◆ SetVariableTextMarkingType()

void PolicyEngine::Settings::SetVariableTextMarkingType ( VariableTextMarkingType variableTextMarkingType)
inline

Sets the variable text marking type.

Parameters
variableTextMarkingTypethe variable text marking type.

Definition at line 349 of file policy_engine.h.

349 {
350 mVariableTextMarkingType = variableTextMarkingType;
351 }

The documentation for this class was generated from the following file: