-
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.
## Summary Adds new connector type to support https://www.sentinelone.com/ The scope of this PR was limited to the Connector logic, schemas, and types to make PR more digestible. In the current PR, the connector is NOT registered, so it's not going to be available to the users. In the follow-up PR I'm going to improve the UX of Param's form and then enable the connector <img width="1685" alt="Zrzut ekranu 2023-08-3 o 11 18 54" src="https://github.com/elastic/kibana/assets/5188868/965ef8ef-497f-42a8-983e-38fd0370cba8"> visual changes include a screenshot or gif. <img width="1685" alt="image" src="https://github.com/elastic/kibana/assets/5188868/119d2255-ed9f-4923-886d-eb139223a47d"> <img width="1690" alt="image" src="https://github.com/elastic/kibana/assets/5188868/e2c569d2-b497-4641-a6a6-454494223ffc">
- Loading branch information
1 parent
6673e9d
commit 4637b74
Showing
23 changed files
with
1,883 additions
and
2 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
43 changes: 43 additions & 0 deletions
43
...y_solution/public/timelines/components/side_panel/event_details/flyout/use_sub_action.tsx
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,43 @@ | ||
/* | ||
* 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 { executeAction } from '@kbn/triggers-actions-ui-plugin/public'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
import { useKibana } from '../../../../../common/lib/kibana/kibana_react'; | ||
|
||
export interface UseSubActionParams<P> { | ||
connectorId: string; | ||
subAction: string; | ||
subActionParams?: P; | ||
disabled?: boolean; | ||
} | ||
|
||
export const useSubAction = <P, R>({ | ||
connectorId, | ||
subAction, | ||
subActionParams, | ||
disabled = false, | ||
...rest | ||
}: UseSubActionParams<P>) => { | ||
const { http } = useKibana().services; | ||
|
||
return useQuery({ | ||
queryKey: ['useSubAction', connectorId, subAction, subActionParams], | ||
queryFn: ({ signal }) => | ||
executeAction<R>({ | ||
id: connectorId, | ||
params: { | ||
subAction, | ||
subActionParams, | ||
}, | ||
http, | ||
signal, | ||
}), | ||
enabled: !disabled && !!connectorId && !!subAction, | ||
...rest, | ||
}); | ||
}; |
38 changes: 38 additions & 0 deletions
38
...n/public/timelines/components/side_panel/event_details/flyout/use_sub_action_mutation.tsx
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,38 @@ | ||
/* | ||
* 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 { executeAction } from '@kbn/triggers-actions-ui-plugin/public'; | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { useKibana } from '../../../../../common/lib/kibana/kibana_react'; | ||
|
||
export interface UseSubActionParams<P> { | ||
connectorId: string; | ||
subAction: string; | ||
subActionParams?: P; | ||
disabled?: boolean; | ||
} | ||
|
||
export const useSubActionMutation = <P, R>({ | ||
connectorId, | ||
subAction, | ||
subActionParams, | ||
disabled = false, | ||
}: UseSubActionParams<P>) => { | ||
const { http } = useKibana().services; | ||
|
||
return useMutation({ | ||
mutationFn: () => | ||
executeAction<R>({ | ||
id: connectorId, | ||
params: { | ||
subAction, | ||
subActionParams, | ||
}, | ||
http, | ||
}), | ||
}); | ||
}; |
21 changes: 21 additions & 0 deletions
21
x-pack/plugins/stack_connectors/common/sentinelone/constants.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,21 @@ | ||
/* | ||
* 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 const SENTINELONE_TITLE = 'Sentinel One'; | ||
export const SENTINELONE_CONNECTOR_ID = '.sentinelone'; | ||
export const API_MAX_RESULTS = 1000; | ||
|
||
export enum SUB_ACTION { | ||
KILL_PROCESS = 'killProcess', | ||
EXECUTE_SCRIPT = 'executeScript', | ||
GET_AGENTS = 'getAgents', | ||
ISOLATE_AGENT = 'isolateAgent', | ||
RELEASE_AGENT = 'releaseAgent', | ||
GET_REMOTE_SCRIPTS = 'getRemoteScripts', | ||
GET_REMOTE_SCRIPT_STATUS = 'getRemoteScriptStatus', | ||
GET_REMOTE_SCRIPT_RESULTS = 'getRemoteScriptResults', | ||
} |
Oops, something went wrong.