33#ifndef API_MIP_COMMON_TYPES_H_
34#define API_MIP_COMMON_TYPES_H_
41#include <unordered_map>
48#define UNUSED(x) (void)x
101 static const std::string fileContentFormat =
"file";
102 return fileContentFormat;
106 static const std::string emailContentFormat =
"email";
107 return emailContentFormat;
178enum class ContainerDecryptionOption :
unsigned int {
191inline std::string ContainerDecryptionOptionString(ContainerDecryptionOption option) {
192 static std::string kMethodArray[] = {
"default",
"msg",
"top",
"all" };
193 return kMethodArray[
static_cast<int>(option)];
229 static std::string kMethodArray[] = {
"Standard",
"Privileged",
"Auto" };
230 return kMethodArray[
static_cast<int>(method)];
240 static std::string kMethodArray[] = {
"Manual",
"Automatic",
"Recommended",
"Default" };
241 return kMethodArray[
static_cast<int>(actionSource)];
251 static std::string kMethodArray[] = {
"Rest",
"Motion",
"Use" };
252 return kMethodArray[
static_cast<int>(state)];
257 static const std::string sqliteExtension =
".sqlite3";
258 return sqliteExtension;
263 static const std::string memoryPath =
":memory:";
338 const std::string& authority,
339 const std::string& resource,
340 const std::string& scope = std::string(),
341 const std::string& claims = std::string())
447 OAuth2Token& token) { UNUSED(identity); UNUSED(challenge); UNUSED(token);
return false; }
466 const std::shared_ptr<void>& context,
535 return "policy_data";
543 return "export_policy_file";
551 return "sensitivity_types_data";
559 return "policy_file";
567 return "sensitivity_types_file";
575 return "label_custom_properties_sync_enabled";
584 return "PolicyTtlDays";
593 return "SensitivityPolicyTtlDays";
602inline constexpr const char* GetEnforceMsgPfileProtection() {
603 return "EnforceMsgPfileProtection";
610inline constexpr const char* GetCustomSettingEnableMsgFileType() {
611 return "enable_msg_file_type";
618inline constexpr const char* GetCustomSettingContainerDecryptionOption() {
619 return "container_decryption_option";
625inline constexpr const char* GetCustomSettingEnablePowerBIFileType() {
626 return "enable_power_bi_file_type";
632inline constexpr const char* GetCustomSettingKeepPdfLinearization() {
633 return "keep_pdf_linearization";
635inline constexpr const char* GetCustomSettingEnableDeprecatedRemoveActions() {
636 return "enable_deprecated_remove_actions";
638inline constexpr const char* GetCustomSettingPrintDiscoveredInfoTypesToTrace() {
639 return "LogMatchedContentToTrace";
641inline constexpr const char* GetCustomSettingTaskTimeoutMs() {
642 return "TaskTimeoutMs";
645inline constexpr const char* GetCustomSettingLabelWithoutPolicy() {
646 return "label_without_policy";
649inline constexpr const char* GetCustomSettingMaxFileSizeForProtection() {
650 return "max_file_size_for_protection";
653inline constexpr const char* GetCustomSettingMaxNestedProtectedMsgs() {
654 return "max_nested_protected_msgs";
657inline constexpr const char* GetCustomSettingMaxPolicyXmlVersion() {
658 return "max_policy_xml_version";
666inline constexpr const char* GetCustomSettingDelegateApplicationInfo() {
667 return "delegate_application_info";
676inline constexpr const char* GetCustomSettingEnableCoAuthMetadata() {
677 return "co_auth_metadata";
685inline constexpr const char* GetCustomSettingLabelsForAllContentFormats() {
686 return "labels_for_all_content_formats";
692class CaseInsensitiveComparator {
694 bool operator() (
const std::string& lhs,
const std::string& rhs)
const {
695 if (lhs.size() != rhs.size())
696 return lhs.size() < rhs.size();
699 return _strnicmp(lhs.c_str(), rhs.c_str(), lhs.size()) < 0;
701 return strncasecmp(lhs.c_str(), rhs.c_str(), lhs.size()) < 0;
Class used to cancel async operation.
Definition common_types.h:760
virtual bool Cancel()=0
Calling cancel will result in a attempt to cancel the task, in case of success the appropriate onFail...
a class that contains all the information required from the calling application in order to generate ...
Definition common_types.h:328
const std::string & GetScope() const
Get the scope string.
Definition common_types.h:364
const std::string & GetResource() const
Get the resource string.
Definition common_types.h:358
std::string mScope
Definition common_types.h:374
const std::string & GetClaims() const
Get the claims string.
Definition common_types.h:370
std::string mResource
Definition common_types.h:373
OAuth2Challenge(const std::string &authority, const std::string &resource, const std::string &scope=std::string(), const std::string &claims=std::string())
Construct a new OAuth2Challenge object.
Definition common_types.h:337
std::string mClaims
Definition common_types.h:375
const std::string & GetAuthority() const
Get the authority string.
Definition common_types.h:352
std::string mAuthority
Definition common_types.h:372
A class containing access token info provided by an application.
Definition common_types.h:381
void SetAccessToken(const std::string &accessToken)
Set the access token string.
Definition common_types.h:407
OAuth2Token(const std::string &accessToken)
Construct a new OAuth2Token object from JWT access token.
Definition common_types.h:393
OAuth2Token()
Construct a new OAuth2Token object.
Definition common_types.h:386
void SetErrorMessage(const std::string &errorMessage)
Set the error message.
Definition common_types.h:421
std::string mErrorMessage
Definition common_types.h:425
const std::string & GetAccessToken() const
Get the access token string.
Definition common_types.h:400
const std::string & GetErrorMessage() const
Get the error message, if any.
Definition common_types.h:414
std::string mAccessToken
Definition common_types.h:424
Delegate for auth related operations.
Definition common_types.h:322
virtual bool AcquireOAuth2Token(const Identity &identity, const OAuth2Challenge &challenge, const std::shared_ptr< void > &context, OAuth2Token &token)
This method is called when an auth token is required for the policy engine with the given identity an...
Definition common_types.h:463
virtual bool AcquireOAuth2Token(const Identity &identity, const OAuth2Challenge &challenge, OAuth2Token &token)
This method is called when an auth token is required for the policy engine with the given identity an...
Definition common_types.h:444
Delegate for consent related operations.
Definition common_types.h:496
virtual Consent GetUserConsent(const std::string &url)=0
Called when SDK requires user consent to connect to a service endpoint.
Abstraction for identity.
Definition common_types.h:270
Identity(const std::string &email, const std::string &name)
Identity constructor used when a user email address and user name is known.
Definition common_types.h:298
Identity()
Default Identity constructor used when a user email address is not known.
Definition common_types.h:275
const std::string & GetEmail() const
Get the email.
Definition common_types.h:305
std::string mName
Definition common_types.h:316
Identity(const Identity &other)
Identity copy constructor.
Definition common_types.h:281
const std::string & GetName() const
Get the user's friendly name. used for text marking.
Definition common_types.h:312
Identity(const std::string &email)
Identity constructor used when a user email address is known.
Definition common_types.h:290
std::string mEmail
Definition common_types.h:315
const std::string & GetSqliteExtension()
Definition common_types.h:256
constexpr const char * GetCustomSettingSensitivityTypesDataName()
Name of the setting to explicitly specify sensitivity data.
Definition common_types.h:550
FeatureId
Defines new features by name.
Definition common_types.h:151
PFileExtensionBehavior
Describes PFile extensions behavior.
Definition common_types.h:719
Cloud
Azure cloud identifier.
Definition common_types.h:728
AssignmentMethod
The assignment method of the label on the document. Whether the Assignment of the label was done auto...
Definition common_types.h:75
CacheStorageType
Storage type for the caches.
Definition common_types.h:710
constexpr const char * GetCustomSettingPolicyDataName()
Name of the setting to explicitly specify policy data.
Definition common_types.h:534
FunctionalityFilterType operator&(FunctionalityFilterType firstFilter, FunctionalityFilterType secondFilter)
Definition common_types.h:140
constexpr const char * GetCustomSettingSensitivityPolicyTtlDays()
Name of the setting that enables overriding sensitivity policy ttl in days be default it will be 30 d...
Definition common_types.h:592
const std::string & GetFileContentFormat()
Definition common_types.h:100
FunctionalityFilterType operator|(FunctionalityFilterType firstFilter, FunctionalityFilterType secondFilter)
Definition common_types.h:136
VariableTextMarkingType
various dynamic fields can be set into the text message of the application Some known: ${Item....
Definition common_types.h:167
DataState
Defines what state of the data is the application acting upon.
Definition common_types.h:94
ContentMarkAlignment
Alignment for content marks (content header or content footer).
Definition common_types.h:65
Consent
A user's response when consent is requested to connect to a service endpoint.
Definition common_types.h:484
FunctionalityFilterType operator~(FunctionalityFilterType filter)
Definition common_types.h:144
const std::string & GetMemoryDatabasePath()
Definition common_types.h:262
Workload
The workload the application is working on, used primary to check for consent.
Definition common_types.h:210
static std::string GetDataStateString(DataState state)
Get the content state name.
Definition common_types.h:250
LabelFilterType
Label filter types, optional set of properties that can be used to filter labels or label behavior wh...
Definition common_types.h:114
@ DoubleKeyUserDefinedProtection
Definition common_types.h:123
@ CustomProtection
Definition common_types.h:116
@ TemplateProtection
Definition common_types.h:117
@ EncryptOnlyProtection
Definition common_types.h:124
@ DoNotForwardProtection
Definition common_types.h:118
@ HyokProtection
Definition common_types.h:120
@ MachineLearningClassifier
Definition common_types.h:126
@ AdhocProtection
Definition common_types.h:119
@ None
Definition common_types.h:115
@ DoubleKeyProtection
Definition common_types.h:122
@ ExtendedSensitiveInformationClassifier
Definition common_types.h:127
@ SensitiveInformationClassifier
Definition common_types.h:125
@ PredefinedTemplateProtection
Definition common_types.h:121
constexpr const char * GetCustomSettingPolicyDataFile()
Name of the setting to explicitly specify policy data file path.
Definition common_types.h:558
static std::string GetActionSourceString(ActionSource actionSource)
Get the action source name.
Definition common_types.h:239
Classifier
The type of classification the application should be running on the data to determine autolabeling st...
Definition common_types.h:201
@ ExtendedSensitiveInformation
constexpr const char * GetCustomSettingPolicyTtlDays()
Name of the setting that enables overriding policy ttl in days be default it will be 30 days....
Definition common_types.h:583
constexpr const char * GetCustomSettingSensitivityTypesDataFile()
Name of the setting to explicitly specify sensitivity types data file path.
Definition common_types.h:566
DataBoundary
Diagnostic region identifier.
Definition common_types.h:745
@ Europe_MiddleEast_Africa
std::string GetAssignmentMethodString(AssignmentMethod method)
Converts AssignmentMethod enum to a string description.
Definition common_types.h:228
std::map< mip::Classifier, UniqueIdsAndContentFormats > ClassifierUniqueIdsAndContentFormats
Definition common_types.h:220
ActionSource
defines what triggered the SetLabel event
Definition common_types.h:84
WatermarkLayout
Layout for watermarks.
Definition common_types.h:57
LabelFilterType FunctionalityFilterType
Name change within the cpp workspace to imply the filters has greater scope than just label behavior....
Definition common_types.h:134
constexpr const char * GetCustomSettingLabelCustomPropertiesSyncEnabled()
Name of the setting that allows to enable label by custom properties and custom properties by label f...
Definition common_types.h:574
const std::string & GetEmailContentFormat()
Definition common_types.h:105
constexpr const char * GetCustomSettingExportPolicyFileName()
Name of the setting to explicitly specify file path to export SCC policy data to.
Definition common_types.h:542
A struct that includes application specific information.
Definition common_types.h:523
std::string applicationName
Definition common_types.h:525
std::string applicationVersion
Definition common_types.h:526
std::string applicationId
Definition common_types.h:524
Definition common_types.h:216
std::unordered_map< std::string, std::string > uniqueIds
Definition common_types.h:217
std::vector< std::string > contentFormats
Definition common_types.h:218