Microsoft Information Protection SDK - C++ 1.17
API Reference Documentation for C++
Loading...
Searching...
No Matches
mip_configuration.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (c) Microsoft Corporation.
4 * All rights reserved.
5 *
6 * This code is licensed under the MIT License.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files(the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions :
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 * THE SOFTWARE.
25 *
26 */
33#ifndef API_MIP_MIP_CONFIGURATION_H_
34#define API_MIP_MIP_CONFIGURATION_H_
35
36#include <map>
37#include <memory>
38
40#include "mip/common_types.h"
43#include "mip/json_delegate.h"
44#include "mip/logger_delegate.h"
47#include "mip/xml_delegate.h"
48
49#if (!defined(SWIG) && !defined(SWIG_DIRECTORS))
50#define DEPRECATED(msg) \
51[[deprecated(msg)]]
52#else
53#define DEPRECATED(msg)
54#endif
55
56#if !defined(SKIP_CACHE_STORAGE_TYPE_IN_MIP_CONFIGURATION)
57#define DEPRECATED_FOR_STORAGE_CACHE_TYPE(msg) \
58DEPRECATED(msg)
59#else
60#define DEPRECATED_FOR_STORAGE_CACHE_TYPE(msg)
61#endif
62
63MIP_NAMESPACE_BEGIN
64
70public:
71
72DEPRECATED_FOR_STORAGE_CACHE_TYPE("MipConfiguration(...) is deprecated, use MipConfiguration(const ApplicationInfo&, const std::string&, LogLevel, bool, CacheStorageType)")
74 const ApplicationInfo& appInfo,
75 const std::string& path,
78 : mAppInfo(appInfo),
84
86 const ApplicationInfo& appInfo,
87 const std::string& path,
89 bool isOfflineOnly,
90 CacheStorageType cacheStorageType)
91 : mAppInfo(appInfo),
92 mPath(path),
97 mCacheStorageType = std::make_shared<CacheStorageType>(cacheStorageType);
98 }
104 const ApplicationInfo& GetApplicationInfo() const { return mAppInfo; }
105
111 const std::string& GetPath() const { return mPath; }
112
119
125 bool isOfflineOnly() const { return mIsOfflineOnly; }
131 std::shared_ptr<DiagnosticConfiguration> GetDiagnosticConfiguration() const { return mDiagnosticConfiguration; }
132
138 void SetDiagnosticConfiguration(const std::shared_ptr<DiagnosticConfiguration>& diagnosticConfiguration) { mDiagnosticConfiguration = diagnosticConfiguration; }
139
145 std::shared_ptr<LoggerDelegate> GetLoggerDelegate() const { return mLoggerDelegate; }
146
152 void SetLoggerDelegate(const std::shared_ptr<LoggerDelegate>& loggerDelegate) { mLoggerDelegate = loggerDelegate; }
153
159 std::shared_ptr<LoggerConfiguration> GetLoggerConfiguration() const { return mLoggerConfiguration; }
160
166 void SetLoggerConfiguration(const std::shared_ptr<LoggerConfiguration>& loggerConfiguration) { mLoggerConfiguration = loggerConfiguration; }
167
173 std::shared_ptr<StorageDelegate> GetStorageDelegate() const { return mStorageDelegate; }
174
180 void SetStorageDelegate(const std::shared_ptr<StorageDelegate>& storageDelegate) { mStorageDelegate = storageDelegate; }
181
187 std::shared_ptr<CacheStorageType> GetCacheStorageType() const { return mCacheStorageType; }
188
194 std::shared_ptr<HttpDelegate> GetHttpDelegate() const { return mHttpDelegate; }
195
201 void SetHttpDelegate(const std::shared_ptr<HttpDelegate>& httpDelegate) { mHttpDelegate = httpDelegate; }
202
208 std::shared_ptr<CloudDiscoveryDelegate> GetCloudDiscoveryDelegate() const { return mCloudDiscoveryDelegate; }
209
215 void SetCloudDiscoveryDelegate(const std::shared_ptr<CloudDiscoveryDelegate>& cloudDiscoveryDelegate) {
216 mCloudDiscoveryDelegate = cloudDiscoveryDelegate;
217 }
218
224 std::shared_ptr<JsonDelegate> GetJsonDelegate() const {
225 return mJsonDelegate;
226 }
227
235 std::shared_ptr<xml::XmlDelegate> GetXmlDelegate() const { return mXmlDelegate; }
236
242 std::map<FlightingFeature, bool> GetFeatureSettings() const { return mfeatureSettings; }
243
249 void SetFeatureSettings(const std::map<FlightingFeature, bool>& featureSettings) { mfeatureSettings = featureSettings; }
250
257
263 void SetApiLogCacheMaxMessages(size_t maxMessages) { mApiLogCacheMaxMessages = maxMessages; }
264
266
267protected:
268 std::shared_ptr<JsonDelegate> mJsonDelegate;
269 std::shared_ptr<xml::XmlDelegate> mXmlDelegate;
270
271private:
273 std::string mPath;
276 std::shared_ptr<LoggerDelegate> mLoggerDelegate;
277 std::shared_ptr<DiagnosticConfiguration> mDiagnosticConfiguration;
278 std::shared_ptr<StorageDelegate> mStorageDelegate;
279 std::map<FlightingFeature, bool> mfeatureSettings;
281 std::shared_ptr<HttpDelegate> mHttpDelegate;
282 std::shared_ptr<CloudDiscoveryDelegate> mCloudDiscoveryDelegate;
283 std::shared_ptr<LoggerConfiguration> mLoggerConfiguration;
284 std::shared_ptr<CacheStorageType> mCacheStorageType;
286 };
287
288MIP_NAMESPACE_END
289#endif // API_MIP_MIP_CONFIGURATION_H_
Configuration used by MIP sdk during its creation and throughout its lifetime.
Definition mip_configuration.h:69
std::shared_ptr< xml::XmlDelegate > mXmlDelegate
Definition mip_configuration.h:269
std::shared_ptr< DiagnosticConfiguration > GetDiagnosticConfiguration() const
Get the Diagnostic (if any) provided by the application.
Definition mip_configuration.h:131
bool isOfflineOnly() const
whether Network operations is enabled or disabled(not all actions supported when offline)
Definition mip_configuration.h:125
DEPRECATED_FOR_STORAGE_CACHE_TYPE("MipConfiguration(...) is deprecated, use MipConfiguration(const ApplicationInfo&, const std::string&, LogLevel, bool, CacheStorageType)") MipConfiguration(const ApplicationInfo &appInfo
ApplicationInfo mAppInfo
Definition mip_configuration.h:272
LogLevel mThresholdLogLevel
Definition mip_configuration.h:274
std::shared_ptr< xml::XmlDelegate > GetXmlDelegate() const
Get the XmlDelegate (if any) override implementation. MipConfiguration needs to be derived from to ov...
Definition mip_configuration.h:235
const ApplicationInfo & GetApplicationInfo() const
Get the Description of host application.
Definition mip_configuration.h:104
void SetLoggerDelegate(const std::shared_ptr< LoggerDelegate > &loggerDelegate)
Set the LoggerDelegate (if any) override implementation.
Definition mip_configuration.h:152
size_t mApiLogCacheMaxMessages
Definition mip_configuration.h:280
MipConfiguration(const ApplicationInfo &appInfo, const std::string &path, LogLevel thresholdLogLevel, bool isOfflineOnly, CacheStorageType cacheStorageType)
Definition mip_configuration.h:85
std::shared_ptr< DiagnosticConfiguration > mDiagnosticConfiguration
Definition mip_configuration.h:277
const LogLevel & GetThresholdLogLevel() const
Get the Minimum log level for .miplog.
Definition mip_configuration.h:118
std::shared_ptr< LoggerDelegate > mLoggerDelegate
Definition mip_configuration.h:276
std::shared_ptr< JsonDelegate > mJsonDelegate
Definition mip_configuration.h:268
std::shared_ptr< HttpDelegate > mHttpDelegate
Definition mip_configuration.h:281
void SetFeatureSettings(const std::map< FlightingFeature, bool > &featureSettings)
Set the Flighting features which should be set to non-default values.
Definition mip_configuration.h:249
const std::string & path
Definition mip_configuration.h:75
std::shared_ptr< CacheStorageType > mCacheStorageType
Definition mip_configuration.h:284
~MipConfiguration()
Definition mip_configuration.h:265
std::shared_ptr< CloudDiscoveryDelegate > mCloudDiscoveryDelegate
Definition mip_configuration.h:282
void SetLoggerConfiguration(const std::shared_ptr< LoggerConfiguration > &loggerConfiguration)
Override the default logger configuration.
Definition mip_configuration.h:166
std::shared_ptr< CacheStorageType > GetCacheStorageType() const
Get whether caches are stored in memory or on disk.
Definition mip_configuration.h:187
std::map< FlightingFeature, bool > GetFeatureSettings() const
Get the Flighting features which should be set to non-default values.
Definition mip_configuration.h:242
const std::string & GetPath() const
Get the File path for logs, caches, etc.
Definition mip_configuration.h:111
std::string mPath
Definition mip_configuration.h:273
void SetHttpDelegate(const std::shared_ptr< HttpDelegate > &httpDelegate)
Set the HttpDelegate (if any) override implementation. It's a required delegate for MIP Core Context.
Definition mip_configuration.h:201
std::shared_ptr< StorageDelegate > GetStorageDelegate() const
Get the StorageDelegate (if any) override implementation.
Definition mip_configuration.h:173
void SetCloudDiscoveryDelegate(const std::shared_ptr< CloudDiscoveryDelegate > &cloudDiscoveryDelegate)
Set the CloudDiscoveryDelegate (if any) override implementation.
Definition mip_configuration.h:215
std::shared_ptr< HttpDelegate > GetHttpDelegate() const
Get the HttpDelegate (if any) override implementation.
Definition mip_configuration.h:194
std::shared_ptr< JsonDelegate > GetJsonDelegate() const
Get the JsonDelegate (if any) override implementation.
Definition mip_configuration.h:224
std::shared_ptr< LoggerConfiguration > mLoggerConfiguration
Definition mip_configuration.h:283
const std::string LogLevel bool isOfflineOnly
Definition mip_configuration.h:78
std::shared_ptr< StorageDelegate > mStorageDelegate
Definition mip_configuration.h:278
std::shared_ptr< LoggerDelegate > GetLoggerDelegate() const
Get the LoggerDelegate (if any) override implementation.
Definition mip_configuration.h:145
void SetDiagnosticConfiguration(const std::shared_ptr< DiagnosticConfiguration > &diagnosticConfiguration)
Override default configuration of diagnostic.
Definition mip_configuration.h:138
const std::string LogLevel thresholdLogLevel
Definition mip_configuration.h:76
std::shared_ptr< LoggerConfiguration > GetLoggerConfiguration() const
Get the override configuration (if any) for the default logger implementation.
Definition mip_configuration.h:159
std::shared_ptr< CloudDiscoveryDelegate > GetCloudDiscoveryDelegate() const
Get the CloudDiscoveryDelegate (if any) override implementation.
Definition mip_configuration.h:208
std::map< FlightingFeature, bool > mfeatureSettings
Definition mip_configuration.h:279
size_t GetApiLogCacheMaxMessages() const
Get the max messages per Api call that will be logged in the api log cache.
Definition mip_configuration.h:256
void SetStorageDelegate(const std::shared_ptr< StorageDelegate > &storageDelegate)
Set the StorageDelegate (if any) override implementation. It's a required delegate for MIP Core Conte...
Definition mip_configuration.h:180
void SetApiLogCacheMaxMessages(size_t maxMessages)
Set the max messages per Api call that will be logged in the api log cache. Setting this to 0 will di...
Definition mip_configuration.h:263
bool mIsOfflineOnly
Definition mip_configuration.h:275
Defines CouldDiscoveryDelegate interface.
A file Containing the common types used by the upe, file and protection modules.
CacheStorageType
Storage type for the caches.
Definition common_types.h:734
Defines custom telemetry or audit configurations.
A file containing the FlightingFeature definition.
Contains the JsonDelegate interface used to parse and produce JSON data.
LogLevel
Different log levels used across the MIP SDK.
Definition log_message_data.h:48
A file containing the LoggerDelegate class to be used to override MIP logger.
Defines StorageDelegate interface.
A struct that includes application specific information.
Definition common_types.h:531
A file containing the TaskDispatcherDelegate interface to be used to override MIP async task executor...
Contains XmlDelegate interface definition used to parse xml recieved by mip.