Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.18] [MDS] Use datasource id when getting client for threat alerts #1220

Open
wants to merge 1 commit into
base: 2.18
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading