Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Security Solution] Refactor Network HTTP to use Search Strategy #76243

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