Skip to content

Commit 571d3a2

Browse files
juandagrJuan Galarza
andauthored
ENG-56100 - adding force_refresh param to the retinaSearch call v1 (#833)
Co-authored-by: Juan Galarza <[email protected]>
1 parent 5f50dbd commit 571d3a2

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

packages/iris/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@al/iris",
3-
"version": "2.0.86",
3+
"version": "2.0.87",
44
"license": "MIT",
55
"description": "A client for interacting with the Alert Logic Iris Public API",
66
"author": {

packages/iris/src/al-iris-client.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ export class AlIrisClientInstance {
679679
});
680680
}
681681

682-
public retinaSearch(accountId: string, incidentId: string, data: any): Promise<any> {
682+
public retinaSearch(accountId: string, incidentId: string, data: any, queryParams?: { force_refresh?: boolean }): Promise<any> {
683683
return this.client.post(
684684
{
685685
service_stack: AlLocation.InsightAPI,
@@ -688,6 +688,7 @@ export class AlIrisClientInstance {
688688
account_id: accountId,
689689
path: `retinaSearch/${incidentId}`,
690690
data: data,
691+
params: queryParams
691692
});
692693
}
693694

@@ -764,6 +765,7 @@ export class AlIrisClientInstance {
764765
elaborationsExcluded: string[],
765766
updateElaboration: boolean = false,
766767
isTestIncident: boolean = false,
768+
forceRefresh: boolean = false,
767769
): Promise<Elaboration[]> {
768770

769771
const data = this.getElaborationFilter(
@@ -775,7 +777,10 @@ export class AlIrisClientInstance {
775777
'all',
776778
updateElaboration,
777779
);
778-
const response = isTestIncident ? this.testRetinaSearch(accountId, incidentId, data) : this.retinaSearch(accountId, incidentId, data);
780+
const params = forceRefresh ? {
781+
force_refresh: forceRefresh
782+
} : {};
783+
const response = isTestIncident ? this.testRetinaSearch(accountId, incidentId, data) : this.retinaSearch(accountId, incidentId, data, params);
779784
return response.then((response) => {
780785
return Elaboration.deserializeArray(response.returnVals || []);
781786
});
@@ -810,6 +815,7 @@ export class AlIrisClientInstance {
810815
parameters: EvidenceParams,
811816
elaborationsIncluded: string[],
812817
isTestIncident: boolean = false,
818+
forceRefresh: boolean = false
813819
): Promise<Elaboration[]> {
814820

815821
// check if the there's not elaborationsIncluded so we don't need make the call
@@ -826,7 +832,10 @@ export class AlIrisClientInstance {
826832
false,
827833
true,
828834
);
829-
const response = isTestIncident ? this.testRetinaSearch(accountId, incidentId, data) : this.retinaSearch(accountId, incidentId, data);
835+
const params = forceRefresh ? {
836+
force_refresh: forceRefresh
837+
} : {};
838+
const response = isTestIncident ? this.testRetinaSearch(accountId, incidentId, data) : this.retinaSearch(accountId, incidentId, data, params);
830839
return response.then((response) => {
831840
if (parameters.sourcesFilter !== null && parameters.sourcesFilter.indexOf(EvidenceType.Flagged) === -1) {
832841
return [];
@@ -849,9 +858,13 @@ export class AlIrisClientInstance {
849858
incidentId: string,
850859
elaborationsIncluded: string[],
851860
isTestIncident: boolean = false,
861+
forceRefresh: boolean = false,
852862
): Promise<{ aggregation?: { [i: string]: { [j: string]: number } } }> {
863+
const params = forceRefresh ? {
864+
force_refresh: forceRefresh
865+
} : {};
853866
const data = this.getElaborationAggregationFilter(elaborationsIncluded, null);
854-
return isTestIncident ? this.testRetinaSearch(accountId, incidentId, data) : this.retinaSearch(accountId, incidentId, data);
867+
return isTestIncident ? this.testRetinaSearch(accountId, incidentId, data) : this.retinaSearch(accountId, incidentId, data, params);
855868
}
856869

857870
/**
@@ -866,9 +879,13 @@ export class AlIrisClientInstance {
866879
incidentId: string,
867880
elaborationsExcluded: string[],
868881
isTestIncident: boolean = false,
882+
forceRefresh: boolean = false,
869883
): Promise<{ aggregation?: { [i: string]: { [j: string]: number } } }> {
870884
const data: RetinaBody = this.getElaborationAggregationFilter(null, elaborationsExcluded);
871-
return isTestIncident ? this.testRetinaSearch(accountId, incidentId, data) : this.retinaSearch(accountId, incidentId, data);
885+
const params = forceRefresh ? {
886+
force_refresh: forceRefresh
887+
} : {};
888+
return isTestIncident ? this.testRetinaSearch(accountId, incidentId, data) : this.retinaSearch(accountId, incidentId, data, params);
872889
}
873890

874891
/**

0 commit comments

Comments
 (0)