Microsoft Information Protection (MIP) SDK for C++: Reference 1.15
Doxygen-generated documentation for MIP SDK written in C++
Loading...
Searching...
No Matches
event.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 */
27/**
28 * @brief A file containing the Event class which describes a single audit/telemetry event
29 *
30 * @file event.h
31 */
32
33#ifndef API_MIP_EVENT_H_
34#define API_MIP_EVENT_H_
35
36#include <chrono>
37#include <memory>
38#include <string>
39#include <vector>
40
42#include "mip/event_property.h"
43#include "mip/mip_namespace.h"
44
45MIP_NAMESPACE_BEGIN
46
47/**
48 * @brief A single audit/telemetry event
49 */
50class Event {
51public:
52 /**
53 * @brief Get event name
54 *
55 * @return Event name
56 */
57 virtual const std::string& GetName() const = 0;
58
59 /**
60 * @brief Get level of event, indicating whether it is considered necessary service data (NSD) or not
61 *
62 * @return Level of event
63 */
64 virtual EventLevel GetLevel() const = 0;
65
66 /**
67 * @brief Get event start time
68 *
69 * @return Event start time
70 */
71 virtual const std::chrono::steady_clock::time_point& GetStartTime() const = 0;
72
73 /**
74 * @brief Add a property to the event
75 *
76 * @param prop Property to add
77 */
78 virtual void AddProperty(const std::shared_ptr<EventProperty>& prop) = 0;
79
80 /**
81 * @brief Add a bool property to the event
82 *
83 * @param name Property name
84 * @param value Property value
85 */
86 virtual void AddProperty(const std::string& name, bool value) = 0;
87
88 /**
89 * @brief Add a double property to the event
90 *
91 * @param name Property name
92 * @param value Property value
93 * @param pii PII classification
94 */
95 virtual void AddProperty(const std::string& name, double value, Pii pii) = 0;
96
97 /**
98 * @brief Add an int64 property to the event
99 *
100 * @param name Property name
101 * @param value Property value
102 * @param pii PII classification
103 */
104 virtual void AddProperty(const std::string& name, int64_t value, Pii pii) = 0;
105
106 /**
107 * @brief Add a string property to the event
108 *
109 * @param name Property name
110 * @param value Property value
111 * @param pii PII classification
112 */
113 virtual void AddProperty(const std::string& name, const std::string& value, Pii pii) = 0;
114
115 /**
116 * @brief Add an audit-only string property to the event
117 *
118 * @param name Property name
119 * @param value Property value
120 *
121 * @note An audit-only property contains sensitive information and must not be written to file logs or to any pipeline
122 * except for audit until it is manually scrubbed.
123 */
124 virtual void AddAuditOnlyProperty(const std::string& name, const std::string& value) = 0;
125
126 /**
127 * @brief Get all event properties
128 *
129 * @return Event properties
130 */
131 virtual std::vector<std::shared_ptr<EventProperty>> GetProperties() const = 0;
132
133 /**
134 * @brief Get property with the given name, if any
135 *
136 * @param name Name of the property to get
137 *
138 * @return Property with the given name, or nullptr if none
139 */
140 virtual std::shared_ptr<EventProperty> GetProperty(const std::string& name) const = 0;
141
142 /** @cond DOXYGEN_HIDE */
143 virtual ~Event() {}
144protected:
145 Event() {}
146 /** @endcond */
147};
148
149MIP_NAMESPACE_END
150#endif // API_MIP_EVENT_H_
151
A single audit/telemetry event.
Definition event.h:50
virtual const std::string & GetName() const =0
Get event name.
virtual const std::chrono::steady_clock::time_point & GetStartTime() const =0
Get event start time.
virtual void AddProperty(const std::string &name, const std::string &value, Pii pii)=0
Add a string property to the event.
virtual void AddProperty(const std::shared_ptr< EventProperty > &prop)=0
Add a property to the event.
virtual std::vector< std::shared_ptr< EventProperty > > GetProperties() const =0
Get all event properties.
virtual void AddAuditOnlyProperty(const std::string &name, const std::string &value)=0
Add an audit-only string property to the event.
virtual void AddProperty(const std::string &name, bool value)=0
Add a bool property to the event.
virtual void AddProperty(const std::string &name, int64_t value, Pii pii)=0
Add an int64 property to the event.
virtual void AddProperty(const std::string &name, double value, Pii pii)=0
Add a double property to the event.
virtual EventLevel GetLevel() const =0
Get level of event, indicating whether it is considered necessary service data (NSD) or not.
virtual std::shared_ptr< EventProperty > GetProperty(const std::string &name) const =0
Get property with the given name, if any.
File containing diagnostic-related types.
EventLevel
Description of event importance.
Pii
Description of PII data, if any.
A file containing the EventProperty class which describes a single audit/telemetry property.
MIP namespace macros.