-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38dc1cb
commit 298d547
Showing
17 changed files
with
484 additions
and
29 deletions.
There are no files selected for viewing
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
74 changes: 74 additions & 0 deletions
74
.../legacy/plugins/infra/common/http_api/log_analysis/results/log_entry_category_examples.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,74 @@ | ||
/* | ||
* 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 * as rt from 'io-ts'; | ||
|
||
import { | ||
badRequestErrorRT, | ||
forbiddenErrorRT, | ||
timeRangeRT, | ||
routeTimingMetadataRT, | ||
} from '../../shared'; | ||
|
||
export const LOG_ANALYSIS_GET_LOG_ENTRY_CATEGORY_EXAMPLES_PATH = | ||
'/api/infra/log_analysis/results/log_entry_category_examples'; | ||
|
||
/** | ||
* request | ||
*/ | ||
|
||
export const getLogEntryCategoryExamplesRequestPayloadRT = rt.type({ | ||
data: rt.type({ | ||
// the category to fetch the examples for | ||
categoryId: rt.number, | ||
// the number of examples to fetch | ||
exampleCount: rt.number, | ||
// the id of the source configuration | ||
sourceId: rt.string, | ||
// the time range to fetch the category examples from | ||
timeRange: timeRangeRT, | ||
}), | ||
}); | ||
|
||
export type GetLogEntryCategoryExamplesRequestPayload = rt.TypeOf< | ||
typeof getLogEntryCategoryExamplesRequestPayloadRT | ||
>; | ||
|
||
/** | ||
* response | ||
*/ | ||
|
||
const logEntryCategoryExampleRT = rt.type({ | ||
timestamp: rt.number, | ||
message: rt.string, | ||
}); | ||
|
||
export type LogEntryCategoryExample = rt.TypeOf<typeof logEntryCategoryExampleRT>; | ||
|
||
export const getLogEntryCategoryExamplesSuccessReponsePayloadRT = rt.intersection([ | ||
rt.type({ | ||
data: rt.type({ | ||
examples: rt.array(logEntryCategoryExampleRT), | ||
}), | ||
}), | ||
rt.partial({ | ||
timing: routeTimingMetadataRT, | ||
}), | ||
]); | ||
|
||
export type GetLogEntryCategoryExamplesSuccessResponsePayload = rt.TypeOf< | ||
typeof getLogEntryCategoryExamplesSuccessReponsePayloadRT | ||
>; | ||
|
||
export const getLogEntryCategoryExamplesResponsePayloadRT = rt.union([ | ||
getLogEntryCategoryExamplesSuccessReponsePayloadRT, | ||
badRequestErrorRT, | ||
forbiddenErrorRT, | ||
]); | ||
|
||
export type GetLogEntryCategoryExamplesReponsePayload = rt.TypeOf< | ||
typeof getLogEntryCategoryExamplesResponsePayloadRT | ||
>; |
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
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
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
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
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
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
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
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.