@shieldiot/pulse-lib 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/dist/index.d.ts +4 -2
  2. package/dist/index.js +4 -2
  3. package/dist/index.js.map +1 -1
  4. package/dist/lib/common/TimeSeries.d.ts +1 -1
  5. package/dist/lib/common/TimeSeriesOf2D.d.ts +1 -1
  6. package/dist/lib/entities/Account.d.ts +2 -2
  7. package/dist/lib/entities/Account.js.map +1 -1
  8. package/dist/lib/entities/AccountDTO.d.ts +2 -2
  9. package/dist/lib/entities/AccountDTO.js.map +1 -1
  10. package/dist/lib/entities/AccountSettings.d.ts +1 -1
  11. package/dist/lib/entities/Alert.d.ts +4 -4
  12. package/dist/lib/entities/Alert.js.map +1 -1
  13. package/dist/lib/entities/AlertWithDevice.d.ts +4 -4
  14. package/dist/lib/entities/AlertWithDevice.js.map +1 -1
  15. package/dist/lib/entities/Device.d.ts +3 -3
  16. package/dist/lib/entities/Device.js.map +1 -1
  17. package/dist/lib/entities/DeviceWithEvents.d.ts +1 -1
  18. package/dist/lib/entities/DeviceWithEvents.js.map +1 -1
  19. package/dist/lib/entities/Event.d.ts +6 -6
  20. package/dist/lib/entities/Event.js.map +1 -1
  21. package/dist/lib/entities/EventWithDevice.d.ts +5 -5
  22. package/dist/lib/entities/EventWithDevice.js.map +1 -1
  23. package/dist/lib/entities/Feature.d.ts +1 -1
  24. package/dist/lib/entities/Feature.js.map +1 -1
  25. package/dist/lib/entities/Integration.d.ts +3 -3
  26. package/dist/lib/entities/Integration.js.map +1 -1
  27. package/dist/lib/entities/Report.d.ts +1 -1
  28. package/dist/lib/entities/Report.js.map +1 -1
  29. package/dist/lib/entities/Rule.d.ts +3 -3
  30. package/dist/lib/entities/Rule.js.map +1 -1
  31. package/dist/lib/entities/RuleTemplate.d.ts +2 -2
  32. package/dist/lib/entities/RuleTemplate.js.map +1 -1
  33. package/dist/lib/entities/StreamAnalyticsConfig.d.ts +2 -2
  34. package/dist/lib/entities/StreamAnalyticsConfig.js.map +1 -1
  35. package/dist/lib/entities/StreamConfig.d.ts +4 -4
  36. package/dist/lib/entities/User.d.ts +2 -2
  37. package/dist/lib/entities/User.js.map +1 -1
  38. package/dist/lib/entities/UserMembership.d.ts +2 -2
  39. package/dist/lib/entities/UserMembership.js.map +1 -1
  40. package/dist/lib/pulse-client.d.ts +12 -12
  41. package/dist/lib/pulse-client.js +30 -30
  42. package/dist/lib/pulse-client.js.map +1 -1
  43. package/dist/lib/services/sysAccountsService.d.ts +1 -1
  44. package/dist/lib/services/sysFeaturesService.d.ts +1 -1
  45. package/dist/lib/services/usrAlertsService.d.ts +9 -9
  46. package/dist/lib/services/usrDevicesService.d.ts +5 -5
  47. package/dist/lib/services/usrEventsService.d.ts +7 -7
  48. package/package.json +1 -1
  49. package/src/index.ts +4 -3
  50. package/dist/public-api.d.ts +0 -3
  51. package/dist/public-api.js +0 -7
  52. package/dist/public-api.js.map +0 -1
  53. package/src/config.d.ts +0 -6
  54. package/src/config.d.ts.map +0 -1
  55. package/src/config.js +0 -6
  56. package/src/config.js.map +0 -1
  57. package/src/index.d.ts +0 -3
  58. package/src/index.d.ts.map +0 -1
  59. package/src/index.js +0 -3
  60. package/src/index.js.map +0 -1
  61. package/src/lib/common/AccountRole.ts +0 -25
  62. package/src/lib/common/ConsumptionData.ts +0 -24
  63. package/src/lib/common/ConsumptionTimeDataPoint.ts +0 -21
  64. package/src/lib/common/DeviceConfig.ts +0 -22
  65. package/src/lib/common/DeviceScoreConfig.ts +0 -24
  66. package/src/lib/common/DevicesAtRiskConfig.ts +0 -16
  67. package/src/lib/common/EventSeverityConfig.ts +0 -17
  68. package/src/lib/common/FloatKeyValue.ts +0 -20
  69. package/src/lib/common/GeoData.ts +0 -38
  70. package/src/lib/common/GraphSeries.ts +0 -21
  71. package/src/lib/common/Indicator.ts +0 -32
  72. package/src/lib/common/IntKeySeriesDataValue.ts +0 -21
  73. package/src/lib/common/IntKeyValue.ts +0 -20
  74. package/src/lib/common/Interval.ts +0 -20
  75. package/src/lib/common/Link.ts +0 -41
  76. package/src/lib/common/Location.ts +0 -20
  77. package/src/lib/common/LoginParams.ts +0 -24
  78. package/src/lib/common/MaliciousIPCard.ts +0 -45
  79. package/src/lib/common/MaliciousIPData.ts +0 -28
  80. package/src/lib/common/NetworkMap.ts +0 -22
  81. package/src/lib/common/Node.ts +0 -54
  82. package/src/lib/common/SeriesData.ts +0 -22
  83. package/src/lib/common/SessionTransform.ts +0 -29
  84. package/src/lib/common/SeverityIntervalTuple.ts +0 -22
  85. package/src/lib/common/ShieldexConfig.ts +0 -36
  86. package/src/lib/common/StringIntValue.ts +0 -20
  87. package/src/lib/common/StringKeyIntValue.ts +0 -20
  88. package/src/lib/common/StringKeyValue.ts +0 -20
  89. package/src/lib/common/Thresholds.ts +0 -16
  90. package/src/lib/common/TimeDataPoint.ts +0 -20
  91. package/src/lib/common/TimeDataPoint2D.ts +0 -21
  92. package/src/lib/common/TimeDataPointFloat.ts +0 -20
  93. package/src/lib/common/TimeFrame.ts +0 -20
  94. package/src/lib/common/TimeSeries.ts +0 -26
  95. package/src/lib/common/TimeSeriesOf2D.ts +0 -26
  96. package/src/lib/common/TimeSeriesOfDataConsumption.ts +0 -26
  97. package/src/lib/common/TimeSeriesOfFloat.ts +0 -26
  98. package/src/lib/common/TokenData.ts +0 -39
  99. package/src/lib/common/Tuple.ts +0 -20
  100. package/src/lib/common/UsageTransform.ts +0 -37
  101. package/src/lib/common/ZScore.ts +0 -20
  102. package/src/lib/common/index.ts +0 -41
  103. package/src/lib/entities/Account.ts +0 -45
  104. package/src/lib/entities/AccountDTO.ts +0 -49
  105. package/src/lib/entities/AccountSettings.ts +0 -31
  106. package/src/lib/entities/Action.ts +0 -30
  107. package/src/lib/entities/Alert.ts +0 -91
  108. package/src/lib/entities/AlertWithDevice.ts +0 -92
  109. package/src/lib/entities/ApiKey.ts +0 -33
  110. package/src/lib/entities/AuditLog.ts +0 -39
  111. package/src/lib/entities/BaseEntity.ts +0 -24
  112. package/src/lib/entities/BulkDevices.ts +0 -17
  113. package/src/lib/entities/Checkpoint.ts +0 -71
  114. package/src/lib/entities/ComplianceReportSettings.ts +0 -28
  115. package/src/lib/entities/Condition.ts +0 -28
  116. package/src/lib/entities/ConfigParam.ts +0 -15
  117. package/src/lib/entities/DNSRecord.ts +0 -40
  118. package/src/lib/entities/DataIngestion.ts +0 -63
  119. package/src/lib/entities/DataPointOfDeviceReport.ts +0 -21
  120. package/src/lib/entities/Device.ts +0 -82
  121. package/src/lib/entities/DeviceReport.ts +0 -29
  122. package/src/lib/entities/DeviceWithEvents.ts +0 -86
  123. package/src/lib/entities/Distribution.ts +0 -25
  124. package/src/lib/entities/Event.ts +0 -98
  125. package/src/lib/entities/EventOccurrence.ts +0 -34
  126. package/src/lib/entities/EventWithDevice.ts +0 -97
  127. package/src/lib/entities/Feature.ts +0 -18
  128. package/src/lib/entities/FeaturesGroup.ts +0 -18
  129. package/src/lib/entities/Group.ts +0 -24
  130. package/src/lib/entities/Image.ts +0 -18
  131. package/src/lib/entities/Insight.ts +0 -49
  132. package/src/lib/entities/InsightQuery.ts +0 -29
  133. package/src/lib/entities/InsightSpec.ts +0 -28
  134. package/src/lib/entities/IntDistribution.ts +0 -25
  135. package/src/lib/entities/Integration.ts +0 -81
  136. package/src/lib/entities/Member.ts +0 -22
  137. package/src/lib/entities/Radius.ts +0 -45
  138. package/src/lib/entities/Report.ts +0 -37
  139. package/src/lib/entities/Rule.ts +0 -65
  140. package/src/lib/entities/RuleTemplate.ts +0 -38
  141. package/src/lib/entities/SIM.ts +0 -32
  142. package/src/lib/entities/ServiceStatus.ts +0 -26
  143. package/src/lib/entities/SessionRecord.ts +0 -71
  144. package/src/lib/entities/Shieldex.ts +0 -23
  145. package/src/lib/entities/Stream.ts +0 -31
  146. package/src/lib/entities/StreamAnalyticsConfig.ts +0 -30
  147. package/src/lib/entities/StreamConfig.ts +0 -52
  148. package/src/lib/entities/TeaserPopUpSettings.ts +0 -24
  149. package/src/lib/entities/TimeSeriesOfDeviceReport.ts +0 -26
  150. package/src/lib/entities/UsageRecord.ts +0 -101
  151. package/src/lib/entities/User.ts +0 -45
  152. package/src/lib/entities/UserMembership.ts +0 -38
  153. package/src/lib/entities/UserMemberships.ts +0 -38
  154. package/src/lib/entities/index.ts +0 -51
  155. package/src/lib/enums/AccountStatusCode.ts +0 -35
  156. package/src/lib/enums/AccountTypeCode.ts +0 -40
  157. package/src/lib/enums/DataSourceCode.ts +0 -35
  158. package/src/lib/enums/DeviceActionCode.ts +0 -40
  159. package/src/lib/enums/DeviceCreationCode.ts +0 -40
  160. package/src/lib/enums/DeviceIdentityCode.ts +0 -55
  161. package/src/lib/enums/DeviceStatusCode.ts +0 -40
  162. package/src/lib/enums/DeviceTypeCode.ts +0 -90
  163. package/src/lib/enums/DirectionContextCode.ts +0 -40
  164. package/src/lib/enums/EventCategoryCode.ts +0 -30
  165. package/src/lib/enums/EventStatusCode.ts +0 -40
  166. package/src/lib/enums/EventTypeCode.ts +0 -115
  167. package/src/lib/enums/FeatureCode.ts +0 -70
  168. package/src/lib/enums/HomePageViewCode.ts +0 -35
  169. package/src/lib/enums/HttpMethodCode.ts +0 -45
  170. package/src/lib/enums/InsightStatusCode.ts +0 -35
  171. package/src/lib/enums/InsightTypeCode.ts +0 -30
  172. package/src/lib/enums/IntegrationTriggerCode.ts +0 -30
  173. package/src/lib/enums/IntegrationTypeCode.ts +0 -40
  174. package/src/lib/enums/MemberRoleCode.ts +0 -40
  175. package/src/lib/enums/NetworkMapTypeCode.ts +0 -35
  176. package/src/lib/enums/OperatorCode.ts +0 -75
  177. package/src/lib/enums/PermissionCode.ts +0 -45
  178. package/src/lib/enums/ReportTypeCode.ts +0 -35
  179. package/src/lib/enums/RuleTypeCode.ts +0 -35
  180. package/src/lib/enums/SeverityTypeCode.ts +0 -40
  181. package/src/lib/enums/TrafficDirectionCode.ts +0 -35
  182. package/src/lib/enums/UserStatusCode.ts +0 -40
  183. package/src/lib/enums/UserTypeCode.ts +0 -40
  184. package/src/lib/enums/index.ts +0 -29
  185. package/src/lib/index.ts +0 -4
  186. package/src/lib/pulse-client.ts +0 -190
  187. package/src/lib/services/index.ts +0 -26
  188. package/src/lib/services/services.export.ts +0 -54
  189. package/src/lib/services/supportStreamAnalyticsConfig.ts +0 -63
  190. package/src/lib/services/sysAccountsService.ts +0 -90
  191. package/src/lib/services/sysAuditLogService.ts +0 -72
  192. package/src/lib/services/sysCheckpointsService.ts +0 -62
  193. package/src/lib/services/sysConfigService.ts +0 -63
  194. package/src/lib/services/sysFeaturesService.ts +0 -77
  195. package/src/lib/services/sysGroupsService.ts +0 -85
  196. package/src/lib/services/sysInsightsService.ts +0 -122
  197. package/src/lib/services/sysKeysService.ts +0 -71
  198. package/src/lib/services/sysMembersService.ts +0 -66
  199. package/src/lib/services/sysRuleTemplatesService.ts +0 -63
  200. package/src/lib/services/sysRulesService.ts +0 -79
  201. package/src/lib/services/sysStatisticsService.ts +0 -50
  202. package/src/lib/services/sysStreamsService.ts +0 -64
  203. package/src/lib/services/sysUsersService.ts +0 -89
  204. package/src/lib/services/usrAlertsService.ts +0 -382
  205. package/src/lib/services/usrDevicesService.ts +0 -303
  206. package/src/lib/services/usrEventsService.ts +0 -355
  207. package/src/lib/services/usrInsightsService.ts +0 -29
  208. package/src/lib/services/usrIntegrationsService.ts +0 -79
  209. package/src/lib/services/usrMembersService.ts +0 -77
  210. package/src/lib/services/usrNetworkService.ts +0 -59
  211. package/src/lib/services/usrReportsService.ts +0 -114
  212. package/src/lib/services/usrRulesService.ts +0 -78
  213. package/src/lib/services/usrUserService.ts +0 -114
  214. package/src/public-api.d.ts +0 -4
  215. package/src/public-api.d.ts.map +0 -1
  216. package/src/public-api.js +0 -7
  217. package/src/public-api.js.map +0 -1
  218. package/src/public-api.ts +0 -9
  219. package/src/utils/ActionResponse.d.ts +0 -6
  220. package/src/utils/ActionResponse.d.ts.map +0 -1
  221. package/src/utils/ActionResponse.js +0 -9
  222. package/src/utils/ActionResponse.js.map +0 -1
  223. package/src/utils/BaseRestResponse.d.ts +0 -5
  224. package/src/utils/BaseRestResponse.d.ts.map +0 -1
  225. package/src/utils/BaseRestResponse.js +0 -8
  226. package/src/utils/BaseRestResponse.js.map +0 -1
  227. package/src/utils/EntitiesResponse.d.ts +0 -9
  228. package/src/utils/EntitiesResponse.d.ts.map +0 -1
  229. package/src/utils/EntitiesResponse.js +0 -15
  230. package/src/utils/EntitiesResponse.js.map +0 -1
  231. package/src/utils/EntityResponse.d.ts +0 -9
  232. package/src/utils/EntityResponse.d.ts.map +0 -1
  233. package/src/utils/EntityResponse.js +0 -15
  234. package/src/utils/EntityResponse.js.map +0 -1
  235. package/src/utils/index.d.ts +0 -6
  236. package/src/utils/index.d.ts.map +0 -1
  237. package/src/utils/index.js +0 -6
  238. package/src/utils/index.js.map +0 -1
  239. package/src/utils/rest-axios-setup.d.ts +0 -4
  240. package/src/utils/rest-axios-setup.d.ts.map +0 -1
  241. package/src/utils/rest-axios-setup.js +0 -8
  242. package/src/utils/rest-axios-setup.js.map +0 -1
  243. package/src/utils/rest-util.d.ts +0 -16
  244. package/src/utils/rest-util.d.ts.map +0 -1
  245. package/src/utils/rest-util.js +0 -101
  246. package/src/utils/rest-util.js.map +0 -1
@@ -1,303 +0,0 @@
1
- import { RestUtil, EntityResponse, EntitiesResponse, ActionResponse } from '../../utils';
2
- import { PulseConfig } from '../../config';
3
-
4
- import { Device } from '../entities';
5
- import { DeviceTypeCode } from '../enums';
6
- import { DeviceWithEvents } from '../entities';
7
- import { NetworkMapTypeCode } from '../enums';
8
- import { NetworkMap } from '../common';
9
- import { TimeSeriesOfDeviceReport } from '../entities';
10
- import { BulkDevices } from '../entities';
11
- import { DeviceStatusCode } from '../enums';
12
- import { SeverityTypeCode } from '../enums';
13
- import { IntDistribution } from '../entities';
14
- import { DeviceActionCode } from '../enums';
15
- import { DeviceReport } from '../entities';
16
- import { TimeSeriesOfDataConsumption } from '../common';
17
-
18
-
19
-
20
- // List of device related actions for the operator
21
- // @RequestHeader X-API-KEY The key to identify the application (console)
22
- // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
23
- export class UsrDevicesService {
24
-
25
- // URL to web api
26
- private baseUrl = '/devices';
27
-
28
- // Class constructor
29
- constructor(private config: PulseConfig, private rest: RestUtil) {
30
- this.baseUrl = this.config.api + this.baseUrl;
31
- }
32
-
33
-
34
- /**
35
- * Create new device
36
- */
37
- create(body?: Device) {
38
- return this.rest.put<EntityResponse<Device>>(`${this.baseUrl}`, typeof body === 'object' ? JSON.stringify(body) : body);
39
- }
40
-
41
- /**
42
- * Create bulk of new device, returns list of inserted items
43
- */
44
- bulkCreate(body?: BulkDevices) {
45
- return this.rest.put<EntitiesResponse<Device>>(`${this.baseUrl}/bulk`, typeof body === 'object' ? JSON.stringify(body) : body);
46
- }
47
-
48
- /**
49
- * Update existing device in the system
50
- */
51
- update(body?: Device) {
52
- return this.rest.patch<EntityResponse<Device>>(`${this.baseUrl}`, typeof body === 'object' ? JSON.stringify(body) : body);
53
- }
54
-
55
- /**
56
- * Update bulk of device, returns list of updated items
57
- */
58
- bulkUpdate(body?: BulkDevices) {
59
- return this.rest.patch<EntitiesResponse<Device>>(`${this.baseUrl}/bulk`, typeof body === 'object' ? JSON.stringify(body) : body);
60
- }
61
-
62
- /**
63
- * Delete device from the system
64
- */
65
- delete(id?: string) {
66
- return this.rest.delete<ActionResponse>(`${this.baseUrl}/${id}`);
67
- }
68
-
69
- /**
70
- * Get single device by id
71
- */
72
- get(id?: string) {
73
- return this.rest.get<EntityResponse<Device>>(`${this.baseUrl}/${id}`);
74
- }
75
-
76
- /**
77
- * Find list of devices by query
78
- */
79
- find(streamId?: string, search?: string, type?: DeviceTypeCode[], status?: DeviceStatusCode[], risk?: SeverityTypeCode[], scoreRange?: number[], sort?: string, page?: number, size?: number) {
80
- const params = [];
81
- if (streamId != null) { params.push(`streamId=${streamId}`); }
82
- if (search != null) { params.push(`search=${search}`); }
83
- if (type != null) { params.push(`type=${type}`); }
84
- if (status != null) { params.push(`status=${status}`); }
85
- if (risk != null) { params.push(`risk=${risk}`); }
86
- if (scoreRange != null) { params.push(`scoreRange=${scoreRange}`); }
87
- if (sort != null) { params.push(`sort=${sort}`); }
88
- if (page != null) { params.push(`page=${page}`); }
89
- if (size != null) { params.push(`size=${size}`); }
90
-
91
- return this.rest.get<EntitiesResponse<Device>>(`${this.baseUrl}`, ...params);
92
- }
93
-
94
- /**
95
- * Export list of devices by query to a file with the specified format
96
- */
97
- exportFormat(format?: string, streamId?: string, search?: string, type?: DeviceTypeCode[], status?: DeviceStatusCode[], risk?: SeverityTypeCode[], sort?: string, page?: number, size?: number) {
98
- const params = [];
99
- if (streamId != null) { params.push(`streamId=${streamId}`); }
100
- if (search != null) { params.push(`search=${search}`); }
101
- if (type != null) { params.push(`type=${type}`); }
102
- if (status != null) { params.push(`status=${status}`); }
103
- if (risk != null) { params.push(`risk=${risk}`); }
104
- if (sort != null) { params.push(`sort=${sort}`); }
105
- if (page != null) { params.push(`page=${page}`); }
106
- if (size != null) { params.push(`size=${size}`); }
107
-
108
- return this.rest.download(`devices`,`${this.baseUrl}/export/${format}`, ...params);
109
- }
110
-
111
- /**
112
- * Find top 10 devices by their score filter by query
113
- */
114
- findTop(streamId?: string, search?: string, type?: DeviceTypeCode[], status?: DeviceStatusCode[], risk?: SeverityTypeCode[], scoreRange?: number[], sort?: string, page?: number, size?: number) {
115
- const params = [];
116
- if (streamId != null) { params.push(`streamId=${streamId}`); }
117
- if (search != null) { params.push(`search=${search}`); }
118
- if (type != null) { params.push(`type=${type}`); }
119
- if (status != null) { params.push(`status=${status}`); }
120
- if (risk != null) { params.push(`risk=${risk}`); }
121
- if (scoreRange != null) { params.push(`scoreRange=${scoreRange}`); }
122
- if (sort != null) { params.push(`sort=${sort}`); }
123
- if (page != null) { params.push(`page=${page}`); }
124
- if (size != null) { params.push(`size=${size}`); }
125
-
126
- return this.rest.get<EntitiesResponse<DeviceWithEvents>>(`${this.baseUrl}/top`, ...params);
127
- }
128
-
129
- /**
130
- * Find device distribution by type filtered by query
131
- */
132
- countByType(streamId?: string, search?: string, type?: DeviceTypeCode[], status?: DeviceStatusCode[], risk?: SeverityTypeCode[], scoreRange?: number[], sort?: string, page?: number, size?: number) {
133
- const params = [];
134
- if (streamId != null) { params.push(`streamId=${streamId}`); }
135
- if (search != null) { params.push(`search=${search}`); }
136
- if (type != null) { params.push(`type=${type}`); }
137
- if (status != null) { params.push(`status=${status}`); }
138
- if (risk != null) { params.push(`risk=${risk}`); }
139
- if (scoreRange != null) { params.push(`scoreRange=${scoreRange}`); }
140
- if (sort != null) { params.push(`sort=${sort}`); }
141
- if (page != null) { params.push(`page=${page}`); }
142
- if (size != null) { params.push(`size=${size}`); }
143
-
144
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-type`, ...params);
145
- }
146
-
147
- /**
148
- * Find device distribution by status filtered by query
149
- */
150
- countByStatus(streamId?: string, search?: string, type?: DeviceTypeCode[], status?: DeviceStatusCode[], risk?: SeverityTypeCode[], scoreRange?: number[], sort?: string, page?: number, size?: number) {
151
- const params = [];
152
- if (streamId != null) { params.push(`streamId=${streamId}`); }
153
- if (search != null) { params.push(`search=${search}`); }
154
- if (type != null) { params.push(`type=${type}`); }
155
- if (status != null) { params.push(`status=${status}`); }
156
- if (risk != null) { params.push(`risk=${risk}`); }
157
- if (scoreRange != null) { params.push(`scoreRange=${scoreRange}`); }
158
- if (sort != null) { params.push(`sort=${sort}`); }
159
- if (page != null) { params.push(`page=${page}`); }
160
- if (size != null) { params.push(`size=${size}`); }
161
-
162
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-status`, ...params);
163
- }
164
-
165
- /**
166
- * Find device distribution by action filtered by query
167
- */
168
- countByAction(streamId?: string, search?: string, type?: DeviceTypeCode[], status?: DeviceStatusCode[], risk?: SeverityTypeCode[], scoreRange?: number[], sort?: string, page?: number, size?: number) {
169
- const params = [];
170
- if (streamId != null) { params.push(`streamId=${streamId}`); }
171
- if (search != null) { params.push(`search=${search}`); }
172
- if (type != null) { params.push(`type=${type}`); }
173
- if (status != null) { params.push(`status=${status}`); }
174
- if (risk != null) { params.push(`risk=${risk}`); }
175
- if (scoreRange != null) { params.push(`scoreRange=${scoreRange}`); }
176
- if (sort != null) { params.push(`sort=${sort}`); }
177
- if (page != null) { params.push(`page=${page}`); }
178
- if (size != null) { params.push(`size=${size}`); }
179
-
180
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-action`, ...params);
181
- }
182
-
183
- /**
184
- * Add tag to a device
185
- */
186
- addTag(id?: string, tag?: string) {
187
- return this.rest.post<EntityResponse<Device>>(`${this.baseUrl}/${id}/tags/${tag}`, '');
188
- }
189
-
190
- /**
191
- * Delete a tag from the device
192
- */
193
- deleteTag(id?: string, tag?: string) {
194
- return this.rest.delete<EntityResponse<Device>>(`${this.baseUrl}/${id}/tags/${tag}`);
195
- }
196
-
197
- /**
198
- * Apply action on a device
199
- */
200
- applyAction(id?: string, action?: DeviceActionCode) {
201
- return this.rest.post<ActionResponse>(`${this.baseUrl}/${id}/actions/${action}`, '');
202
- }
203
-
204
- /**
205
- * Get network map of devices
206
- */
207
- getNetworkMap(streamId?: string, from?: number, to?: number, type?: DeviceTypeCode[], tag?: string[], id?: string[], mapType?: NetworkMapTypeCode, ips?: string[]) {
208
- const params = [];
209
- if (streamId != null) { params.push(`streamId=${streamId}`); }
210
- if (from != null) { params.push(`from=${from}`); }
211
- if (to != null) { params.push(`to=${to}`); }
212
- if (type != null) { params.push(`type=${type}`); }
213
- if (tag != null) { params.push(`tag=${tag}`); }
214
- if (id != null) { params.push(`id=${id}`); }
215
- if (mapType != null) { params.push(`mapType=${mapType}`); }
216
- if (ips != null) { params.push(`ips=${ips}`); }
217
-
218
- return this.rest.get<EntityResponse<NetworkMap>>(`${this.baseUrl}/network-map`, ...params);
219
- }
220
-
221
- /**
222
- * Get daily device report over time (daily device report includes: total devices, active devices, devices at risk)
223
- */
224
- getDeviceReportTimeline(streamId?: string, from?: number, to?: number) {
225
- const params = [];
226
- if (streamId != null) { params.push(`streamId=${streamId}`); }
227
- if (from != null) { params.push(`from=${from}`); }
228
- if (to != null) { params.push(`to=${to}`); }
229
-
230
- return this.rest.get<EntityResponse<TimeSeriesOfDeviceReport>>(`${this.baseUrl}/report/timeline`, ...params);
231
- }
232
-
233
- /**
234
- * Get latest device report, the Key contains latest devices at risk number (works in account level)
235
- */
236
- getLatestDeviceReport() {
237
- return this.rest.get<EntityResponse<DeviceReport>>(`${this.baseUrl}/report/latest`);
238
- }
239
-
240
- /**
241
- * Get device / group of devices consumption over time
242
- */
243
- getConsumptionTimeline(streamId?: string, from?: number, to?: number, type?: DeviceTypeCode[], tag?: string[], id?: string[]) {
244
- const params = [];
245
- if (streamId != null) { params.push(`streamId=${streamId}`); }
246
- if (from != null) { params.push(`from=${from}`); }
247
- if (to != null) { params.push(`to=${to}`); }
248
- if (type != null) { params.push(`type=${type}`); }
249
- if (tag != null) { params.push(`tag=${tag}`); }
250
- if (id != null) { params.push(`id=${id}`); }
251
-
252
- return this.rest.get<EntityResponse<TimeSeriesOfDataConsumption>>(`${this.baseUrl}/consumption/timeline`, ...params);
253
- }
254
-
255
- /**
256
- * Get device / group of devices consumption over time
257
- */
258
- getConsumptionTrend(streamId?: string, from?: number, to?: number, type?: DeviceTypeCode[], tag?: string[], id?: string[]) {
259
- const params = [];
260
- if (streamId != null) { params.push(`streamId=${streamId}`); }
261
- if (from != null) { params.push(`from=${from}`); }
262
- if (to != null) { params.push(`to=${to}`); }
263
- if (type != null) { params.push(`type=${type}`); }
264
- if (tag != null) { params.push(`tag=${tag}`); }
265
- if (id != null) { params.push(`id=${id}`); }
266
-
267
- return this.rest.get<ActionResponse>(`${this.baseUrl}/consumption/trend`, ...params);
268
- }
269
-
270
- /**
271
- * Upload list of devices
272
- */
273
- uploadDevices(file: File, streamId?: string, ip?: number, iccid?: number, imsi?: number, msisdn?: number, imei?: number, name?: number, operator?: number, label?: number[], tag?: number[]) {
274
- const params = [];
275
- if (streamId != null) { params.push(`streamId=${streamId}`); }
276
- if (ip != null) { params.push(`ip=${ip}`); }
277
- if (iccid != null) { params.push(`iccid=${iccid}`); }
278
- if (imsi != null) { params.push(`imsi=${imsi}`); }
279
- if (msisdn != null) { params.push(`msisdn=${msisdn}`); }
280
- if (imei != null) { params.push(`imei=${imei}`); }
281
- if (name != null) { params.push(`name=${name}`); }
282
- if (operator != null) { params.push(`operator=${operator}`); }
283
- if (label != null) { params.push(`label=${label}`); }
284
- if (tag != null) { params.push(`tag=${tag}`); }
285
-
286
- return this.rest.upload(file,`${this.baseUrl}/upload`, ...params);
287
- }
288
-
289
- /**
290
- * Find list of devices by Insight id query
291
- */
292
- findByInsightContext(streamId?: string, insightId?: string, sort?: string, page?: number, size?: number) {
293
- const params = [];
294
- if (streamId != null) { params.push(`streamId=${streamId}`); }
295
- if (insightId != null) { params.push(`insightId=${insightId}`); }
296
- if (sort != null) { params.push(`sort=${sort}`); }
297
- if (page != null) { params.push(`page=${page}`); }
298
- if (size != null) { params.push(`size=${size}`); }
299
-
300
- return this.rest.get<EntitiesResponse<Device>>(`${this.baseUrl}/find-by-insight-context`, ...params);
301
- }
302
-
303
- }
@@ -1,355 +0,0 @@
1
- import { RestUtil, EntityResponse, EntitiesResponse, ActionResponse } from '../../utils';
2
- import { PulseConfig } from '../../config';
3
-
4
- import { SeverityTypeCode } from '../enums';
5
- import { EventCategoryCode } from '../enums';
6
- import { RuleTypeCode } from '../enums';
7
- import { EventWithDevice } from '../entities';
8
- import { TimeSeriesOf2D } from '../common';
9
- import { TimeSeriesOfFloat } from '../common';
10
- import { Event } from '../entities';
11
- import { EventTypeCode } from '../enums';
12
- import { MaliciousIPCard } from '../common';
13
- import { StringKeyValue } from '../common';
14
- import { IntDistribution } from '../entities';
15
- import { EventStatusCode } from '../enums';
16
- import { MaliciousIPData } from '../common';
17
-
18
-
19
-
20
- // List of events related actions for the operator
21
- // @RequestHeader X-API-KEY The key to identify the application (console)
22
- // @RequestHeader X-ACCESS-TOKEN The token to identify the logged-in user
23
- export class UsrEventsService {
24
-
25
- // URL to web api
26
- private baseUrl = '/events';
27
-
28
- // Class constructor
29
- constructor(private config: PulseConfig, private rest: RestUtil) {
30
- this.baseUrl = this.config.api + this.baseUrl;
31
- }
32
-
33
-
34
- /**
35
- * Get single event by id
36
- */
37
- get(id?: string) {
38
- return this.rest.get<EntityResponse<Event>>(`${this.baseUrl}/${id}`);
39
- }
40
-
41
- /**
42
- * Find list of events by query
43
- */
44
- find(streamId?: string, deviceId?: string, alertId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number) {
45
- const params = [];
46
- if (streamId != null) { params.push(`streamId=${streamId}`); }
47
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
48
- if (alertId != null) { params.push(`alertId=${alertId}`); }
49
- if (search != null) { params.push(`search=${search}`); }
50
- if (from != null) { params.push(`from=${from}`); }
51
- if (to != null) { params.push(`to=${to}`); }
52
- if (type != null) { params.push(`type=${type}`); }
53
- if (severity != null) { params.push(`severity=${severity}`); }
54
- if (category != null) { params.push(`category=${category}`); }
55
- if (status != null) { params.push(`status=${status}`); }
56
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
57
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
58
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
59
- if (sort != null) { params.push(`sort=${sort}`); }
60
- if (page != null) { params.push(`page=${page}`); }
61
- if (size != null) { params.push(`size=${size}`); }
62
-
63
- return this.rest.get<EntitiesResponse<Event>>(`${this.baseUrl}`, ...params);
64
- }
65
-
66
- /**
67
- * Export list of events by query to a file with the specified format
68
- */
69
- exportFormat(format?: string, streamId?: string, deviceId?: string, alertId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number) {
70
- const params = [];
71
- if (streamId != null) { params.push(`streamId=${streamId}`); }
72
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
73
- if (alertId != null) { params.push(`alertId=${alertId}`); }
74
- if (search != null) { params.push(`search=${search}`); }
75
- if (from != null) { params.push(`from=${from}`); }
76
- if (to != null) { params.push(`to=${to}`); }
77
- if (type != null) { params.push(`type=${type}`); }
78
- if (severity != null) { params.push(`severity=${severity}`); }
79
- if (category != null) { params.push(`category=${category}`); }
80
- if (status != null) { params.push(`status=${status}`); }
81
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
82
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
83
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
84
- if (sort != null) { params.push(`sort=${sort}`); }
85
- if (page != null) { params.push(`page=${page}`); }
86
- if (size != null) { params.push(`size=${size}`); }
87
-
88
- return this.rest.download(`usr-events`,`${this.baseUrl}/export/${format}`, ...params);
89
- }
90
-
91
- /**
92
- * Find top 10 events by their severity filter by query
93
- */
94
- getTop(streamId?: string, deviceId?: string, alertId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number) {
95
- const params = [];
96
- if (streamId != null) { params.push(`streamId=${streamId}`); }
97
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
98
- if (alertId != null) { params.push(`alertId=${alertId}`); }
99
- if (search != null) { params.push(`search=${search}`); }
100
- if (from != null) { params.push(`from=${from}`); }
101
- if (to != null) { params.push(`to=${to}`); }
102
- if (type != null) { params.push(`type=${type}`); }
103
- if (severity != null) { params.push(`severity=${severity}`); }
104
- if (category != null) { params.push(`category=${category}`); }
105
- if (status != null) { params.push(`status=${status}`); }
106
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
107
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
108
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
109
- if (sort != null) { params.push(`sort=${sort}`); }
110
- if (page != null) { params.push(`page=${page}`); }
111
- if (size != null) { params.push(`size=${size}`); }
112
-
113
- return this.rest.get<EntitiesResponse<EventWithDevice>>(`${this.baseUrl}/top`, ...params);
114
- }
115
-
116
- /**
117
- * Get top malicious IPs
118
- */
119
- getTopMaliciousIPs(streamId?: string, top?: number, from?: number, to?: number) {
120
- const params = [];
121
- if (streamId != null) { params.push(`streamId=${streamId}`); }
122
- if (top != null) { params.push(`top=${top}`); }
123
- if (from != null) { params.push(`from=${from}`); }
124
- if (to != null) { params.push(`to=${to}`); }
125
-
126
- return this.rest.get<EntitiesResponse<MaliciousIPData>>(`${this.baseUrl}/top-malicious-ips`, ...params);
127
- }
128
-
129
- /**
130
- * Find events distribution by type filtered by query
131
- */
132
- countByType(streamId?: string, deviceId?: string, alertId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number) {
133
- const params = [];
134
- if (streamId != null) { params.push(`streamId=${streamId}`); }
135
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
136
- if (alertId != null) { params.push(`alertId=${alertId}`); }
137
- if (search != null) { params.push(`search=${search}`); }
138
- if (from != null) { params.push(`from=${from}`); }
139
- if (to != null) { params.push(`to=${to}`); }
140
- if (type != null) { params.push(`type=${type}`); }
141
- if (severity != null) { params.push(`severity=${severity}`); }
142
- if (category != null) { params.push(`category=${category}`); }
143
- if (status != null) { params.push(`status=${status}`); }
144
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
145
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
146
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
147
- if (sort != null) { params.push(`sort=${sort}`); }
148
- if (page != null) { params.push(`page=${page}`); }
149
- if (size != null) { params.push(`size=${size}`); }
150
-
151
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-type`, ...params);
152
- }
153
-
154
- /**
155
- * Find events distribution by status filtered by query
156
- */
157
- countByStatus(streamId?: string, deviceId?: string, alertId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number) {
158
- const params = [];
159
- if (streamId != null) { params.push(`streamId=${streamId}`); }
160
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
161
- if (alertId != null) { params.push(`alertId=${alertId}`); }
162
- if (search != null) { params.push(`search=${search}`); }
163
- if (from != null) { params.push(`from=${from}`); }
164
- if (to != null) { params.push(`to=${to}`); }
165
- if (type != null) { params.push(`type=${type}`); }
166
- if (severity != null) { params.push(`severity=${severity}`); }
167
- if (category != null) { params.push(`category=${category}`); }
168
- if (status != null) { params.push(`status=${status}`); }
169
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
170
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
171
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
172
- if (sort != null) { params.push(`sort=${sort}`); }
173
- if (page != null) { params.push(`page=${page}`); }
174
- if (size != null) { params.push(`size=${size}`); }
175
-
176
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-status`, ...params);
177
- }
178
-
179
- /**
180
- * Find events distribution by severity filtered by query
181
- */
182
- countBySeverity(streamId?: string, deviceId?: string, alertId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number) {
183
- const params = [];
184
- if (streamId != null) { params.push(`streamId=${streamId}`); }
185
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
186
- if (alertId != null) { params.push(`alertId=${alertId}`); }
187
- if (search != null) { params.push(`search=${search}`); }
188
- if (from != null) { params.push(`from=${from}`); }
189
- if (to != null) { params.push(`to=${to}`); }
190
- if (type != null) { params.push(`type=${type}`); }
191
- if (severity != null) { params.push(`severity=${severity}`); }
192
- if (category != null) { params.push(`category=${category}`); }
193
- if (status != null) { params.push(`status=${status}`); }
194
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
195
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
196
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
197
- if (sort != null) { params.push(`sort=${sort}`); }
198
- if (page != null) { params.push(`page=${page}`); }
199
- if (size != null) { params.push(`size=${size}`); }
200
-
201
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-severity`, ...params);
202
- }
203
-
204
- /**
205
- * Find events distribution by rule filtered by query
206
- */
207
- countByRule(streamId?: string, deviceId?: string, alertId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number) {
208
- const params = [];
209
- if (streamId != null) { params.push(`streamId=${streamId}`); }
210
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
211
- if (alertId != null) { params.push(`alertId=${alertId}`); }
212
- if (search != null) { params.push(`search=${search}`); }
213
- if (from != null) { params.push(`from=${from}`); }
214
- if (to != null) { params.push(`to=${to}`); }
215
- if (type != null) { params.push(`type=${type}`); }
216
- if (severity != null) { params.push(`severity=${severity}`); }
217
- if (category != null) { params.push(`category=${category}`); }
218
- if (status != null) { params.push(`status=${status}`); }
219
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
220
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
221
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
222
- if (sort != null) { params.push(`sort=${sort}`); }
223
- if (page != null) { params.push(`page=${page}`); }
224
- if (size != null) { params.push(`size=${size}`); }
225
-
226
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-rule`, ...params);
227
- }
228
-
229
- /**
230
- * Find events distribution by category filtered by query
231
- */
232
- countByCategory(streamId?: string, deviceId?: string, alertId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number) {
233
- const params = [];
234
- if (streamId != null) { params.push(`streamId=${streamId}`); }
235
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
236
- if (alertId != null) { params.push(`alertId=${alertId}`); }
237
- if (search != null) { params.push(`search=${search}`); }
238
- if (from != null) { params.push(`from=${from}`); }
239
- if (to != null) { params.push(`to=${to}`); }
240
- if (type != null) { params.push(`type=${type}`); }
241
- if (severity != null) { params.push(`severity=${severity}`); }
242
- if (category != null) { params.push(`category=${category}`); }
243
- if (status != null) { params.push(`status=${status}`); }
244
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
245
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
246
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
247
- if (sort != null) { params.push(`sort=${sort}`); }
248
- if (page != null) { params.push(`page=${page}`); }
249
- if (size != null) { params.push(`size=${size}`); }
250
-
251
- return this.rest.get<EntityResponse<IntDistribution>>(`${this.baseUrl}/count/by-category`, ...params);
252
- }
253
-
254
- /**
255
- * Get current shieldex value as ActionResponse, the Key contains the shield index and the data includes the trend
256
- */
257
- getShieldex() {
258
- return this.rest.get<ActionResponse>(`${this.baseUrl}/shieldex`);
259
- }
260
-
261
- /**
262
- * Get histogram of events over time by dimension (type | severity | status | ruleType | category)
263
- */
264
- eventsTimeline(streamId?: string, deviceId?: string, alertId?: string, dimension?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[], sort?: string, page?: number, size?: number) {
265
- const params = [];
266
- if (streamId != null) { params.push(`streamId=${streamId}`); }
267
- if (deviceId != null) { params.push(`deviceId=${deviceId}`); }
268
- if (alertId != null) { params.push(`alertId=${alertId}`); }
269
- if (dimension != null) { params.push(`dimension=${dimension}`); }
270
- if (from != null) { params.push(`from=${from}`); }
271
- if (to != null) { params.push(`to=${to}`); }
272
- if (type != null) { params.push(`type=${type}`); }
273
- if (severity != null) { params.push(`severity=${severity}`); }
274
- if (category != null) { params.push(`category=${category}`); }
275
- if (status != null) { params.push(`status=${status}`); }
276
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
277
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
278
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
279
- if (sort != null) { params.push(`sort=${sort}`); }
280
- if (page != null) { params.push(`page=${page}`); }
281
- if (size != null) { params.push(`size=${size}`); }
282
-
283
- return this.rest.get<EntityResponse<TimeSeriesOf2D>>(`${this.baseUrl}/timeline`, ...params);
284
- }
285
-
286
- /**
287
- * Get histogram of shieldex values over time
288
- */
289
- shieldexTimeline(streamId?: string, from?: number, to?: number) {
290
- const params = [];
291
- if (streamId != null) { params.push(`streamId=${streamId}`); }
292
- if (from != null) { params.push(`from=${from}`); }
293
- if (to != null) { params.push(`to=${to}`); }
294
-
295
- return this.rest.get<EntityResponse<TimeSeriesOfFloat>>(`${this.baseUrl}/shieldex/timeline`, ...params);
296
- }
297
-
298
- /**
299
- * Export event source file
300
- */
301
- exportSource(id?: string) {
302
- return this.rest.download(`usr-events`,`${this.baseUrl}/${id}/export_source`);
303
- }
304
-
305
- /**
306
- * Get total number devices at risk (affected by the events matching the query)
307
- */
308
- getTotalDevicesAtRisk(streamId?: string, search?: string, from?: number, to?: number, type?: EventTypeCode[], severity?: SeverityTypeCode[], category?: EventCategoryCode[], status?: EventStatusCode[], ruleId?: string[], targetIp?: string, ruleType?: RuleTypeCode[]) {
309
- const params = [];
310
- if (streamId != null) { params.push(`streamId=${streamId}`); }
311
- if (search != null) { params.push(`search=${search}`); }
312
- if (from != null) { params.push(`from=${from}`); }
313
- if (to != null) { params.push(`to=${to}`); }
314
- if (type != null) { params.push(`type=${type}`); }
315
- if (severity != null) { params.push(`severity=${severity}`); }
316
- if (category != null) { params.push(`category=${category}`); }
317
- if (status != null) { params.push(`status=${status}`); }
318
- if (ruleId != null) { params.push(`ruleId=${ruleId}`); }
319
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
320
- if (ruleType != null) { params.push(`ruleType=${ruleType}`); }
321
-
322
- return this.rest.get<ActionResponse>(`${this.baseUrl}/devices-at-risk`, ...params);
323
- }
324
-
325
- /**
326
- * Get malicious IP data card for specific malicious IP
327
- */
328
- getMaliciousIpCard(streamId?: string, targetIp?: string, from?: number, to?: number) {
329
- const params = [];
330
- if (streamId != null) { params.push(`streamId=${streamId}`); }
331
- if (targetIp != null) { params.push(`targetIp=${targetIp}`); }
332
- if (from != null) { params.push(`from=${from}`); }
333
- if (to != null) { params.push(`to=${to}`); }
334
-
335
- return this.rest.get<EntityResponse<MaliciousIPCard>>(`${this.baseUrl}/malicious-ip-card`, ...params);
336
- }
337
-
338
- /**
339
- * Apply DNS lookup for each IP in the list
340
- */
341
- getIpLookup(ip?: string[]) {
342
- const params = [];
343
- if (ip != null) { params.push(`ip=${ip}`); }
344
-
345
- return this.rest.get<EntitiesResponse<StringKeyValue>>(`${this.baseUrl}/ip-lookup`, ...params);
346
- }
347
-
348
- /**
349
- * Find list of events by insight id query
350
- */
351
- findByInsightContext() {
352
- return this.rest.get<EntitiesResponse<Event>>(`${this.baseUrl}/find-by-insight-context`);
353
- }
354
-
355
- }