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

Settings used by ProtectionEngine during its creation and throughout its lifetime. More...

#include <src/api/mip/protection/protection_engine.h>

Public Member Functions

MIP_API void AddRmsCapability (const std::string &capability)
 Add a capability which will be passed along to RMS when fetching usage rights.
 
bool GetAllowCloudServiceOnly () const
 Gets whether or not only cloud service is allowed.
 
std::shared_ptr< AuthDelegateGetAuthDelegate () const
 Get the Engine Auth Delegate.
 
const std::string & GetClientData () const
 Gets custom data specified by client.
 
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::vector< std::pair< std::string, std::string > > & GetCustomSettings () const
 Gets name/value pairs used for testing and experimentation.
 
DataBoundary GetDataBoundary () const
 Gets the data boundary region.
 
const std::string & GetEngineId () const
 Gets the engine ID.
 
const IdentityGetIdentity () const
 Gets the user Identity associated with the engine.
 
const std::string & GetLocale () const
 Gets the locale in which engine data will be written.
 
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.
 
std::vector< std::string > GetRmsCapabilities () const
 The the full set of client capabilities supported when fetching usage rights from RMS.
 
const std::string & GetSessionId () const
 Gets the engine session ID.
 
int GetTemplateBatchSize () const
 Gets the number of templates to be requested in each batch during GetTemplates.
 
std::chrono::hours GetTemplateRefreshInterval () const
 Gets the refresh rate of the protection templates.
 
const std::string & GetUnderlyingApplicationId () const
 Gets the Underlying Application ID.
 
MIP_API bool RemoveRmsCapability (const std::string &capability)
 Remove one of the added usage rights capabilities which get passed to RMS.
 
void SetAllowCloudServiceOnly (bool allowCloudServiceOnly)
 Sets whether or not only cloud service is allowed.
 
void SetAuthDelegate (const std::shared_ptr< AuthDelegate > &authDelegate)
 Set the Engine Auth Delegate.
 
void SetClientData (const std::string &clientData)
 Sets custom data specified by client.
 
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 > > &value)
 Sets name/value pairs used for testing and experimentation.
 
void SetDataBoundary (DataBoundary dataBoundary)
 Optionally sets the target diagnostic region.
 
void SetEngineId (const std::string &engineId)
 Sets the engine ID.
 
void SetIdentity (const Identity &identity)
 Sets the user Identity associated with the engine.
 
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)
 Sets the engine session ID, used for correlation of logging/telemetry.
 
void SetTemplateRefreshArgs (std::chrono::hours templateRefreshRateHours, int templateBatchSize=kMaxTemplateBatchNum)
 Sets a custom refresh rate for templates.
 
 Settings (const Identity &identity, const std::shared_ptr< AuthDelegate > &authDelegate, const std::string &clientData, const std::string &locale="")
 ProtectionEngine::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="")
 ProtectionEngine::Settings constructor for loading an existing engine.
 
void SetUnderlyingApplicationId (const std::string &underlyingApplicationId)
 Sets the Underlying Application ID.
 

Detailed Description

Settings used by ProtectionEngine during its creation and throughout its lifetime.

Definition at line 309 of file protection_engine.h.

Constructor & Destructor Documentation

◆ Settings() [1/2]

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

ProtectionEngine::Settings constructor for creating a new engine.

Parameters
identityIdentity that will be associated with ProtectionEngine
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 and can be retrieved from a loaded engine.
localeEngine output will be provided in this locale.

Definition at line 322 of file protection_engine.h.

327 : mIdentity(identity),
328 mAuthDelegate(authDelegate),
329 mClientData(clientData),
330 mLocale(locale),
331 mAllowCloudServiceOnly(false),
332 mTemplateRefreshRate(std::chrono::hours::zero()),
333 mTemplateBatchSize(kMaxTemplateBatchNum) {
334 if (mLocale.compare("") == 0) {
335 mLocale = "en-US";
336 }
337 }

◆ Settings() [2/2]

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

ProtectionEngine::Settings constructor for loading an existing engine.

Parameters
engineIdUnique identifier of engine that will be loaded
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 and can be retrieved from a loaded engine.
localeEngine output will be provided in this locale.

Definition at line 350 of file protection_engine.h.

355 : mEngineId(engineId),
356 mAuthDelegate(authDelegate),
357 mClientData(clientData),
358 mLocale(locale),
359 mAllowCloudServiceOnly(false),
360 mTemplateRefreshRate(std::chrono::hours::zero()),
361 mTemplateBatchSize(kMaxTemplateBatchNum) {
362 if (mLocale.compare("") == 0) {
363 mLocale = "en-US";
364 }
365 }

Member Function Documentation

◆ AddRmsCapability()

MIP_API void ProtectionEngine::Settings::AddRmsCapability ( const std::string & capability)

Add a capability which will be passed along to RMS when fetching usage rights.

Parameters
capabilityThe header representing a capability that RMS should support

◆ GetAllowCloudServiceOnly()

bool ProtectionEngine::Settings::GetAllowCloudServiceOnly ( ) const
inline

Gets whether or not only cloud service is allowed.

Returns
A boolean value indicating whether or not only cloud service is allowed

Definition at line 544 of file protection_engine.h.

544{ return mAllowCloudServiceOnly; }

◆ GetAuthDelegate()

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

Get the Engine Auth Delegate.

Returns
the Engine Auth Delegate.

Definition at line 523 of file protection_engine.h.

523{ return mAuthDelegate; }

◆ GetClientData()

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

Gets custom data specified by client.

Returns
Custom data specified by client

Definition at line 400 of file protection_engine.h.

400{ return mClientData; }

◆ GetCloud()

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

Gets the target cloud used by all service requests.

Returns
cloud

Definition at line 465 of file protection_engine.h.

465 {
466 return mCloud;
467 }

◆ GetCloudEndpointBaseUrl()

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

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

Returns
base URL

Definition at line 505 of file protection_engine.h.

505 {
506 return mCloudEndpointBaseUrl;
507 }

◆ GetCustomSettings()

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

Gets name/value pairs used for testing and experimentation.

Returns
Name/value pairs used for testing and experimentation

Definition at line 428 of file protection_engine.h.

428{ return mCustomSettings; }

◆ GetDataBoundary()

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

Gets the data boundary region.

Returns
DataBoundary

Definition at line 485 of file protection_engine.h.

485 {
486 return mDataBoundary;
487 }

◆ GetEngineId()

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

Gets the engine ID.

Returns
Engine ID

Definition at line 372 of file protection_engine.h.

372{ return mEngineId; }

◆ GetIdentity()

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

Gets the user Identity associated with the engine.

Returns
User Identity associated with the engine

Definition at line 386 of file protection_engine.h.

386{ return mIdentity; }

◆ GetLocale()

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

Gets the locale in which engine data will be written.

Returns
Locale in which engine data will be written

Definition at line 414 of file protection_engine.h.

414{ return mLocale; }

◆ GetLoggerContext()

const std::shared_ptr< void > & ProtectionEngine::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 619 of file protection_engine.h.

619{ return mLoggerContext; }

◆ GetRmsCapabilities()

std::vector< std::string > ProtectionEngine::Settings::GetRmsCapabilities ( ) const
inline

The the full set of client capabilities supported when fetching usage rights from RMS.

Definition at line 611 of file protection_engine.h.

611{ return mCapabilities; }

◆ GetSessionId()

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

Gets the engine session ID.

Returns
Engine session ID

Definition at line 444 of file protection_engine.h.

444 {
445 return mSessionId;
446 }

◆ GetTemplateBatchSize()

int ProtectionEngine::Settings::GetTemplateBatchSize ( ) const
inline

Gets the number of templates to be requested in each batch during GetTemplates.

Returns
The number of full template data requests per batch if offline publishing is enabled

Definition at line 567 of file protection_engine.h.

567{ return mTemplateBatchSize; }

◆ GetTemplateRefreshInterval()

std::chrono::hours ProtectionEngine::Settings::GetTemplateRefreshInterval ( ) const
inline

Gets the refresh rate of the protection templates.

Returns
The refresh rate of protection templates as chrono::hours
Note
A refresh rate of 0 hours means that templates will always be fetched from the service and never cached

Definition at line 560 of file protection_engine.h.

560{ return mTemplateRefreshRate; }

◆ GetUnderlyingApplicationId()

const std::string & ProtectionEngine::Settings::GetUnderlyingApplicationId ( ) const
inline

Gets the Underlying Application ID.

Returns
Underlying Application ID

Definition at line 530 of file protection_engine.h.

530{ return mUnderlyingApplicationId; }

◆ RemoveRmsCapability()

MIP_API bool ProtectionEngine::Settings::RemoveRmsCapability ( const std::string & capability)

Remove one of the added usage rights capabilities which get passed to RMS.

Parameters
capabilityThe capability which should be removed.

◆ SetAllowCloudServiceOnly()

void ProtectionEngine::Settings::SetAllowCloudServiceOnly ( bool allowCloudServiceOnly)
inline

Sets whether or not only cloud service is allowed.

Parameters
allowCloudServiceOnlyA boolean value indicating whether or not only cloud service is allowed

Definition at line 551 of file protection_engine.h.

551{ mAllowCloudServiceOnly = allowCloudServiceOnly; }

◆ SetAuthDelegate()

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

Set the Engine Auth Delegate.

Parameters
authDelegatethe Auth delegate

Definition at line 514 of file protection_engine.h.

514 {
515 mAuthDelegate = authDelegate;
516 }

◆ SetClientData()

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

Sets custom data specified by client.

Parameters
Customdata specified by client

Definition at line 407 of file protection_engine.h.

407{ mClientData = clientData; }

◆ SetCloud()

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

Optionally sets the target cloud.

Parameters
CloudCloud
Note
If cloud is not specified, then it will be determined by DNS lookup of the engine's identity domain if possible, else fall back to global cloud.

Definition at line 456 of file protection_engine.h.

456 {
457 mCloud = cloud;
458 }

◆ SetCloudEndpointBaseUrl()

void ProtectionEngine::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://api.aadrm.com")
Note
This value will only be read and must be set for Cloud = Custom

Definition at line 496 of file protection_engine.h.

496 {
497 mCloudEndpointBaseUrl = cloudEndpointBaseUrl;
498 }

◆ SetCustomSettings()

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

Sets name/value pairs used for testing and experimentation.

Parameters
customSettingsName/value pairs used for testing and experimentation

Definition at line 421 of file protection_engine.h.

421{ mCustomSettings = value; }

◆ SetDataBoundary()

void ProtectionEngine::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 476 of file protection_engine.h.

476 {
477 mDataBoundary = dataBoundary;
478 }

◆ SetEngineId()

void ProtectionEngine::Settings::SetEngineId ( const std::string & engineId)
inline

Sets the engine ID.

Parameters
engineIdengine ID.

Definition at line 379 of file protection_engine.h.

379{ mEngineId = engineId; }

◆ SetIdentity()

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

Sets the user Identity associated with the engine.

Parameters
identityUser Identity associated with the engine

Definition at line 393 of file protection_engine.h.

393{ mIdentity = identity; }

◆ SetLoggerContext()

void ProtectionEngine::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 628 of file protection_engine.h.

628 {
629 mLoggerContext = loggerContext;
630 }

◆ SetSessionId()

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

Sets the engine session ID, used for correlation of logging/telemetry.

Parameters
sessionIdEngine session ID, used for correlation of logging/telemetry

Definition at line 435 of file protection_engine.h.

435 {
436 mSessionId = sessionId;
437 }

◆ SetTemplateRefreshArgs()

void ProtectionEngine::Settings::SetTemplateRefreshArgs ( std::chrono::hours templateRefreshRateHours,
int templateBatchSize = kMaxTemplateBatchNum )
inline

Sets a custom refresh rate for templates.

Warning
Engines will not refresh automatically on that interval, only on engine call to GetTemplates or GetTemplatesAsync
Parameters
templateRefreshRateHoursHow often to allow use of cached templates for protection. will always refresh by default. If hours are less than 0 will throw exception.
templateBatchSizeIf offline protection is enabled, how many template data responses are carried in a single request during fetching. Between 1 and 25.
Note
Will only refresh templates if outside of interval during an API that uses them. Will not automatically refresh in background.

Definition at line 582 of file protection_engine.h.

582 {
583 if (templateRefreshRateHours < std::chrono::hours::zero()) {
584 throw BadInputError("Template refresh interval is outside acceptable range.");
585 }
586 mTemplateRefreshRate = templateRefreshRateHours;
587
588 if (templateBatchSize < kMinTemplateBatchNum || templateBatchSize > kMaxTemplateBatchNum) {
589 throw BadInputError("Template batch size is outside acceptable range.");
590 }
591 mTemplateBatchSize = templateBatchSize;
592 }
Bad input error, thrown when the input to an SDK API is invalid.
Definition error.h:247

◆ SetUnderlyingApplicationId()

void ProtectionEngine::Settings::SetUnderlyingApplicationId ( const std::string & underlyingApplicationId)
inline

Sets the Underlying Application ID.

Parameters
UnderlyingApplicationIdUnderlying Application ID.

Definition at line 537 of file protection_engine.h.

537{ mUnderlyingApplicationId = underlyingApplicationId; }

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