[Security Solution][Exceptions] - Add exception list duplication options with and without expired items (#154991)

## Summary

Adds the following:

- Add the option to duplicate from the shared exception list management
actions dropdowns
  - User can select to include exception items with expired TTL
  - User can select to not include exception items with expired TTL 
  - Cypress tests added for both options
This commit is contained in:
Yara Tercero 2023-04-21 16:01:43 -07:00 committed by GitHub
parent fdc23f570e
commit 11155329cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
67 changed files with 2303 additions and 332 deletions

View file

@ -32,6 +32,7 @@ import {
GetExceptionFilterFromExceptionListIdsProps,
GetExceptionFilterFromExceptionsProps,
ExceptionFilterResponse,
DuplicateExceptionListProps,
} from '@kbn/securitysolution-io-ts-list-types';
import {
@ -617,3 +618,31 @@ export const getExceptionFilterFromExceptions = async ({
}),
signal,
});
/**
* Duplicate an ExceptionList and its items by providing a ExceptionList list_id
*
* @param http Kibana http service
* @param includeExpiredExceptions boolean for including exception items with expired TTL
* @param listId ExceptionList LIST_ID (not id)
* @param namespaceType ExceptionList namespace_type
* @param signal to cancel request
*
* @throws An error if response is not OK
*/
export const duplicateExceptionList = async ({
http,
includeExpiredExceptions,
listId,
namespaceType,
signal,
}: DuplicateExceptionListProps): Promise<ExceptionListSchema> =>
http.fetch<ExceptionListSchema>(`${EXCEPTION_LIST_URL}/_duplicate`, {
method: 'POST',
query: {
list_id: listId,
namespace_type: namespaceType,
include_expired_exceptions: includeExpiredExceptions,
},
signal,
});