forked from opensearch-project/notifications
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterfaces.ts
More file actions
130 lines (120 loc) · 3.17 KB
/
Copy pathinterfaces.ts
File metadata and controls
130 lines (120 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/
/*
* Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
import { Direction } from '@elastic/eui';
import {
CHANNEL_TYPE,
ENCRYPTION_TYPE,
NOTIFICATION_SOURCE,
SEVERITY_TYPE,
} from '../public/utils/constants';
export interface NotificationItem {
event_id: string;
created_time_ms: number;
last_updated_time_ms: number;
tenant?: string;
event_source: {
title: string;
reference_id: string;
feature: keyof typeof NOTIFICATION_SOURCE;
severity: keyof typeof SEVERITY_TYPE;
tags?: string[];
};
status_list: ChannelStatus[]; // could be multiple channels in a notification item
success: boolean; // calculated in the frontend based on status_list
}
export interface ChannelStatus {
config_id: string;
config_name: string;
config_type: keyof typeof CHANNEL_TYPE;
email_recipient_status?: {
recipient: string;
delivery_status: DeliveryStatus;
}[];
delivery_status: DeliveryStatus;
}
interface DeliveryStatus {
status_code: string;
status_text: string;
}
export interface ChannelItemType extends ConfigType {
config_type: keyof typeof CHANNEL_TYPE;
feature_list: Array<keyof typeof NOTIFICATION_SOURCE>;
is_enabled: boolean; // active or muted
slack?: {
url: string;
};
chime?: {
url: string;
};
webhook?: {
url: string;
header_params: object;
};
email?: {
email_account_id: string;
recipient_list: string[]; // custom email addresses
email_group_id_list: string[];
// optional fields for displaying or editing email channel, needs more requests
email_account_name?: string;
email_group_id_map?: {
[id: string]: string;
};
};
sns?: {
topic_arn: string;
role_arn?: string;
}
}
interface ConfigType {
config_id: string;
name: string;
description?: string;
created_time_ms: number;
last_updated_time_ms: number;
}
export interface SenderItemType extends ConfigType {
smtp_account: {
from_address: string; // outbound email address
host: string;
port: string;
method: keyof typeof ENCRYPTION_TYPE;
};
}
export interface RecipientGroupItemType extends ConfigType {
email_group: {
recipient_list: string[];
};
}
export interface TableState<T> {
total: number;
from: number;
size: number;
search: string;
sortField: any; // keyof T
sortDirection: Direction;
selectedItems: T[];
items: T[];
loading: boolean;
}