Skip to content

Commit

Permalink
Makes arguments optional to reduce touch points in exisiting code
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankHassanabad committed Feb 10, 2022
1 parent df989b5 commit 6468a6c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import type {
SavedObjectsClientContract,
SavedObjectsClosePointInTimeResponse,
} from 'kibana/server';
import type { Pit } from '@kbn/securitysolution-io-ts-list-types';
import type { PitId } from '@kbn/securitysolution-io-ts-list-types';

interface ClosePointInTimeOptions {
pit: Pit['id'];
pit: PitId;
savedObjectsClient: SavedObjectsClientContract;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import type {
OsTypeArray,
PageOrUndefined,
PerPageOrUndefined,
Pit,
PitId,
PitOrUndefined,
SearchAfterOrUndefined,
SortFieldOrUndefined,
Expand Down Expand Up @@ -201,8 +201,8 @@ export interface FindExceptionListItemOptions {
namespaceType: NamespaceType;
filter: FilterOrUndefined;
perPage: PerPageOrUndefined;
pit: PitOrUndefined;
searchAfter: SearchAfterOrUndefined;
pit?: PitOrUndefined;
searchAfter?: SearchAfterOrUndefined;
page: PageOrUndefined;
sortField: SortFieldOrUndefined;
sortOrder: SortOrderOrUndefined;
Expand All @@ -211,8 +211,8 @@ export interface FindExceptionListItemOptions {
export interface FindEndpointListItemOptions {
filter: FilterOrUndefined;
perPage: PerPageOrUndefined;
pit: PitOrUndefined;
searchAfter: SearchAfterOrUndefined;
pit?: PitOrUndefined;
searchAfter?: SearchAfterOrUndefined;
page: PageOrUndefined;
sortField: SortFieldOrUndefined;
sortOrder: SortOrderOrUndefined;
Expand All @@ -223,8 +223,8 @@ export interface FindExceptionListsItemOptions {
namespaceType: NamespaceTypeArray;
filter: EmptyStringArrayDecoded;
perPage: PerPageOrUndefined;
pit: PitOrUndefined;
searchAfter: SearchAfterOrUndefined;
pit?: PitOrUndefined;
searchAfter?: SearchAfterOrUndefined;
page: PageOrUndefined;
sortField: SortFieldOrUndefined;
sortOrder: SortOrderOrUndefined;
Expand All @@ -233,8 +233,8 @@ export interface FindExceptionListsItemOptions {
export interface FindValueListExceptionListsItems {
valueListId: Id;
perPage: PerPageOrUndefined;
pit: PitOrUndefined;
searchAfter: SearchAfterOrUndefined;
pit?: PitOrUndefined;
searchAfter?: SearchAfterOrUndefined;
page: PageOrUndefined;
sortField: SortFieldOrUndefined;
sortOrder: SortOrderOrUndefined;
Expand All @@ -245,8 +245,8 @@ export interface FindExceptionListOptions {
filter: FilterOrUndefined;
perPage: PerPageOrUndefined;
page: PageOrUndefined;
pit: PitOrUndefined;
searchAfter: SearchAfterOrUndefined;
pit?: PitOrUndefined;
searchAfter?: SearchAfterOrUndefined;
sortField: SortFieldOrUndefined;
sortOrder: SortOrderOrUndefined;
}
Expand Down Expand Up @@ -280,5 +280,5 @@ export interface OpenPointInTimeOptions {
}

export interface ClosePointInTimeOptions {
pit: Pit['id'];
pit: PitId;
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ export async function getFilteredEndpointExceptionList(
listId,
namespaceType: 'agnostic',
filter,
pit: undefined,
searchAfter: undefined,
perPage: 100,
page,
sortField: 'created_at',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ export const removePolicyFromArtifacts = async (
namespaceType: ARTIFACT_LISTS_IDS_TO_REMOVE.map(() => 'agnostic'),
page: currentPage,
perPage: 50,
pit: undefined,
searchAfter: undefined,
sortField: undefined,
sortOrder: undefined,
});
Expand Down
15 changes: 0 additions & 15 deletions x-pack/plugins/security_solution/server/lib/telemetry/receiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,16 +319,11 @@ export class TelemetryReceiver implements ITelemetryReceiver {
// Ensure list is created if it does not exist
await this.exceptionListClient.createTrustedAppsList();

// TODO: Will need to address this when we switch over to
// using PIT, don't want it to get lost
// https://github.com/elastic/kibana/issues/103944
const results = await this.exceptionListClient.findExceptionListItem({
listId: ENDPOINT_TRUSTED_APPS_LIST_ID,
page: 1,
perPage: 10_000,
filter: undefined,
pit: undefined,
searchAfter: undefined,
namespaceType: 'agnostic',
sortField: 'name',
sortOrder: 'asc',
Expand All @@ -350,16 +345,11 @@ export class TelemetryReceiver implements ITelemetryReceiver {
// Ensure list is created if it does not exist
await this.exceptionListClient.createEndpointList();

// TODO: Will need to address this when we switch over to
// using PIT, don't want it to get lost
// https://github.com/elastic/kibana/issues/103944
const results = await this.exceptionListClient.findExceptionListItem({
listId,
page: 1,
perPage: this.max_records,
filter: undefined,
pit: undefined,
searchAfter: undefined,
namespaceType: 'agnostic',
sortField: 'name',
sortOrder: 'asc',
Expand Down Expand Up @@ -433,16 +423,11 @@ export class TelemetryReceiver implements ITelemetryReceiver {
// Ensure list is created if it does not exist
await this.exceptionListClient.createTrustedAppsList();

// TODO: Will need to address this when we switch over to
// using PIT, don't want it to get lost
// https://github.com/elastic/kibana/issues/103944
const results = await this.exceptionListClient?.findExceptionListsItem({
listId: [listId],
filter: [],
perPage: this.max_records,
pit: undefined,
page: 1,
searchAfter: undefined,
sortField: 'exception-list.created_at',
sortOrder: 'desc',
namespaceType: ['single'],
Expand Down

0 comments on commit 6468a6c

Please sign in to comment.