@devoinc/alerts-api-client
Version:
Typescript client for devo alerts API
755 lines (754 loc) • 24.4 kB
TypeScript
export declare class ClientBase {
private readonly config;
protected constructor(config: IConfig);
protected transformOptions(options: RequestInit): Promise<RequestInit>;
protected transformResult(url: string, response: Response, processor: (response: Response) => any): any;
}
export interface IClient {
/**
* Add Alert comment
* @param body Add comment to one alert
*/
addComment(body: AlertCommentSecOps): Promise<boolean>;
/**
* Add comment to multiple Alerts
* @param body Comment to add to several alert ids
*/
addComments(body: AlertCommentSecOpsBulk): Promise<string[]>;
/**
* Delete Alert comment
* @param body List of ID comments to delete
*/
deleteComment(body: number[]): Promise<boolean>;
/**
* Get all Alert comments
* @param body Alert ID lists
*/
getList(body: number[]): Promise<AlertComments[]>;
/**
* Update Alert comment
* @param commentId Comment id
* @param body Updated comment
*/
updateComment(commentId: string, body: AlertCommentSecOps): Promise<boolean>;
/**
* Update bulk Alert comments
* @param body Bulk comment update resource
*/
updateComments(body: AlertCommentSecOpsBulkUpdate): Promise<string>;
/**
* Get Alert without context
* @param id Alert ID
* @param tags (optional) If the parameter exists and the value is TRUE all the alert tags will be included in the response.
* @param annotations (optional) If the parameter exists and the value is TRUE all the alert annotations will be included in the response.
*/
get(id: string, tags: boolean | undefined, annotations: boolean | undefined): Promise<Alert>;
/**
* Get Alerts
* @param limit The limit, max number of elements returned
* @param offset The offset, start element in the element number
* @param from The date from in epoch time,with milliseconds obtain from new Date(Long.parseLong(from))
* @param to The date to in epoch time,with milliseconds,obtain from new Date(Long.parseLong(from))
* @param orderby (optional) Field to order, must be:
id,
domain,
priority,
context,
category,
srcPort,
srcIp,
srcHost,
dstIp,
dstPort,
dstHost,
protocol,
username,
application,
engine,
extraData,
status,
ack_status_date,
createDate,
updateDate.
* @param orderasc (optional) Order Ascending
* @param showAll (optional) Obtain all (false positive and close status included) Default:False
*/
getListByCriterias(limit: string, offset: string, from: string, to: string, orderby: string | undefined, orderasc: boolean | undefined, showAll: boolean | undefined): Promise<AlertExtended[]>;
/**
* Get Alert Statistics
* @param showAll (optional) Obtain all (false positive and close status included) Default:False
* @deprecated
*/
getListByCriteriasOverview(showAll: boolean | undefined): Promise<string>;
/**
* Get Alert statistics
* @param hours (optional) Hours back to obtain data
* @param from (optional) From to obtain data
* @param type (optional) Type of result, may be 'raw', 'funnel, 'list'
* @param filterName (optional) filter by name context
* @param showAll (optional) Obtain all (false positive and close status included) Default:False
*/
getStatistics(hours: number | undefined, from: number | undefined, type: string | undefined, filterName: string | undefined, showAll: boolean | undefined): Promise<FunnelStatistics[]>;
/**
* Get Alert statuses
* @param from (optional) The date from in epoch time, with miliseconds. Default value 24 hours before petition
*/
listStatus(from: string | undefined): Promise<string>;
/**
* Update Alert status
* @param id Alert ID
* @param status Alert status with this possible values:
UNREAD = 0;
UPDATED = 1;
FALSE POSTIVE = 2;
WATCHED = 100;
CLOSED = 300;
REMINDER = 500;
RECOVERY = 600;
ANTI FLOOD = 700;
*/
updateStatus(id: string, status: number): Promise<Alert>;
/**
* Update Alert status
* @param status Alert status with this possible values:
UNREAD = 0;
UPDATED = 1;
FALSE POSTIVE = 2;
WATCHED = 100;
CLOSED = 300;
REMINDER = 500;
RECOVERY = 600;
ANTI FLOOD = 700;
* @param body (optional)
*/
updateStatusLists(status: number, body: Blob | undefined): Promise<any>;
/**
* Get Alert definitions
* @param nameFilter (optional) Alert name to filter
* @param idFilter (optional) Alert id to filter
* @param body (optional)
*/
getAlerts(nameFilter: string | undefined, idFilter: string | undefined, body: Pageable | undefined): Promise<AlertDefinition[]>;
/**
* Updated Alert definitions
* @param body (optional)
*/
putAlerts(body: AlertDefinition | undefined): Promise<AlertDefinition>;
/**
* Create Alert definition
* @param body (optional)
*/
postAlerts(body: AlertDefinition | undefined): Promise<AlertDefinition>;
/**
* Delete Alert definitions
* @param alertIds List of alert definitions IDs
* @return Deletion was successful
*/
deleteAlerts(alertIds: string[]): Promise<void>;
/**
* Updates a batch of Alert definitions
* @param body (optional)
*/
putAlertsBatch(body: AlertDefinition[] | undefined): Promise<AlertDefinition[]>;
/**
* Create batch of Alert definitions
* @param body (optional)
*/
postAlertsBatch(body: AlertDefinition[] | undefined): Promise<AlertDefinition[]>;
/**
* Update Alert definition statuses
* @param alertIds List of alert definitions IDs
* @param enable Enable/disable alert definitions
*/
putAlertStatus(alertIds: string[], enable: boolean): Promise<AlertSubscriptionUpdate>;
/**
* Assign Tag to Alert
* @param body Alert IDs and tags to be set to the alerts
*/
setTags(body: AlertTagsRequest): Promise<any>;
}
export declare class Client extends ClientBase implements IClient {
private http;
private baseUrl;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined;
constructor(configuration: IConfig, baseUrl?: string, http?: {
fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
});
/**
* Add Alert comment
* @param body Add comment to one alert
*/
addComment(body: AlertCommentSecOps): Promise<boolean>;
protected processAddComment(response: Response): Promise<boolean>;
/**
* Add comment to multiple Alerts
* @param body Comment to add to several alert ids
*/
addComments(body: AlertCommentSecOpsBulk): Promise<string[]>;
protected processAddComments(response: Response): Promise<string[]>;
/**
* Delete Alert comment
* @param body List of ID comments to delete
*/
deleteComment(body: number[]): Promise<boolean>;
protected processDeleteComment(response: Response): Promise<boolean>;
/**
* Get all Alert comments
* @param body Alert ID lists
*/
getList(body: number[]): Promise<AlertComments[]>;
protected processGetList(response: Response): Promise<AlertComments[]>;
/**
* Update Alert comment
* @param commentId Comment id
* @param body Updated comment
*/
updateComment(commentId: string, body: AlertCommentSecOps): Promise<boolean>;
protected processUpdateComment(response: Response): Promise<boolean>;
/**
* Update bulk Alert comments
* @param body Bulk comment update resource
*/
updateComments(body: AlertCommentSecOpsBulkUpdate): Promise<string>;
protected processUpdateComments(response: Response): Promise<string>;
/**
* Get Alert without context
* @param id Alert ID
* @param tags (optional) If the parameter exists and the value is TRUE all the alert tags will be included in the response.
* @param annotations (optional) If the parameter exists and the value is TRUE all the alert annotations will be included in the response.
*/
get(id: string, tags: boolean | undefined, annotations: boolean | undefined): Promise<Alert>;
protected processGet(response: Response): Promise<Alert>;
/**
* Get Alerts
* @param limit The limit, max number of elements returned
* @param offset The offset, start element in the element number
* @param from The date from in epoch time,with milliseconds obtain from new Date(Long.parseLong(from))
* @param to The date to in epoch time,with milliseconds,obtain from new Date(Long.parseLong(from))
* @param orderby (optional) Field to order, must be:
id,
domain,
priority,
context,
category,
srcPort,
srcIp,
srcHost,
dstIp,
dstPort,
dstHost,
protocol,
username,
application,
engine,
extraData,
status,
ack_status_date,
createDate,
updateDate.
* @param orderasc (optional) Order Ascending
* @param showAll (optional) Obtain all (false positive and close status included) Default:False
*/
getListByCriterias(limit: string, offset: string, from: string, to: string, orderby: string | undefined, orderasc: boolean | undefined, showAll: boolean | undefined): Promise<AlertExtended[]>;
protected processGetListByCriterias(response: Response): Promise<AlertExtended[]>;
/**
* Get Alert Statistics
* @param showAll (optional) Obtain all (false positive and close status included) Default:False
* @deprecated
*/
getListByCriteriasOverview(showAll: boolean | undefined): Promise<string>;
protected processGetListByCriteriasOverview(response: Response): Promise<string>;
/**
* Get Alert statistics
* @param hours (optional) Hours back to obtain data
* @param from (optional) From to obtain data
* @param type (optional) Type of result, may be 'raw', 'funnel, 'list'
* @param filterName (optional) filter by name context
* @param showAll (optional) Obtain all (false positive and close status included) Default:False
*/
getStatistics(hours: number | undefined, from: number | undefined, type: string | undefined, filterName: string | undefined, showAll: boolean | undefined): Promise<FunnelStatistics[]>;
protected processGetStatistics(response: Response): Promise<FunnelStatistics[]>;
/**
* Get Alert statuses
* @param from (optional) The date from in epoch time, with miliseconds. Default value 24 hours before petition
*/
listStatus(from: string | undefined): Promise<string>;
protected processListStatus(response: Response): Promise<string>;
/**
* Update Alert status
* @param id Alert ID
* @param status Alert status with this possible values:
UNREAD = 0;
UPDATED = 1;
FALSE POSTIVE = 2;
WATCHED = 100;
CLOSED = 300;
REMINDER = 500;
RECOVERY = 600;
ANTI FLOOD = 700;
*/
updateStatus(id: string, status: number): Promise<Alert>;
protected processUpdateStatus(response: Response): Promise<Alert>;
/**
* Update Alert status
* @param status Alert status with this possible values:
UNREAD = 0;
UPDATED = 1;
FALSE POSTIVE = 2;
WATCHED = 100;
CLOSED = 300;
REMINDER = 500;
RECOVERY = 600;
ANTI FLOOD = 700;
* @param body (optional)
*/
updateStatusLists(status: number, body: Blob | undefined): Promise<any>;
protected processUpdateStatusLists(response: Response): Promise<any>;
/**
* Get Alert definitions
* @param nameFilter (optional) Alert name to filter
* @param idFilter (optional) Alert id to filter
* @param body (optional)
*/
getAlerts(nameFilter: string | undefined, idFilter: string | undefined, pagination: Pageable | undefined): Promise<AlertDefinition[]>;
protected processGetAlerts(response: Response): Promise<AlertDefinition[]>;
/**
* Updated Alert definitions
* @param body (optional)
*/
putAlerts(body: AlertDefinition | undefined): Promise<AlertDefinition>;
protected processPutAlerts(response: Response): Promise<AlertDefinition>;
/**
* Create Alert definition
* @param body (optional)
*/
postAlerts(body: AlertDefinition | undefined): Promise<AlertDefinition>;
protected processPostAlerts(response: Response): Promise<AlertDefinition>;
/**
* Delete Alert definitions
* @param alertIds List of alert definitions IDs
* @return Deletion was successful
*/
deleteAlerts(alertIds: string[]): Promise<void>;
protected processDeleteAlerts(response: Response): Promise<void>;
/**
* Updates a batch of Alert definitions
* @param body (optional)
*/
putAlertsBatch(body: AlertDefinition[] | undefined): Promise<AlertDefinition[]>;
protected processPutAlertsBatch(response: Response): Promise<AlertDefinition[]>;
/**
* Create batch of Alert definitions
* @param body (optional)
*/
postAlertsBatch(body: AlertDefinition[] | undefined): Promise<AlertDefinition[]>;
protected processPostAlertsBatch(response: Response): Promise<AlertDefinition[]>;
/**
* Update Alert definition statuses
* @param alertIds List of alert definitions IDs
* @param enable Enable/disable alert definitions
*/
putAlertStatus(alertIds: string[], enable: boolean): Promise<AlertSubscriptionUpdate>;
protected processPutAlertStatus(response: Response): Promise<AlertSubscriptionUpdate>;
/**
* Assign Tag to Alert
* @param body Alert IDs and tags to be set to the alerts
*/
setTags(body: AlertTagsRequest): Promise<any>;
protected processSetTags(response: Response): Promise<any>;
}
export interface AlertCommentSecOps {
elementId?: string;
commentType?: AlertCommentSecOpsCommentType;
commentMsg?: string;
commentTitle?: string;
validContent?: boolean;
}
export interface AlertCommentSecOpsBulk {
elementIds?: string[];
commentMsg?: string;
commentTitle?: string;
commentType?: AlertCommentSecOpsBulkCommentType;
}
export interface AlertComments {
idAlert?: number;
comments?: Comment[];
}
export interface Comment {
id?: number;
author?: UserDomain;
msg?: string;
ack?: string;
creationDate?: Date;
updateDate?: Date;
elementType?: string;
elementId?: string;
domain?: Domain;
title?: string;
status?: string;
task?: boolean;
}
export interface Domain {
id?: string;
name?: string;
status?: number;
type?: number;
updateDate?: Date;
creationDate?: Date;
subscribed?: number;
daysLeft?: number;
showLanding?: boolean;
reseller?: Reseller;
groupId?: number;
alertsLastReseted?: Date;
}
export interface Reseller {
id?: number;
name?: string;
preferences?: string;
contactInformation?: string;
pricePlans?: string;
updateDate?: Date;
creationDate?: Date;
permPolicy?: string;
menuView?: string;
limits?: string;
groupId?: number;
webPreferences?: string;
}
export interface User {
id?: string;
email?: string;
username?: string;
telephone?: string;
pwd?: string;
status?: number;
validation_token?: string;
defaultDomain?: string;
updateDate?: Date;
creationDate?: Date;
otpSecret?: string;
loginAttempts?: number;
recoveryAttempts?: number;
}
export interface UserDomain {
id?: number;
user?: User;
domain?: Domain;
lastTimeLogged?: Date;
status?: number;
creationDate?: Date;
updateDate?: Date;
pwd?: string;
validationToken?: string;
roleCustom?: number;
rolesCustom?: number[];
externalId?: string;
owner?: boolean;
alertsLastVisited?: Date;
}
export interface AlertCommentSecOpsBulkUpdate {
idMap?: {
[key: string]: number[];
};
commentMsg?: string;
commentTitle?: string;
commentType?: AlertCommentSecOpsBulkUpdateCommentType;
}
export interface Alert {
id?: number;
domain?: string;
priority?: number;
context?: string;
category?: string;
srcPort?: number;
srcIp?: string;
srcHost?: string;
dstIp?: string;
dstPort?: number;
dstHost?: string;
protocol?: string;
username?: string;
application?: string;
engine?: string;
extraData?: string;
alertDate?: Date;
status?: number;
ack_status_date?: Date;
createDate?: Date;
updateDate?: Date;
scaled?: boolean;
digest?: string;
uniquedigest?: string;
contexto?: Context;
postAlertAction?: string;
contextLabel?: string;
contextSubscription?: number;
shouldSend?: boolean;
alertOwner?: string;
fullExtraData?: string;
alertLabel?: string;
}
export interface Category {
id?: number;
name?: string;
owner?: string;
subCategories?: SubCategory[];
}
export interface Context {
id?: number;
pilotContextId?: string;
name?: string;
category?: Category;
subCategory?: SubCategory;
application_id?: number;
defaultParams?: string;
includefields?: string;
excludefields?: string;
}
export interface SubCategory {
id?: number;
name?: string;
hasContext?: boolean;
alert_category_id?: number;
contextList?: Context[];
}
export interface AlertCorrelationContext {
id?: string;
nameId?: string;
ownerEmail?: string;
querySourceCode?: string;
priority?: number;
correlationTrigger?: CorrelationTrigger;
}
export interface AlertDefinition {
id?: string;
creationDate?: Date;
name?: string;
message?: string;
description?: string;
categoryId?: string;
subcategory?: string;
subcategoryId?: string;
isActive?: boolean;
isFavorite?: boolean;
isAlertChain?: boolean;
alertCorrelationContext?: AlertCorrelationContext;
actionPolicyId?: string[];
}
export interface AlertExtended {
id?: number;
domain?: string;
priority?: number;
context?: string;
category?: string;
srcPort?: number;
srcIp?: string;
srcHost?: string;
dstIp?: string;
dstPort?: number;
dstHost?: string;
protocol?: string;
username?: string;
application?: string;
engine?: string;
extraData?: string;
alertDate?: Date;
status?: number;
ack_status_date?: Date;
createDate?: Date;
updateDate?: Date;
scaled?: boolean;
digest?: string;
uniquedigest?: string;
contexto?: Context;
postAlertAction?: string;
contextLabel?: string;
contextSubscription?: number;
shouldSend?: boolean;
alertOwner?: string;
fullExtraData?: string;
alertType?: string;
alertMitreTactics?: string;
alertMitreTechniques?: string;
alertPriority?: string;
alertDefinition?: AlertDefinition;
allExtraDataFields?: {
[key: string]: string;
};
tags?: string[];
entities?: Entity[];
commentsList?: Comment[];
alertLabel?: string;
}
export interface CorrelationTrigger {
kind: string;
}
export interface CorrelationTriggerDeviation extends CorrelationTrigger {
threshold?: number;
absolute?: boolean;
aggregationColumn?: string[];
}
export interface CorrelationTriggerEach extends CorrelationTrigger {
externalPeriod?: number;
externalOffset?: number;
internalPeriod?: number;
internalOffset?: number;
}
export interface CorrelationTriggerGradient extends CorrelationTrigger {
threshold?: number;
absolute?: boolean;
aggregationColumn?: string[];
}
export interface CorrelationTriggerLow extends CorrelationTrigger {
period?: number;
threshold?: number;
}
export interface CorrelationTriggerRolling extends CorrelationTrigger {
period?: number;
backPeriod?: number;
}
export interface CorrelationTriggerSeveral extends CorrelationTrigger {
period?: number;
threshold?: number;
keys?: string[];
}
export interface Entity {
id?: string;
hostname?: string;
url?: string;
ip?: string;
mac?: string;
name?: string;
location?: EntityLocation;
email?: string;
windowsDomain?: string;
account?: string;
hash?: string;
impact?: string;
creationDate?: number;
modificationDate?: number;
json?: string;
domain?: string;
extraDataMaps?: {
[key: string]: string;
};
entityType?: EntityType;
entitySuperTypes?: EntitySuperTypes[];
entityFamily?: EntityFamily;
direction?: EntityDirection;
internalEntity?: boolean;
}
export interface EntityLocation {
locationCountry?: string;
locationCity?: string;
locationState?: string;
locationLat?: number;
locationLon?: number;
}
export interface FunnelStatistics {
total?: FunnelStatisticsValues;
types?: {
[key: string]: FunnelStatisticsValues;
};
}
export interface FunnelStatisticsValues {
total?: number;
enriched?: number;
}
export interface Pageable {
pageSize?: number;
pageNumber?: number;
sort?: Sort;
offset?: number;
}
export interface Sort {
}
export interface AlertSubscriptionUpdate {
correlationId?: string;
updated?: {
[key: string]: boolean;
};
}
export interface AlertTagsRequest {
alertIds?: string[];
tags?: string[];
}
export declare enum AlertCommentSecOpsCommentType {
ALERT = "ALERT",
REPLY = "REPLY"
}
export declare enum AlertCommentSecOpsBulkCommentType {
ALERT = "ALERT",
REPLY = "REPLY"
}
export declare enum AlertCommentSecOpsBulkUpdateCommentType {
ALERT = "ALERT",
REPLY = "REPLY"
}
export declare enum EntityType {
SOURCEIP = "SOURCEIP",
DSTIP = "DSTIP",
SOURCEDOMAIN = "SOURCEDOMAIN",
DSTDOMAIN = "DSTDOMAIN",
SOURCEHOST = "SOURCEHOST",
DSTHOST = "DSTHOST",
SOURCESYSTEMLOCATIONCOUNTRY = "SOURCESYSTEMLOCATIONCOUNTRY",
SOURCESYSTEMLOCATIONCITY = "SOURCESYSTEMLOCATIONCITY",
SOURCESYSTEMLOCATIONSTATE = "SOURCESYSTEMLOCATIONSTATE",
SOURCESYSTEMLOCATIONLAT = "SOURCESYSTEMLOCATIONLAT",
SOURCESYSTEMLOCATIONLON = "SOURCESYSTEMLOCATIONLON",
DSTLOCATION = "DSTLOCATION",
SOURCEUSER = "SOURCEUSER",
DSTUSER = "DSTUSER",
SOURCEUSERDOMAIN = "SOURCEUSERDOMAIN",
DSTUSERDOMAIN = "DSTUSERDOMAIN",
SOURCEUSERNAME = "SOURCEUSERNAME",
DSTUSERNAME = "DSTUSERNAME",
SOURCEURL = "SOURCEURL",
DSTURL = "DSTURL",
SOURCEMAC = "SOURCEMAC",
DSTMAC = "DSTMAC",
SOURCEEMAIL = "SOURCEEMAIL",
DSTEMAIL = "DSTEMAIL",
HASH = "HASH"
}
export declare enum EntitySuperTypes {
DOMAIN = "DOMAIN",
URL = "URL",
IP = "IP",
MAC = "MAC",
USER = "USER",
LOCATION = "LOCATION",
EMAIL = "EMAIL",
HASH = "HASH",
HOSTNAME = "HOSTNAME",
OTHER = "OTHER"
}
export declare enum EntityFamily {
SYSTEM = "SYSTEM",
USER = "USER",
OTHER = "OTHER"
}
export declare enum EntityDirection {
NONE = "NONE",
SOURCE = "SOURCE",
DESTINATION = "DESTINATION"
}
export declare class SwaggerException extends Error {
message: string;
status: number;
response: string;
headers: {
[key: string]: any;
};
result: any;
constructor(message: string, status: number, response: string, headers: {
[key: string]: any;
}, result: any);
protected isSwaggerException: boolean;
static isSwaggerException(obj: any): obj is SwaggerException;
}
export interface IConfig {
getAuthorization: () => string;
}