-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
consolidated most shared types at top level (opensearch-project#347) (o…
…pensearch-project#362) Signed-off-by: Amardeepsingh Siglani <[email protected]> Signed-off-by: Amardeepsingh Siglani <[email protected]> (cherry picked from commit dae16fa) Co-authored-by: Amardeepsingh Siglani <[email protected]> Signed-off-by: AWSHurneyt <[email protected]>
- Loading branch information
1 parent
ab08351
commit adc1a4c
Showing
29 changed files
with
785 additions
and
88 deletions.
There are no files selected for viewing
22 changes: 0 additions & 22 deletions
22
public/pages/Categories/containers/Categories/Categories.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export interface AlertCondition { | ||
// Trigger fields | ||
name: string; | ||
id?: string; | ||
|
||
// Detector types | ||
types: string[]; | ||
|
||
// Trigger fields based on Rules | ||
sev_levels: string[]; | ||
tags: string[]; | ||
ids: string[]; | ||
|
||
// Alert related fields | ||
actions: TriggerAction[]; | ||
severity: string; | ||
} | ||
|
||
export interface TriggerAction { | ||
id: string; | ||
// Id of notification channel | ||
destination_id: string; | ||
subject_template: { | ||
source: string; | ||
lang: string; | ||
}; | ||
name: string; | ||
throttle_enabled: boolean; | ||
message_template: { | ||
source: string; | ||
lang: string; | ||
}; | ||
throttle: { | ||
unit: string; | ||
value: number; | ||
}; | ||
} | ||
|
||
/** | ||
* API interfaces | ||
*/ | ||
|
||
export type GetAlertsParams = | ||
| { | ||
detector_id: string; | ||
detectorType?: string; | ||
} | ||
| { | ||
detectorType: string; | ||
detector_id?: string; | ||
}; | ||
|
||
export interface GetAlertsResponse { | ||
alerts: AlertResponse[]; | ||
} | ||
|
||
export interface AlertItem { | ||
id: string; | ||
start_time: string; | ||
trigger_name: string; | ||
detector_id: string; | ||
state: string; | ||
severity: string; | ||
finding_ids: string[]; | ||
last_notification_time: string; | ||
acknowledged_time: string | null; | ||
} | ||
|
||
export interface AlertResponse extends AlertItem { | ||
version: number; | ||
schema_version: number; | ||
trigger_id: string; | ||
related_doc_ids: string[]; | ||
error_message: string | null; | ||
alert_history: string[]; | ||
action_execution_results: { | ||
action_id: string; | ||
last_execution_time: number; | ||
throttled_count: number; | ||
}[]; | ||
end_time: string | null; | ||
} | ||
|
||
export interface AcknowledgeAlertsParams { | ||
body: { alerts: string[] }; | ||
detector_id: string; | ||
} | ||
|
||
export interface AcknowledgeAlertsResponse {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { AlertCondition } from './Alert'; | ||
import { DetectorRuleInfo } from './Rule'; | ||
|
||
export interface DetectorInput { | ||
detector_input: { | ||
description: string; | ||
indices: string[]; | ||
pre_packaged_rules: DetectorRuleInfo[]; | ||
custom_rules: DetectorRuleInfo[]; | ||
}; | ||
} | ||
|
||
export interface DetectorSchedule { | ||
period: { | ||
interval: number; | ||
unit: string; | ||
}; | ||
} | ||
|
||
export interface Detector { | ||
id?: string; | ||
type: 'detector'; | ||
detector_type: string; | ||
name: string; | ||
enabled: boolean; | ||
createdBy: string; | ||
schedule: DetectorSchedule; | ||
inputs: DetectorInput[]; | ||
triggers: AlertCondition[]; | ||
} | ||
|
||
export interface AlertConditionRuleOption { | ||
name: string; | ||
id: string; | ||
severity: string; | ||
tags: string[]; | ||
} | ||
|
||
export interface RulesSharedState { | ||
page: RulesPage; | ||
rulesOptions: AlertConditionRuleOption[]; | ||
} | ||
|
||
export interface RulesPage { | ||
index: number; | ||
} | ||
|
||
export interface SourceIndexOption { | ||
label: string; | ||
} | ||
|
||
export interface DetectorTypeOption { | ||
id: string; | ||
label: string; | ||
} | ||
|
||
export enum DetectorCreationStep { | ||
DEFINE_DETECTOR = 1, | ||
CONFIGURE_FIELD_MAPPING = 2, | ||
CONFIGURE_ALERTS = 3, | ||
REVIEW_CREATE = 4, | ||
} | ||
|
||
export interface DetectorHit { | ||
_index: string; | ||
_source: DetectorResponse; | ||
_id: string; | ||
} | ||
|
||
/** | ||
* API Interfaces | ||
*/ | ||
|
||
export type DetectorResponse = Detector & { | ||
last_update_time: number; | ||
enabled_time: number; | ||
}; | ||
|
||
export interface CreateDetectorParams { | ||
body: Detector; | ||
} | ||
|
||
export interface CreateDetectorResponse { | ||
_id: string; | ||
_version: number; | ||
detector: DetectorResponse; | ||
} | ||
|
||
export interface GetDetectorParams { | ||
detectorId: string; | ||
} | ||
|
||
export interface GetDetectorResponse {} | ||
|
||
export interface SearchDetectorsParams { | ||
body: { | ||
size: number; | ||
query: object; | ||
}; | ||
} | ||
|
||
export interface SearchDetectorsResponse { | ||
hits: { | ||
total: { value: number }; | ||
hits: DetectorHit[]; | ||
}; | ||
} | ||
|
||
export interface UpdateDetectorParams { | ||
detectorId: string; | ||
body: Detector; | ||
} | ||
|
||
export interface UpdateDetectorResponse { | ||
_id: string; | ||
_version: number; | ||
detector: { | ||
detector: Detector & { | ||
last_update_time: number; | ||
monitor_id: string; | ||
rule_topic_index: string; | ||
}; | ||
}; | ||
} | ||
|
||
export interface DeleteDetectorParams { | ||
detectorId: string; | ||
} | ||
|
||
export interface DeleteDetectorResponse {} |
Oops, something went wrong.