Skip to content

Commit

Permalink
use datasource id when getting client for threat alerts (#1218) (#1221)
Browse files Browse the repository at this point in the history
(cherry picked from commit c20363b)

Signed-off-by: Amardeepsingh Siglani <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 28d0679 commit a05525d
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 a05525d

Please sign in to comment.