forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Security Solution] Refactor FirstLastSeenHost to use Search Strategy (…
- Loading branch information
1 parent
f539f5b
commit 09d1b8a
Showing
26 changed files
with
945 additions
and
379 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
x-pack/plugins/security_solution/common/search_strategy/security_solution/hosts/all/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { IEsSearchResponse } from '../../../../../../../../src/plugins/data/common'; | ||
|
||
import { HostItem } from '../common'; | ||
import { | ||
CursorType, | ||
Inspect, | ||
Maybe, | ||
PageInfoPaginated, | ||
RequestOptionsPaginated, | ||
SortField, | ||
} from '../..'; | ||
|
||
export interface HostsEdges { | ||
node: HostItem; | ||
|
||
cursor: CursorType; | ||
} | ||
|
||
export interface HostsStrategyResponse extends IEsSearchResponse { | ||
edges: HostsEdges[]; | ||
totalCount: number; | ||
pageInfo: PageInfoPaginated; | ||
inspect?: Maybe<Inspect>; | ||
} | ||
|
||
export interface HostsRequestOptions extends RequestOptionsPaginated { | ||
sort: SortField; | ||
defaultIndex: string[]; | ||
} |
95 changes: 95 additions & 0 deletions
95
.../plugins/security_solution/common/search_strategy/security_solution/hosts/common/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { CloudEcs } from '../../../../ecs/cloud'; | ||
import { HostEcs, OsEcs } from '../../../../ecs/host'; | ||
import { Maybe, SearchHit, TotalValue } from '../..'; | ||
|
||
export enum HostPolicyResponseActionStatus { | ||
success = 'success', | ||
failure = 'failure', | ||
warning = 'warning', | ||
} | ||
|
||
export interface EndpointFields { | ||
endpointPolicy?: Maybe<string>; | ||
sensorVersion?: Maybe<string>; | ||
policyStatus?: Maybe<HostPolicyResponseActionStatus>; | ||
} | ||
|
||
export interface HostItem { | ||
_id?: Maybe<string>; | ||
cloud?: Maybe<CloudEcs>; | ||
endpoint?: Maybe<EndpointFields>; | ||
host?: Maybe<HostEcs>; | ||
lastSeen?: Maybe<string>; | ||
} | ||
|
||
export interface HostValue { | ||
value: number; | ||
value_as_string: string; | ||
} | ||
|
||
export interface HostBucketItem { | ||
key: string; | ||
doc_count: number; | ||
timestamp: HostValue; | ||
} | ||
|
||
export interface HostBuckets { | ||
buckets: HostBucketItem[]; | ||
} | ||
|
||
export interface HostOsHitsItem { | ||
hits: { | ||
total: TotalValue | number; | ||
max_score: number | null; | ||
hits: Array<{ | ||
_source: { host: { os: Maybe<OsEcs> } }; | ||
sort?: [number]; | ||
_index?: string; | ||
_type?: string; | ||
_id?: string; | ||
_score?: number | null; | ||
}>; | ||
}; | ||
} | ||
|
||
export interface HostAggEsItem { | ||
cloud_instance_id?: HostBuckets; | ||
cloud_machine_type?: HostBuckets; | ||
cloud_provider?: HostBuckets; | ||
cloud_region?: HostBuckets; | ||
firstSeen?: HostValue; | ||
host_architecture?: HostBuckets; | ||
host_id?: HostBuckets; | ||
host_ip?: HostBuckets; | ||
host_mac?: HostBuckets; | ||
host_name?: HostBuckets; | ||
host_os_name?: HostBuckets; | ||
host_os_version?: HostBuckets; | ||
host_type?: HostBuckets; | ||
key?: string; | ||
lastSeen?: HostValue; | ||
os?: HostOsHitsItem; | ||
} | ||
|
||
export interface HostEsData extends SearchHit { | ||
sort: string[]; | ||
aggregations: { | ||
host_count: { | ||
value: number; | ||
}; | ||
host_data: { | ||
buckets: HostAggEsItem[]; | ||
}; | ||
}; | ||
} | ||
|
||
export interface HostAggEsData extends SearchHit { | ||
sort: string[]; | ||
aggregations: HostAggEsItem; | ||
} |
17 changes: 17 additions & 0 deletions
17
...security_solution/common/search_strategy/security_solution/hosts/first_last_seen/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { IEsSearchResponse } from '../../../../../../../../src/plugins/data/common'; | ||
import { Inspect, Maybe, RequestOptionsPaginated } from '../..'; | ||
|
||
export interface HostFirstLastSeenRequestOptions extends Partial<RequestOptionsPaginated> { | ||
hostName: string; | ||
} | ||
export interface HostFirstLastSeenStrategyResponse extends IEsSearchResponse { | ||
inspect?: Maybe<Inspect>; | ||
firstSeen?: Maybe<string>; | ||
lastSeen?: Maybe<string>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
...lugins/security_solution/common/search_strategy/security_solution/hosts/overview/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { IEsSearchResponse } from '../../../../../../../../src/plugins/data/common'; | ||
|
||
import { HostItem } from '../common'; | ||
import { Inspect, Maybe, RequestOptionsPaginated, TimerangeInput } from '../..'; | ||
|
||
export interface HostOverviewStrategyResponse extends IEsSearchResponse { | ||
hostOverview: HostItem; | ||
inspect?: Maybe<Inspect>; | ||
} | ||
|
||
export interface HostOverviewRequestOptions extends Partial<RequestOptionsPaginated> { | ||
hostName: string; | ||
skip?: boolean; | ||
timerange: TimerangeInput; | ||
inspect?: Maybe<Inspect>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.