@daocloud-proto/insight 0.16.5 → 0.17.0-rc1

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.
@@ -218,6 +218,33 @@ export type AlertSummary = {
218
218
  lastSent?: string
219
219
  }
220
220
 
221
+ export type GetAlertRequest = {
222
+ id?: string
223
+ resolved?: boolean
224
+ }
225
+
226
+ export type Alert = {
227
+ id?: string
228
+ groupName?: string
229
+ groupId?: string
230
+ ruleName?: string
231
+ ruleId?: string
232
+ clusterName?: string
233
+ namespace?: string
234
+ targetType?: InsightIoApiAlertV1alpha1Type.TargetType
235
+ target?: string
236
+ severity?: InsightIoApiAlertV1alpha1Type.Severity
237
+ value?: string
238
+ notifyResponse?: string
239
+ description?: string
240
+ promQL?: string
241
+ labels?: {[key: string]: string}
242
+ annotations?: {[key: string]: string}
243
+ startAt?: string
244
+ updateAt?: string
245
+ lastSent?: string
246
+ }
247
+
221
248
  export type CountAlertRequest = {
222
249
  resolved?: boolean
223
250
  clusterName?: string
@@ -21,6 +21,14 @@ export enum ReceiverType {
21
21
  email = "email",
22
22
  dingtalk = "dingtalk",
23
23
  wecom = "wecom",
24
+ sms = "sms",
25
+ }
26
+
27
+ export enum ProviderType {
28
+ PROVIDER_TYPE_UNSPECIFIED = "PROVIDER_TYPE_UNSPECIFIED",
29
+ aliyun = "aliyun",
30
+ tencent = "tencent",
31
+ custom = "custom",
24
32
  }
25
33
 
26
34
 
@@ -32,7 +40,7 @@ type BaseReceiver = {
32
40
  }
33
41
 
34
42
  export type Receiver = BaseReceiver
35
- & OneOf<{ webhook: WebhookConfig; email: EmailConfig; wecom: WecomConfig; dingtalk: DingtalkConfig }>
43
+ & OneOf<{ webhook: WebhookConfig; email: EmailConfig; wecom: WecomConfig; dingtalk: DingtalkConfig; sms: SmsConfig }>
36
44
 
37
45
  export type WebhookConfig = {
38
46
  url?: string
@@ -51,6 +59,16 @@ export type EmailConfig = {
51
59
  to?: string[]
52
60
  }
53
61
 
62
+ export type SmsConfig = {
63
+ contact?: SmsConfigContact[]
64
+ provider?: string
65
+ }
66
+
67
+ export type SmsConfigContact = {
68
+ name?: string
69
+ phone?: string
70
+ }
71
+
54
72
  export type ListReceiversRequest = {
55
73
  name?: string
56
74
  type?: ReceiverType
@@ -133,8 +151,68 @@ export type CreateTemplateRequest = {
133
151
  }
134
152
 
135
153
  export type TemplateBody = {
136
- email?: string
154
+ email?: emailBody
137
155
  wecom?: string
138
156
  dingtalk?: string
139
157
  webhook?: string
158
+ }
159
+
160
+ export type emailBody = {
161
+ subject?: string
162
+ body?: string
163
+ }
164
+
165
+ export type ProviderAliyunConfig = {
166
+ signName?: string
167
+ templateCode?: string
168
+ accessKeyId?: string
169
+ accessKeySecret?: string
170
+ }
171
+
172
+ export type ProviderTencentConfig = {
173
+ templateId?: string
174
+ smsSdkAppId?: string
175
+ sign?: string
176
+ secretId?: string
177
+ secretKey?: string
178
+ }
179
+
180
+ export type ProviderCustomConfig = {
181
+ }
182
+
183
+
184
+ type BaseProvider = {
185
+ name?: string
186
+ type?: ProviderType
187
+ template?: string
188
+ createAt?: string
189
+ updateAt?: string
190
+ }
191
+
192
+ export type Provider = BaseProvider
193
+ & OneOf<{ aliyun: ProviderAliyunConfig; tencent: ProviderTencentConfig; custom: ProviderCustomConfig }>
194
+
195
+ export type ListProvidersRequest = {
196
+ name?: string
197
+ page?: number
198
+ pageSize?: number
199
+ sorts?: string[]
200
+ exactSearch?: boolean
201
+ }
202
+
203
+ export type ListProvidersResponse = {
204
+ items?: Provider[]
205
+ pagination?: InsightIoApiTypeV1alpha1Page.Pagination
206
+ }
207
+
208
+ export type GetProvidersRequest = {
209
+ name?: string
210
+ }
211
+
212
+ export type DeleteProvidersRequest = {
213
+ name?: string
214
+ }
215
+
216
+ export type ProviderDataResponse = {
217
+ data?: Provider
140
218
  }
@@ -134,6 +134,9 @@ export class Alert {
134
134
  static ListAlerts(req: InsightIoApiAlertV1alpha1Alert.ListAlertsRequest, initReq?: fm.InitReq): Promise<InsightIoApiAlertV1alpha1Alert.ListAlertsResponse> {
135
135
  return fm.fetchReq<InsightIoApiAlertV1alpha1Alert.ListAlertsRequest, InsightIoApiAlertV1alpha1Alert.ListAlertsResponse>(`/apis/insight.io/v1alpha1/alert/alerts?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
136
136
  }
137
+ static GetAlert(req: InsightIoApiAlertV1alpha1Alert.GetAlertRequest, initReq?: fm.InitReq): Promise<InsightIoApiAlertV1alpha1Alert.Alert> {
138
+ return fm.fetchReq<InsightIoApiAlertV1alpha1Alert.GetAlertRequest, InsightIoApiAlertV1alpha1Alert.Alert>(`/apis/insight.io/v1alpha1/alert/alerts/${req["id"]}?${fm.renderURLSearchParams(req, ["id"])}`, {...initReq, method: "GET"})
139
+ }
137
140
  static CountAlert(req: InsightIoApiAlertV1alpha1Alert.CountAlertRequest, initReq?: fm.InitReq): Promise<InsightIoApiAlertV1alpha1Alert.CountAlertResponse> {
138
141
  return fm.fetchReq<InsightIoApiAlertV1alpha1Alert.CountAlertRequest, InsightIoApiAlertV1alpha1Alert.CountAlertResponse>(`/apis/insight.io/v1alpha1/alert/alertcount?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
139
142
  }
@@ -167,6 +170,21 @@ export class Alert {
167
170
  static DeleteReceiver(req: InsightIoApiAlertV1alpha1Notify.DeleteReceiversRequest, initReq?: fm.InitReq): Promise<InsightIoApiAlertV1alpha1Notify.ReceiverDataResponse> {
168
171
  return fm.fetchReq<InsightIoApiAlertV1alpha1Notify.DeleteReceiversRequest, InsightIoApiAlertV1alpha1Notify.ReceiverDataResponse>(`/apis/insight.io/v1alpha1/alert/receivers/${req["name"]}`, {...initReq, method: "DELETE"})
169
172
  }
173
+ static ListProviders(req: InsightIoApiAlertV1alpha1Notify.ListProvidersRequest, initReq?: fm.InitReq): Promise<InsightIoApiAlertV1alpha1Notify.ListProvidersResponse> {
174
+ return fm.fetchReq<InsightIoApiAlertV1alpha1Notify.ListProvidersRequest, InsightIoApiAlertV1alpha1Notify.ListProvidersResponse>(`/apis/insight.io/v1alpha1/alert/providers?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
175
+ }
176
+ static GetProvider(req: InsightIoApiAlertV1alpha1Notify.GetProvidersRequest, initReq?: fm.InitReq): Promise<InsightIoApiAlertV1alpha1Notify.ProviderDataResponse> {
177
+ return fm.fetchReq<InsightIoApiAlertV1alpha1Notify.GetProvidersRequest, InsightIoApiAlertV1alpha1Notify.ProviderDataResponse>(`/apis/insight.io/v1alpha1/alert/providers/${req["name"]}?${fm.renderURLSearchParams(req, ["name"])}`, {...initReq, method: "GET"})
178
+ }
179
+ static CreateProvider(req: InsightIoApiAlertV1alpha1Notify.Provider, initReq?: fm.InitReq): Promise<InsightIoApiAlertV1alpha1Notify.ProviderDataResponse> {
180
+ return fm.fetchReq<InsightIoApiAlertV1alpha1Notify.Provider, InsightIoApiAlertV1alpha1Notify.ProviderDataResponse>(`/apis/insight.io/v1alpha1/alert/providers`, {...initReq, method: "POST", body: JSON.stringify(req)})
181
+ }
182
+ static UpdateProvider(req: InsightIoApiAlertV1alpha1Notify.Provider, initReq?: fm.InitReq): Promise<InsightIoApiAlertV1alpha1Notify.ProviderDataResponse> {
183
+ return fm.fetchReq<InsightIoApiAlertV1alpha1Notify.Provider, InsightIoApiAlertV1alpha1Notify.ProviderDataResponse>(`/apis/insight.io/v1alpha1/alert/providers/${req["name"]}`, {...initReq, method: "PUT", body: JSON.stringify(req)})
184
+ }
185
+ static DeleteProvider(req: InsightIoApiAlertV1alpha1Notify.DeleteProvidersRequest, initReq?: fm.InitReq): Promise<InsightIoApiAlertV1alpha1Notify.ProviderDataResponse> {
186
+ return fm.fetchReq<InsightIoApiAlertV1alpha1Notify.DeleteProvidersRequest, InsightIoApiAlertV1alpha1Notify.ProviderDataResponse>(`/apis/insight.io/v1alpha1/alert/providers/${req["name"]}`, {...initReq, method: "DELETE"})
187
+ }
170
188
  static ListTemplates(req: InsightIoApiAlertV1alpha1Notify.ListTemplatesRequest, initReq?: fm.InitReq): Promise<InsightIoApiAlertV1alpha1Notify.ListTemplatesResponse> {
171
189
  return fm.fetchReq<InsightIoApiAlertV1alpha1Notify.ListTemplatesRequest, InsightIoApiAlertV1alpha1Notify.ListTemplatesResponse>(`/apis/insight.io/v1alpha1/alert/templates?${fm.renderURLSearchParams(req, [])}`, {...initReq, method: "GET"})
172
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name":"@daocloud-proto/insight",
3
- "version":"0.16.5",
3
+ "version":"0.17.0-rc1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {