Skip to content

Commit

Permalink
[Security Solution] Refactor Network HTTP to use Search Strategy (#76243
Browse files Browse the repository at this point in the history
)
  • Loading branch information
patrykkopycinski authored Sep 2, 2020
1 parent 6686cff commit febeb47
Show file tree
Hide file tree
Showing 11 changed files with 532 additions and 201 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@ import {
HostsRequestOptions,
HostsStrategyResponse,
} from './hosts';
import { NetworkQueries, NetworkTlsStrategyResponse, NetworkTlsRequestOptions } from './network';
import {
NetworkQueries,
NetworkTlsStrategyResponse,
NetworkTlsRequestOptions,
NetworkHttpStrategyResponse,
NetworkHttpRequestOptions,
} from './network';

export * from './hosts';
export * from './network';
Expand Down Expand Up @@ -116,6 +122,8 @@ export type StrategyResponseType<T extends FactoryQueryTypes> = T extends HostsQ
? HostFirstLastSeenStrategyResponse
: T extends NetworkQueries.tls
? NetworkTlsStrategyResponse
: T extends NetworkQueries.http
? NetworkHttpStrategyResponse
: never;

export type StrategyRequestType<T extends FactoryQueryTypes> = T extends HostsQueries.hosts
Expand All @@ -126,4 +134,11 @@ export type StrategyRequestType<T extends FactoryQueryTypes> = T extends HostsQu
? HostFirstLastSeenRequestOptions
: T extends NetworkQueries.tls
? NetworkTlsRequestOptions
: T extends NetworkQueries.http
? NetworkHttpRequestOptions
: never;

export interface GenericBuckets {
key: string;
doc_count: number;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* 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 {
Maybe,
CursorType,
Inspect,
RequestOptionsPaginated,
PageInfoPaginated,
GenericBuckets,
} from '../..';

export interface NetworkHttpRequestOptions extends RequestOptionsPaginated {
ip?: string;
defaultIndex: string[];
}

export interface NetworkHttpStrategyResponse extends IEsSearchResponse {
edges: NetworkHttpEdges[];
totalCount: number;
pageInfo: PageInfoPaginated;
inspect?: Maybe<Inspect>;
}

export interface NetworkHttpEdges {
node: NetworkHttpItem;
cursor: CursorType;
}

export interface NetworkHttpItem {
_id?: Maybe<string>;
domains: string[];
lastHost?: Maybe<string>;
lastSourceIp?: Maybe<string>;
methods: string[];
path?: Maybe<string>;
requestCount?: Maybe<number>;
statuses: string[];
}

export interface NetworkHttpBuckets {
key: string;
doc_count: number;
domains: {
buckets: GenericBuckets[];
};
methods: {
buckets: GenericBuckets[];
};
source: object;
status: {
buckets: GenericBuckets[];
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
*/

export * from './tls';
export * from './http';

export enum NetworkQueries {
http = 'http',
tls = 'tls',
}
Loading

0 comments on commit febeb47

Please sign in to comment.