-
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.
[Entity Analytics] Add return types to all our routes (#189726)
## Summary Add return types to all of our route handlers. Before we did things like this in _some_ APIs: ``` const resBody: CreateAssetCriticalityRecordResponse = { blah : 'blah'}; ``` And I have moved to this style: ``` async ( context, request, response ): Promise<IKibanaResponse<CreateAssetCriticalityRecordResponse>> => { ``` This keeps the API docs in sync, I saw that this is how they do it in the elastic assistant plugin and liked it. I think it is clearer to have this stuff in the route definition, near the URL and request validation. --------- Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
3c431ff
commit bc79b99
Showing
27 changed files
with
454 additions
and
321 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
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
22 changes: 22 additions & 0 deletions
22
...curity_solution/common/api/entity_analytics/risk_engine/get_risk_engine_privileges.gen.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 | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
/* | ||
* NOTICE: Do not edit this file manually. | ||
* This file is automatically generated by the OpenAPI Generator, @kbn/openapi-generator. | ||
* | ||
* info: | ||
* title: Get Risk Engine Privileges Schema | ||
* version: 1 | ||
*/ | ||
|
||
import type { z } from 'zod'; | ||
|
||
import { EntityAnalyticsPrivileges } from '../common/common.gen'; | ||
|
||
export type RiskEngineGetPrivilegesResponse = z.infer<typeof RiskEngineGetPrivilegesResponse>; | ||
export const RiskEngineGetPrivilegesResponse = EntityAnalyticsPrivileges; |
26 changes: 26 additions & 0 deletions
26
...y_solution/common/api/entity_analytics/risk_engine/get_risk_engine_privileges.schema.yaml
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,26 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Get Risk Engine Privileges Schema | ||
version: '1' | ||
paths: | ||
/internal/risk_engine/privileges: | ||
get: | ||
x-labels: [ess, serverless] | ||
x-internal: true | ||
x-codegen-enabled: true | ||
operationId: RiskEngineGetPrivileges | ||
summary: Get Risk Engine Privileges | ||
responses: | ||
'200': | ||
description: Successful response | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '../common/common.schema.yaml#/components/schemas/EntityAnalyticsPrivileges' | ||
example: | ||
elasticsearch: | ||
index: | ||
'risk-score.risk-score-*': | ||
read: true | ||
write: false | ||
has_all_required: false |
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.