Skip to content

Commit

Permalink
use datasource id when getting client for threat alerts
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <[email protected]>
  • Loading branch information
amsiglan committed Oct 31, 2024
1 parent ad76b7b commit 1e0b9df
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions server/services/AlertService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,15 @@ export default class AlertService extends MDSEnabledClientService {
response: OpenSearchDashboardsResponseFactory
): Promise<IOpenSearchDashboardsResponse<ServerResponse<any> | ResponseError>> => {
try {
const params: any = request.query;
// Delete the dataSourceId since this query param is not supported by the alerts API
delete params['dataSourceId'];
const { sortOrder, size, startIndex, startTime, endTime } = request.query;

const params: any = {
sortOrder,
size,
startIndex,
startTime,
endTime,
};
const client = this.getClient(request, context);
const getAlertsResponse: GetAlertsResponse = await client(
CLIENT_THREAT_INTEL_METHODS.GET_THREAT_INTEL_ALERTS,
Expand Down Expand Up @@ -167,11 +172,10 @@ export default class AlertService extends MDSEnabledClientService {
response: OpenSearchDashboardsResponseFactory
): Promise<IOpenSearchDashboardsResponse<ServerResponse<any> | ResponseError>> => {
try {
const params: any = request.query;
// Delete the dataSourceId since this query param is not supported by the alerts API
delete params['dataSourceId'];

const { state, alert_ids } = request.query;
const params: any = { state, alert_ids };
const client = this.getClient(request, context);

const updateStatusResponse: GetAlertsResponse = await client(
CLIENT_THREAT_INTEL_METHODS.UPDATE_THREAT_INTEL_ALERTS_STATE,
params
Expand Down

0 comments on commit 1e0b9df

Please sign in to comment.