@al/aecoral
Advanced tools
Comparing version 2.0.5 to 2.0.6
@@ -0,5 +1,9 @@ | ||
/** | ||
* Module to deal with available Correlations Public API endpoints | ||
*/ | ||
import { SQXSearchQuery } from '@al/core'; | ||
export interface AlCreateCorrelationRequestV2 { | ||
version?: number; | ||
enabled: boolean; | ||
expression: string; | ||
expression: SQXSearchQuery | string; | ||
name: string; | ||
@@ -10,2 +14,3 @@ attacker: string; | ||
output?: AlIncidentDefinitionV2; | ||
sql_version?: 'v1' | 'v3'; | ||
} | ||
@@ -24,3 +29,3 @@ export interface AlIncidentDefinitionV2 { | ||
enabled: boolean; | ||
expression: object | string; | ||
expression: SQXSearchQuery | string; | ||
timeframe: string; | ||
@@ -44,2 +49,3 @@ name: string; | ||
} | null; | ||
sql_version?: 'v1' | 'v3'; | ||
} | ||
@@ -81,3 +87,3 @@ export interface Stats { | ||
*/ | ||
removeCorrelationRule(accountId: string, correlationId: string): Promise<any>; | ||
removeCorrelationRule(accountId: string, correlationId: string): Promise<void>; | ||
/** | ||
@@ -98,3 +104,3 @@ * Get correlation rule by ID | ||
*/ | ||
validateCorrelationPolicy(accountId: string, correlation: AlCreateCorrelationRequestV2): Promise<any>; | ||
validateCorrelationPolicy(accountId: string, correlation: AlCreateCorrelationRequestV2): Promise<void>; | ||
/** | ||
@@ -101,0 +107,0 @@ * Get possible correlation incident severities and classifications. |
@@ -120,3 +120,3 @@ 'use strict'; | ||
async createCorrelationRule(accountId, correlationRequest) { | ||
const result = await core.AlDefaultClient.post({ | ||
return core.AlDefaultClient.post({ | ||
service_stack: core.AlLocation.InsightAPI, | ||
@@ -129,6 +129,2 @@ service_name: this.serviceName, | ||
}); | ||
if (!result.hasOwnProperty("id")) { | ||
throw new core.AlResponseValidationError(`Service returned unexpected result; missing 'id' property.`); | ||
} | ||
return result; | ||
} | ||
@@ -139,3 +135,3 @@ /** | ||
async removeCorrelationRule(accountId, correlationId) { | ||
const response = await core.AlDefaultClient.delete({ | ||
return core.AlDefaultClient.delete({ | ||
service_stack: core.AlLocation.InsightAPI, | ||
@@ -147,3 +143,2 @@ service_name: this.serviceName, | ||
}); | ||
return response; | ||
} | ||
@@ -154,3 +149,3 @@ /** | ||
async getCorrelationRule(accountId, correlationId) { | ||
const correlation = await core.AlDefaultClient.get({ | ||
return core.AlDefaultClient.get({ | ||
service_stack: core.AlLocation.InsightAPI, | ||
@@ -162,3 +157,2 @@ service_name: this.serviceName, | ||
}); | ||
return correlation; | ||
} | ||
@@ -169,3 +163,3 @@ /** | ||
async getAllCorrelations(accountId, params = {}) { | ||
const correlations = await core.AlDefaultClient.get({ | ||
return core.AlDefaultClient.get({ | ||
service_stack: core.AlLocation.InsightAPI, | ||
@@ -178,3 +172,2 @@ service_name: this.serviceName, | ||
}); | ||
return correlations; | ||
} | ||
@@ -185,3 +178,3 @@ /** | ||
async updateCorrelationRule(accountId, correlationId, correlation) { | ||
const result = await core.AlDefaultClient.put({ | ||
return core.AlDefaultClient.put({ | ||
service_stack: core.AlLocation.InsightAPI, | ||
@@ -194,6 +187,2 @@ service_name: this.serviceName, | ||
}); | ||
if (!result.hasOwnProperty("id")) { | ||
throw new core.AlResponseValidationError(`Service returned unexpected result; missing 'id' property.`); | ||
} | ||
return result; | ||
} | ||
@@ -204,3 +193,3 @@ /** | ||
async validateCorrelationPolicy(accountId, correlation) { | ||
const response = await core.AlDefaultClient.post({ | ||
return core.AlDefaultClient.post({ | ||
service_stack: core.AlLocation.InsightAPI, | ||
@@ -213,3 +202,2 @@ service_name: this.serviceName, | ||
}); | ||
return response; | ||
} | ||
@@ -220,3 +208,3 @@ /** | ||
async getIncidentSpecifications() { | ||
const result = await core.AlDefaultClient.get({ | ||
return core.AlDefaultClient.get({ | ||
service_stack: core.AlLocation.InsightAPI, | ||
@@ -227,3 +215,2 @@ service_name: this.serviceName, | ||
}); | ||
return result; | ||
} | ||
@@ -230,0 +217,0 @@ } |
@@ -116,3 +116,3 @@ import { AlDefaultClient, AlLocation, AlResponseValidationError, AlGlobalizer } from '@al/core'; | ||
async createCorrelationRule(accountId, correlationRequest) { | ||
const result = await AlDefaultClient.post({ | ||
return AlDefaultClient.post({ | ||
service_stack: AlLocation.InsightAPI, | ||
@@ -125,6 +125,2 @@ service_name: this.serviceName, | ||
}); | ||
if (!result.hasOwnProperty("id")) { | ||
throw new AlResponseValidationError(`Service returned unexpected result; missing 'id' property.`); | ||
} | ||
return result; | ||
} | ||
@@ -135,3 +131,3 @@ /** | ||
async removeCorrelationRule(accountId, correlationId) { | ||
const response = await AlDefaultClient.delete({ | ||
return AlDefaultClient.delete({ | ||
service_stack: AlLocation.InsightAPI, | ||
@@ -143,3 +139,2 @@ service_name: this.serviceName, | ||
}); | ||
return response; | ||
} | ||
@@ -150,3 +145,3 @@ /** | ||
async getCorrelationRule(accountId, correlationId) { | ||
const correlation = await AlDefaultClient.get({ | ||
return AlDefaultClient.get({ | ||
service_stack: AlLocation.InsightAPI, | ||
@@ -158,3 +153,2 @@ service_name: this.serviceName, | ||
}); | ||
return correlation; | ||
} | ||
@@ -165,3 +159,3 @@ /** | ||
async getAllCorrelations(accountId, params = {}) { | ||
const correlations = await AlDefaultClient.get({ | ||
return AlDefaultClient.get({ | ||
service_stack: AlLocation.InsightAPI, | ||
@@ -174,3 +168,2 @@ service_name: this.serviceName, | ||
}); | ||
return correlations; | ||
} | ||
@@ -181,3 +174,3 @@ /** | ||
async updateCorrelationRule(accountId, correlationId, correlation) { | ||
const result = await AlDefaultClient.put({ | ||
return AlDefaultClient.put({ | ||
service_stack: AlLocation.InsightAPI, | ||
@@ -190,6 +183,2 @@ service_name: this.serviceName, | ||
}); | ||
if (!result.hasOwnProperty("id")) { | ||
throw new AlResponseValidationError(`Service returned unexpected result; missing 'id' property.`); | ||
} | ||
return result; | ||
} | ||
@@ -200,3 +189,3 @@ /** | ||
async validateCorrelationPolicy(accountId, correlation) { | ||
const response = await AlDefaultClient.post({ | ||
return AlDefaultClient.post({ | ||
service_stack: AlLocation.InsightAPI, | ||
@@ -209,3 +198,2 @@ service_name: this.serviceName, | ||
}); | ||
return response; | ||
} | ||
@@ -216,3 +204,3 @@ /** | ||
async getIncidentSpecifications() { | ||
const result = await AlDefaultClient.get({ | ||
return AlDefaultClient.get({ | ||
service_stack: AlLocation.InsightAPI, | ||
@@ -223,3 +211,2 @@ service_name: this.serviceName, | ||
}); | ||
return result; | ||
} | ||
@@ -226,0 +213,0 @@ } |
@@ -229,20 +229,11 @@ import { AlResponseValidationError, AlDefaultClient, AlLocation, AlGlobalizer } from '@al/core'; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, AlDefaultClient.post({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
account_id: accountId, | ||
path: '/correlations', | ||
data: correlationRequest, | ||
})]; | ||
case 1: | ||
result = _a.sent(); | ||
if (!result.hasOwnProperty("id")) { | ||
throw new AlResponseValidationError("Service returned unexpected result; missing 'id' property."); | ||
} | ||
return [2 /*return*/, result]; | ||
} | ||
return [2 /*return*/, AlDefaultClient.post({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
account_id: accountId, | ||
path: '/correlations', | ||
data: correlationRequest, | ||
})]; | ||
}); | ||
@@ -256,16 +247,10 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, AlDefaultClient.delete({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
account_id: accountId, | ||
path: "/correlations/" + correlationId | ||
})]; | ||
case 1: | ||
response = _a.sent(); | ||
return [2 /*return*/, response]; | ||
} | ||
return [2 /*return*/, AlDefaultClient.delete({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
account_id: accountId, | ||
path: "/correlations/" + correlationId | ||
})]; | ||
}); | ||
@@ -279,16 +264,10 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var correlation; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, AlDefaultClient.get({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
account_id: accountId, | ||
path: "/correlations/" + correlationId, | ||
})]; | ||
case 1: | ||
correlation = _a.sent(); | ||
return [2 /*return*/, correlation]; | ||
} | ||
return [2 /*return*/, AlDefaultClient.get({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
account_id: accountId, | ||
path: "/correlations/" + correlationId, | ||
})]; | ||
}); | ||
@@ -303,17 +282,11 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var correlations; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, AlDefaultClient.get({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
account_id: accountId, | ||
path: '/correlations', | ||
params: params | ||
})]; | ||
case 1: | ||
correlations = _a.sent(); | ||
return [2 /*return*/, correlations]; | ||
} | ||
return [2 /*return*/, AlDefaultClient.get({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
account_id: accountId, | ||
path: '/correlations', | ||
params: params | ||
})]; | ||
}); | ||
@@ -327,20 +300,11 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, AlDefaultClient.put({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
account_id: accountId, | ||
path: "/correlations/" + correlationId, | ||
data: correlation | ||
})]; | ||
case 1: | ||
result = _a.sent(); | ||
if (!result.hasOwnProperty("id")) { | ||
throw new AlResponseValidationError("Service returned unexpected result; missing 'id' property."); | ||
} | ||
return [2 /*return*/, result]; | ||
} | ||
return [2 /*return*/, AlDefaultClient.put({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
account_id: accountId, | ||
path: "/correlations/" + correlationId, | ||
data: correlation | ||
})]; | ||
}); | ||
@@ -354,17 +318,11 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, AlDefaultClient.post({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
account_id: accountId, | ||
path: '/correlations/validate', | ||
data: correlation | ||
})]; | ||
case 1: | ||
response = _a.sent(); | ||
return [2 /*return*/, response]; | ||
} | ||
return [2 /*return*/, AlDefaultClient.post({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
account_id: accountId, | ||
path: '/correlations/validate', | ||
data: correlation | ||
})]; | ||
}); | ||
@@ -378,15 +336,9 @@ }); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var result; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, AlDefaultClient.get({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
path: '/specifications/incident', | ||
})]; | ||
case 1: | ||
result = _a.sent(); | ||
return [2 /*return*/, result]; | ||
} | ||
return [2 /*return*/, AlDefaultClient.get({ | ||
service_stack: AlLocation.InsightAPI, | ||
service_name: this.serviceName, | ||
version: 2, | ||
path: '/specifications/incident', | ||
})]; | ||
}); | ||
@@ -393,0 +345,0 @@ }); |
{ | ||
"name": "@al/aecoral", | ||
"version": "2.0.5", | ||
"version": "2.0.6", | ||
"license": "MIT", | ||
@@ -49,3 +49,3 @@ "description": "A client for interacting with the Alert Logic Analytics Engine Correlations Public API", | ||
], | ||
"gitHead": "785286ae3e40570bf5d30ac717350685ef82fe23" | ||
"gitHead": "4f9a8b08dad2d4236b563680d72b9ea6f75a61bf" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
88896
970