-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Defend workflows] Establish /common/api folder in osquery plugin (#1…
- Loading branch information
Showing
63 changed files
with
672 additions
and
245 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
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/osquery/common/api/asset/update_assets_status_route.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,14 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const updateAssetsStatusRequestParamsSchema = t.unknown; | ||
|
||
export type UpdateAssetsStatusRequestParamsSchema = t.OutputOf< | ||
typeof updateAssetsStatusRequestParamsSchema | ||
>; |
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/osquery/common/api/fleet_wrapper/get_agent_details_route.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,14 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const getAgentDetailsRequestParamsSchema = t.unknown; | ||
|
||
export type GetAgentDetailsRequestParamsSchema = t.OutputOf< | ||
typeof getAgentDetailsRequestParamsSchema | ||
>; |
20 changes: 20 additions & 0 deletions
20
x-pack/plugins/osquery/common/api/fleet_wrapper/get_agent_policies_route.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,20 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const getAgentPoliciesRequestParamsSchema = t.unknown; | ||
|
||
export type GetAgentPoliciesRequestParamsSchema = t.OutputOf< | ||
typeof getAgentPoliciesRequestParamsSchema | ||
>; | ||
|
||
export const getAgentPoliciesRequestQuerySchema = t.unknown; | ||
|
||
export type GetAgentPoliciesRequestQuerySchema = t.OutputOf< | ||
typeof getAgentPoliciesRequestQuerySchema | ||
>; |
16 changes: 16 additions & 0 deletions
16
x-pack/plugins/osquery/common/api/fleet_wrapper/get_agent_policy_route.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,16 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const getAgentPolicyRequestParamsSchema = t.type({ | ||
id: t.string, | ||
}); | ||
|
||
export type GetAgentPolicyRequestParamsSchema = t.OutputOf< | ||
typeof getAgentPolicyRequestParamsSchema | ||
>; |
23 changes: 23 additions & 0 deletions
23
x-pack/plugins/osquery/common/api/fleet_wrapper/get_agent_status_for_agent_policy_route.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,23 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const getAgentStatusForAgentPolicyRequestParamsSchema = t.unknown; | ||
|
||
export type GetAgentStatusForAgentPolicyRequestParamsSchema = t.OutputOf< | ||
typeof getAgentStatusForAgentPolicyRequestParamsSchema | ||
>; | ||
|
||
export const getAgentStatusForAgentPolicyRequestQuerySchema = t.type({ | ||
policyId: t.string, | ||
kuery: t.union([t.string, t.undefined]), | ||
}); | ||
|
||
export type GetAgentStatusForAgentPolicyRequestQuerySchema = t.OutputOf< | ||
typeof getAgentStatusForAgentPolicyRequestQuerySchema | ||
>; |
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
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/osquery/common/api/fleet_wrapper/get_package_policies_route.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,14 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const getPackagePoliciesRequestQuerySchema = t.unknown; | ||
|
||
export type GetPackagePoliciesRequestQuerySchema = t.OutputOf< | ||
typeof getPackagePoliciesRequestQuerySchema | ||
>; |
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,31 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
export * from './asset/get_assets_status_route'; | ||
export * from './asset/update_assets_status_route'; | ||
export * from './fleet_wrapper/get_agent_policies_route'; | ||
export * from './fleet_wrapper/get_agent_details_route'; | ||
export * from './fleet_wrapper/get_agent_policy_route'; | ||
export * from './fleet_wrapper/get_agent_status_for_agent_policy_route'; | ||
export * from './fleet_wrapper/get_agents_route'; | ||
export * from './fleet_wrapper/get_package_policies_route'; | ||
export * from './live_query/create_live_query_route'; | ||
export * from './live_query/find_live_query_route'; | ||
export * from './live_query/get_live_query_results_route'; | ||
export * from './live_query/get_live_query_details_route'; | ||
export * from './saved_query/create_saved_query_route'; | ||
export * from './saved_query/delete_saved_query_route'; | ||
export * from './saved_query/find_saved_query_route'; | ||
export * from './saved_query/update_saved_query_route'; | ||
export * from './saved_query/read_saved_query_route'; | ||
export * from './packs/create_pack_route'; | ||
export * from './packs/delete_packs_route'; | ||
export * from './packs/find_packs_route'; | ||
export * from './packs/read_packs_route'; | ||
export * from './packs/update_packs_route'; | ||
export * from './model/default_uuid'; | ||
export * from './model/non_empty_string'; |
File renamed without changes.
19 changes: 19 additions & 0 deletions
19
x-pack/plugins/osquery/common/api/live_query/find_live_query_route.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,19 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
import { toNumberRt } from '@kbn/io-ts-utils'; | ||
|
||
export const findLiveQueryRequestQuerySchema = t.type({ | ||
filterQuery: t.union([t.string, t.undefined]), | ||
page: t.union([toNumberRt, t.undefined]), | ||
pageSize: t.union([toNumberRt, t.undefined]), | ||
sort: t.union([t.string, t.undefined]), | ||
sortOrder: t.union([t.union([t.literal('asc'), t.literal('desc')]), t.undefined]), | ||
}); | ||
|
||
export type FindLiveQueryRequestQuerySchema = t.OutputOf<typeof findLiveQueryRequestQuerySchema>; |
22 changes: 22 additions & 0 deletions
22
x-pack/plugins/osquery/common/api/live_query/get_live_query_details_route.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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const getLiveQueryDetailsRequestQuerySchema = t.unknown; | ||
|
||
export type GetLiveQueryDetailsRequestQuerySchema = t.OutputOf< | ||
typeof getLiveQueryDetailsRequestQuerySchema | ||
>; | ||
|
||
export const getLiveQueryDetailsRequestParamsSchema = t.type({ | ||
id: t.string, | ||
}); | ||
|
||
export type GetLiveQueryDetailsRequestParamsSchema = t.OutputOf< | ||
typeof getLiveQueryDetailsRequestParamsSchema | ||
>; |
30 changes: 30 additions & 0 deletions
30
x-pack/plugins/osquery/common/api/live_query/get_live_query_results_route.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,30 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
import { toNumberRt } from '@kbn/io-ts-utils'; | ||
|
||
export const getLiveQueryResultsRequestQuerySchema = t.type({ | ||
filterQuery: t.union([t.string, t.undefined]), | ||
page: t.union([toNumberRt, t.undefined]), | ||
pageSize: t.union([toNumberRt, t.undefined]), | ||
sort: t.union([t.string, t.undefined]), | ||
sortOrder: t.union([t.union([t.literal('asc'), t.literal('desc')]), t.undefined]), | ||
}); | ||
|
||
export type GetLiveQueryResultsRequestQuerySchema = t.OutputOf< | ||
typeof getLiveQueryResultsRequestQuerySchema | ||
>; | ||
|
||
export const getLiveQueryResultsRequestParamsSchema = t.type({ | ||
id: t.string, | ||
actionId: t.string, | ||
}); | ||
|
||
export type GetLiveQueryResultsRequestParamsSchema = t.OutputOf< | ||
typeof getLiveQueryResultsRequestParamsSchema | ||
>; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions
40
x-pack/plugins/osquery/common/api/packs/create_pack_route.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,40 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
import { toNumberRt } from '@kbn/io-ts-utils'; | ||
|
||
export const createPackRequestBodySchema = t.type({ | ||
name: t.string, | ||
description: t.union([t.string, t.undefined]), | ||
enabled: t.union([t.boolean, t.undefined]), | ||
policy_ids: t.union([t.array(t.string), t.undefined]), | ||
shards: t.record(t.string, toNumberRt), | ||
queries: t.record( | ||
t.string, | ||
t.type({ | ||
query: t.string, | ||
interval: t.union([toNumberRt, t.undefined]), | ||
snapshot: t.union([t.boolean, t.undefined]), | ||
removed: t.union([t.boolean, t.undefined]), | ||
platform: t.union([t.string, t.undefined]), | ||
version: t.union([t.string, t.undefined]), | ||
ecs_mapping: t.union([ | ||
t.record( | ||
t.string, | ||
t.type({ | ||
field: t.union([t.string, t.undefined]), | ||
value: t.union([t.string, t.array(t.string), t.undefined]), | ||
}) | ||
), | ||
t.undefined, | ||
]), | ||
}) | ||
), | ||
}); | ||
|
||
export type CreatePackRequestBodySchema = t.OutputOf<typeof createPackRequestBodySchema>; |
14 changes: 14 additions & 0 deletions
14
x-pack/plugins/osquery/common/api/packs/delete_packs_route.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,14 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const deletePacksRequestParamsSchema = t.type({ | ||
id: t.string, | ||
}); | ||
|
||
export type DeletePacksRequestParamsSchema = t.OutputOf<typeof deletePacksRequestParamsSchema>; |
18 changes: 18 additions & 0 deletions
18
x-pack/plugins/osquery/common/api/packs/find_packs_route.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,18 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
import { toNumberRt } from '@kbn/io-ts-utils'; | ||
|
||
export const findPacksRequestQuerySchema = t.type({ | ||
page: t.union([toNumberRt, t.undefined]), | ||
pageSize: t.union([toNumberRt, t.undefined]), | ||
sort: t.union([t.string, t.undefined]), | ||
sortOrder: t.union([t.union([t.literal('asc'), t.literal('desc')]), t.undefined]), | ||
}); | ||
|
||
export type FindPacksRequestQuerySchema = t.OutputOf<typeof findPacksRequestQuerySchema>; |
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
49 changes: 49 additions & 0 deletions
49
x-pack/plugins/osquery/common/api/packs/update_packs_route.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,49 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
import { toNumberRt } from '@kbn/io-ts-utils'; | ||
|
||
export const updatePacksRequestBodySchema = t.type({ | ||
name: t.union([t.string, t.undefined]), | ||
description: t.union([t.string, t.undefined]), | ||
enabled: t.union([t.boolean, t.undefined]), | ||
policy_ids: t.union([t.array(t.string), t.undefined]), | ||
shards: t.union([t.record(t.string, toNumberRt), t.undefined]), | ||
queries: t.union([ | ||
t.record( | ||
t.string, | ||
t.type({ | ||
query: t.string, | ||
interval: t.union([toNumberRt, t.undefined]), | ||
snapshot: t.union([t.boolean, t.undefined]), | ||
removed: t.union([t.boolean, t.undefined]), | ||
platform: t.union([t.string, t.undefined]), | ||
version: t.union([t.string, t.undefined]), | ||
ecs_mapping: t.union([ | ||
t.record( | ||
t.string, | ||
t.type({ | ||
field: t.union([t.string, t.undefined]), | ||
value: t.union([t.string, t.array(t.string), t.undefined]), | ||
}) | ||
), | ||
t.undefined, | ||
]), | ||
}) | ||
), | ||
t.undefined, | ||
]), | ||
}); | ||
|
||
export type UpdatePacksRequestBodySchema = t.OutputOf<typeof updatePacksRequestBodySchema>; | ||
|
||
export const updatePacksRequestParamsSchema = t.type({ | ||
id: t.string, | ||
}); | ||
|
||
export type UpdatePacksRequestParamsSchema = t.OutputOf<typeof updatePacksRequestParamsSchema>; |
File renamed without changes.
16 changes: 16 additions & 0 deletions
16
x-pack/plugins/osquery/common/api/saved_query/delete_saved_query_route.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,16 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
import * as t from 'io-ts'; | ||
|
||
export const deleteSavedQueryRequestParamsSchema = t.type({ | ||
id: t.string, | ||
}); | ||
|
||
export type DeleteSavedQueryRequestParamsSchema = t.OutputOf< | ||
typeof deleteSavedQueryRequestParamsSchema | ||
>; |
Oops, something went wrong.