Skip to content

Commit febeb47

Browse files
[Security Solution] Refactor Network HTTP to use Search Strategy (#76243)
1 parent 6686cff commit febeb47

File tree

11 files changed

+532
-201
lines changed

11 files changed

+532
-201
lines changed

x-pack/plugins/security_solution/common/search_strategy/security_solution/index.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ import {
1515
HostsRequestOptions,
1616
HostsStrategyResponse,
1717
} from './hosts';
18-
import { NetworkQueries, NetworkTlsStrategyResponse, NetworkTlsRequestOptions } from './network';
18+
import {
19+
NetworkQueries,
20+
NetworkTlsStrategyResponse,
21+
NetworkTlsRequestOptions,
22+
NetworkHttpStrategyResponse,
23+
NetworkHttpRequestOptions,
24+
} from './network';
1925

2026
export * from './hosts';
2127
export * from './network';
@@ -116,6 +122,8 @@ export type StrategyResponseType<T extends FactoryQueryTypes> = T extends HostsQ
116122
? HostFirstLastSeenStrategyResponse
117123
: T extends NetworkQueries.tls
118124
? NetworkTlsStrategyResponse
125+
: T extends NetworkQueries.http
126+
? NetworkHttpStrategyResponse
119127
: never;
120128

121129
export type StrategyRequestType<T extends FactoryQueryTypes> = T extends HostsQueries.hosts
@@ -126,4 +134,11 @@ export type StrategyRequestType<T extends FactoryQueryTypes> = T extends HostsQu
126134
? HostFirstLastSeenRequestOptions
127135
: T extends NetworkQueries.tls
128136
? NetworkTlsRequestOptions
137+
: T extends NetworkQueries.http
138+
? NetworkHttpRequestOptions
129139
: never;
140+
141+
export interface GenericBuckets {
142+
key: string;
143+
doc_count: number;
144+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
import { IEsSearchResponse } from '../../../../../../../../src/plugins/data/common';
8+
import {
9+
Maybe,
10+
CursorType,
11+
Inspect,
12+
RequestOptionsPaginated,
13+
PageInfoPaginated,
14+
GenericBuckets,
15+
} from '../..';
16+
17+
export interface NetworkHttpRequestOptions extends RequestOptionsPaginated {
18+
ip?: string;
19+
defaultIndex: string[];
20+
}
21+
22+
export interface NetworkHttpStrategyResponse extends IEsSearchResponse {
23+
edges: NetworkHttpEdges[];
24+
totalCount: number;
25+
pageInfo: PageInfoPaginated;
26+
inspect?: Maybe<Inspect>;
27+
}
28+
29+
export interface NetworkHttpEdges {
30+
node: NetworkHttpItem;
31+
cursor: CursorType;
32+
}
33+
34+
export interface NetworkHttpItem {
35+
_id?: Maybe<string>;
36+
domains: string[];
37+
lastHost?: Maybe<string>;
38+
lastSourceIp?: Maybe<string>;
39+
methods: string[];
40+
path?: Maybe<string>;
41+
requestCount?: Maybe<number>;
42+
statuses: string[];
43+
}
44+
45+
export interface NetworkHttpBuckets {
46+
key: string;
47+
doc_count: number;
48+
domains: {
49+
buckets: GenericBuckets[];
50+
};
51+
methods: {
52+
buckets: GenericBuckets[];
53+
};
54+
source: object;
55+
status: {
56+
buckets: GenericBuckets[];
57+
};
58+
}

x-pack/plugins/security_solution/common/search_strategy/security_solution/network/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
*/
66

77
export * from './tls';
8+
export * from './http';
89

910
export enum NetworkQueries {
11+
http = 'http',
1012
tls = 'tls',
1113
}

0 commit comments

Comments
 (0)