[Security Solution] Move lists plugin API schemas to /common/api (#162489)

Closes https://github.com/elastic/security-team/issues/7102

Establishes the `/common/api` folder structure for the lists plugin.
This PR simply imports and re-exports the schemas from the schema
package since the schemas are all already separated from the `server`
code. Future PRs will replace these re-exports with schemas generated
from OpenAPI specs.
This commit is contained in:
Marshall Main 2023-07-27 15:22:00 -07:00 committed by GitHub
parent e8978ee630
commit 5da645acee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
80 changed files with 864 additions and 243 deletions

View file

@ -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 {
CreateEndpointListSchema,
createEndpointListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export const createEndpointListResponse = createEndpointListSchema;
export type CreateEndpointListResponse = CreateEndpointListSchema;

View file

@ -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 {
CreateEndpointListItemSchemaDecoded,
ExceptionListItemSchema,
createEndpointListItemSchema,
exceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export { createEndpointListItemSchema as createEndpointListItemRequest };
export type { CreateEndpointListItemSchemaDecoded as CreateEndpointListItemRequestDecoded };
export const createEndpointListItemResponse = exceptionListItemSchema;
export type CreateEndpointListItemResponse = ExceptionListItemSchema;

View file

@ -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 {
CreateExceptionListSchemaDecoded,
ExceptionListSchema,
createExceptionListSchema,
exceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export { createExceptionListSchema as createExceptionListRequest };
export type { CreateExceptionListSchemaDecoded as CreateExceptionListRequestDecoded };
export const createExceptionListResponse = exceptionListSchema;
export type CreateExceptionListResponse = ExceptionListSchema;

View file

@ -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 {
CreateExceptionListItemSchemaDecoded,
ExceptionListItemSchema,
createExceptionListItemSchema,
exceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export { createExceptionListItemSchema as createExceptionListItemRequest };
export type { CreateExceptionListItemSchemaDecoded as CreateExceptionListItemRequestDecoded };
export const createExceptionListItemResponse = exceptionListItemSchema;
export type CreateExceptionListItemResponse = ExceptionListItemSchema;

View file

@ -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 {
DeleteEndpointListItemSchemaDecoded,
deleteEndpointListItemSchema,
exceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
deleteEndpointListItemSchema as deleteEndpointListItemRequestQuery,
exceptionListItemSchema as deleteEndpointListItemResponse,
};
export type { DeleteEndpointListItemSchemaDecoded as DeleteEndpointListItemRequestQueryDecoded };

View file

@ -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 {
DeleteExceptionListSchemaDecoded,
deleteExceptionListSchema,
exceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
deleteExceptionListSchema as deleteExceptionListRequestQuery,
exceptionListSchema as deleteExceptionListResponse,
};
export type { DeleteExceptionListSchemaDecoded as DeleteExceptionListRequestQueryDecoded };

View file

@ -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 {
DeleteExceptionListItemSchemaDecoded,
deleteExceptionListItemSchema,
exceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
deleteExceptionListItemSchema as deleteExceptionListItemRequestQuery,
exceptionListItemSchema as deleteExceptionListItemResponse,
};
export type { DeleteExceptionListItemSchemaDecoded as DeleteExceptionListItemRequestQueryDecoded };

View file

@ -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 {
DuplicateExceptionListQuerySchemaDecoded,
duplicateExceptionListQuerySchema,
exceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
duplicateExceptionListQuerySchema as duplicateExceptionListRequestQuery,
exceptionListSchema as duplicateExceptionListResponse,
};
export type { DuplicateExceptionListQuerySchemaDecoded as DuplicateExceptionListRequestQueryDecoded };

View file

@ -0,0 +1,10 @@
/*
* 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 { exportExceptionListQuerySchema } from '@kbn/securitysolution-io-ts-list-types';
export { exportExceptionListQuerySchema as exportExceptionListRequestQuery };

View file

@ -0,0 +1,10 @@
/*
* 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 { exportListItemQuerySchema } from '@kbn/securitysolution-io-ts-list-types';
export { exportListItemQuerySchema as exportListItemRequestQuery };

View file

@ -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 {
FindEndpointListItemSchemaDecoded,
findEndpointListItemSchema,
foundExceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
findEndpointListItemSchema as findEndpointListItemRequestQuery,
foundExceptionListItemSchema as findEndpointListItemResponse,
};
export type { FindEndpointListItemSchemaDecoded as FindEndpointListItemRequestQueryDecoded };

View file

@ -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 {
FindExceptionListSchemaDecoded,
findExceptionListSchema,
foundExceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
findExceptionListSchema as findExceptionListRequestQuery,
foundExceptionListSchema as findExceptionListResponse,
};
export type { FindExceptionListSchemaDecoded as FindExceptionListRequestQueryDecoded };

View file

@ -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 {
FindExceptionListItemSchemaDecoded,
findExceptionListItemSchema,
foundExceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
findExceptionListItemSchema as findExceptionListItemRequestQuery,
foundExceptionListItemSchema as findExceptionListItemResponse,
};
export type { FindExceptionListItemSchemaDecoded as FindExceptionListItemRequestQueryDecoded };

View file

@ -0,0 +1,10 @@
/*
* 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 { getExceptionFilterSchema } from '@kbn/securitysolution-io-ts-list-types';
export { getExceptionFilterSchema as getExceptionFilterRequest };

View file

@ -0,0 +1,15 @@
/*
* 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 { ImportQuerySchemaDecoded, importQuerySchema } from '@kbn/securitysolution-io-ts-types';
import { importExceptionsResponseSchema } from '@kbn/securitysolution-io-ts-list-types';
export {
importQuerySchema as importExceptionsRequestQuery,
importExceptionsResponseSchema as importExceptionsResponse,
};
export type { ImportQuerySchemaDecoded as ImportExceptionsRequestQueryDecoded };

View file

@ -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 {
ReadEndpointListItemSchemaDecoded,
exceptionListItemSchema,
readEndpointListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
readEndpointListItemSchema as readEndpointListItemRequestQuery,
exceptionListItemSchema as readEndpointListItemResponse,
};
export type { ReadEndpointListItemSchemaDecoded as ReadEndpointListItemRequestQueryDecoded };

View file

@ -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 {
ReadExceptionListSchemaDecoded,
exceptionListSchema,
readExceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
readExceptionListSchema as readExceptionListRequestQuery,
exceptionListSchema as readExceptionListResponse,
};
export type { ReadExceptionListSchemaDecoded as ReadExceptionListRequestQueryDecoded };

View file

@ -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 {
ReadExceptionListItemSchemaDecoded,
exceptionListItemSchema,
readExceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
readExceptionListItemSchema as readExceptionListItemRequestQuery,
exceptionListItemSchema as readExceptionListItemResponse,
};
export type { ReadExceptionListItemSchemaDecoded as ReadExceptionListItemRequestQueryDecoded };

View file

@ -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 {
SummaryExceptionListSchemaDecoded,
exceptionListSummarySchema,
summaryExceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
summaryExceptionListSchema as summaryExceptionListRequestQuery,
exceptionListSummarySchema as summaryExceptionListResponse,
};
export type { SummaryExceptionListSchemaDecoded as SummaryExceptionListRequestQueryDecoded };

View file

@ -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 {
UpdateEndpointListItemSchemaDecoded,
exceptionListItemSchema,
updateEndpointListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
updateEndpointListItemSchema as updateEndpointListItemRequest,
exceptionListItemSchema as updateEndpointListItemResponse,
};
export type { UpdateEndpointListItemSchemaDecoded as UpdateEndpointListItemRequestDecoded };

View file

@ -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 {
UpdateExceptionListSchemaDecoded,
exceptionListSchema,
updateExceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
updateExceptionListSchema as updateExceptionListRequest,
exceptionListSchema as updateExceptionListResponse,
};
export type { UpdateExceptionListSchemaDecoded as UpdateExceptionListRequestDecoded };

View file

@ -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 {
UpdateExceptionListItemSchemaDecoded,
exceptionListItemSchema,
updateExceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
updateExceptionListItemSchema as updateExceptionListItemRequest,
exceptionListItemSchema as updateExceptionListItemResponse,
};
export type { UpdateExceptionListItemSchemaDecoded as UpdateExceptionListItemRequestDecoded };

View file

@ -0,0 +1,46 @@
/*
* 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 './exceptions/create_endpoint_list_item/create_endpoint_list_item_route';
export * from './exceptions/create_endpoint_list/create_endpoint_list_route';
export * from './exceptions/create_exception_list_item/create_exception_list_item_route';
export * from './exceptions/create_exception_list/create_exception_list_route';
export * from './exceptions/delete_endpoint_list_item/delete_endpoint_list_item_route';
export * from './exceptions/delete_exception_list_item/delete_exception_list_item_route';
export * from './exceptions/delete_exception_list/delete_exception_list_route';
export * from './exceptions/duplicate_exception_list/duplicate_exception_list_route';
export * from './exceptions/export_exception_list/export_exception_list_route';
export * from './exceptions/export_list_item/export_list_item_route';
export * from './exceptions/find_endpoint_list_item/find_endpoint_list_item_route';
export * from './exceptions/find_exception_list_item/find_exception_list_item_route';
export * from './exceptions/find_exception_list/find_exception_list_route';
export * from './exceptions/get_exception_filter/get_exception_filter_route';
export * from './exceptions/import_exceptions/import_exceptions_route';
export * from './exceptions/read_endpoint_list_item/read_endpoint_list_item_route';
export * from './exceptions/read_exception_list_item/read_exception_list_item_route';
export * from './exceptions/read_exception_list/read_exception_list_route';
export * from './exceptions/summary_exception_list/summary_exception_list_route';
export * from './exceptions/update_endpoint_list_item/update_endpoint_list_item_route';
export * from './exceptions/update_exception_list_item/update_exception_list_item_route';
export * from './exceptions/update_exception_list/update_exception_list_route';
export * from './values/create_list_index/create_list_index_route';
export * from './values/create_list_item/create_list_item_route';
export * from './values/create_list/create_list_route';
export * from './values/delete_list_index/delete_list_index_route';
export * from './values/delete_list_item/delete_list_item_route';
export * from './values/delete_list/delete_list_route';
export * from './values/find_list_item/find_list_item_route';
export * from './values/find_list/find_list_route';
export * from './values/find_lists_by_size/find_lists_by_size_route';
export * from './values/import_list_item/import_list_item_route';
export * from './values/patch_list_item/patch_list_item_route';
export * from './values/patch_list/patch_list_route';
export * from './values/read_list_index/read_list_index_route';
export * from './values/read_list_item/read_list_item_route';
export * from './values/read_list/read_list_route';
export * from './values/update_list_item/update_list_item_route';
export * from './values/update_list/update_list_route';

View file

@ -0,0 +1,15 @@
/*
* 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 {
CreateListSchemaDecoded,
createListSchema,
listSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export { createListSchema as createListRequest, listSchema as createListResponse };
export type { CreateListSchemaDecoded as CreateListRequestDecoded };

View file

@ -0,0 +1,10 @@
/*
* 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 { acknowledgeSchema } from '@kbn/securitysolution-io-ts-list-types';
export { acknowledgeSchema as createListIndexResponse };

View file

@ -0,0 +1,10 @@
/*
* 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 { createListItemSchema, listItemSchema } from '@kbn/securitysolution-io-ts-list-types';
export { createListItemSchema as createListItemRequest, listItemSchema as createListItemResponse };

View file

@ -0,0 +1,10 @@
/*
* 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 { deleteListSchema, listSchema } from '@kbn/securitysolution-io-ts-list-types';
export { deleteListSchema as deleteListRequestQuery, listSchema as deleteListResponse };

View file

@ -0,0 +1,10 @@
/*
* 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 { acknowledgeSchema } from '@kbn/securitysolution-io-ts-list-types';
export { acknowledgeSchema as deleteListIndexResponse };

View file

@ -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 {
deleteListItemSchema,
listItemArraySchema,
listItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
deleteListItemSchema as deleteListItemRequestQuery,
listItemSchema as deleteListItemResponse,
listItemArraySchema as deleteListItemArrayResponse,
};

View file

@ -0,0 +1,10 @@
/*
* 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 { findListSchema, foundListSchema } from '@kbn/securitysolution-io-ts-list-types';
export { findListSchema as findListRequestQuery, foundListSchema as findListResponse };

View file

@ -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 {
FindListItemSchemaDecoded,
findListItemSchema,
foundListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
findListItemSchema as findListItemRequestQuery,
foundListItemSchema as findListItemResponse,
};
export type { FindListItemSchemaDecoded as FindListItemRequestQueryDecoded };

View file

@ -0,0 +1,13 @@
/*
* 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 { findListSchema, foundListsBySizeSchema } from '@kbn/securitysolution-io-ts-list-types';
export {
findListSchema as findListsBySizeRequestQuery,
foundListsBySizeSchema as findListsBySizeResponse,
};

View file

@ -0,0 +1,13 @@
/*
* 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 { importListItemQuerySchema, listSchema } from '@kbn/securitysolution-io-ts-list-types';
export {
importListItemQuerySchema as importListItemRequestQuery,
listSchema as importListItemResponse,
};

View file

@ -0,0 +1,10 @@
/*
* 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 { listSchema, patchListSchema } from '@kbn/securitysolution-io-ts-list-types';
export { patchListSchema as patchListRequest, listSchema as patchListResponse };

View file

@ -0,0 +1,10 @@
/*
* 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 { listItemSchema, patchListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
export { patchListItemSchema as patchListItemRequest, listItemSchema as patchListItemResponse };

View file

@ -0,0 +1,10 @@
/*
* 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 { listSchema, readListSchema } from '@kbn/securitysolution-io-ts-list-types';
export { readListSchema as readListRequestQuery, listSchema as readListResponse };

View file

@ -0,0 +1,10 @@
/*
* 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 { listItemIndexExistSchema } from '@kbn/securitysolution-io-ts-list-types';
export { listItemIndexExistSchema as readListIndexResponse };

View file

@ -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 {
listItemArraySchema,
listItemSchema,
readListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
export {
readListItemSchema as readListItemRequestQuery,
listItemSchema as readListItemResponse,
listItemArraySchema as readListItemArrayResponse,
};

View file

@ -0,0 +1,10 @@
/*
* 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 { listSchema, updateListSchema } from '@kbn/securitysolution-io-ts-list-types';
export { updateListSchema as updateListRequest, listSchema as updateListResponse };

View file

@ -0,0 +1,10 @@
/*
* 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 { listItemSchema, updateListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
export { updateListItemSchema as updateListItemRequest, listItemSchema as updateListItemResponse };

View file

@ -6,18 +6,15 @@
*/
import { validate } from '@kbn/securitysolution-io-ts-utils';
import {
CreateExceptionListSchemaDecoded,
exceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { IKibanaResponse, KibanaRequest, KibanaResponseFactory } from '@kbn/core-http-server';
import { CreateExceptionListRequestDecoded, createExceptionListResponse } from '../../common/api';
import { SiemResponseFactory, getExceptionListClient } from '../routes';
import { ListsRequestHandlerContext } from '../types';
export const createExceptionListHandler = async (
context: ListsRequestHandlerContext,
request: KibanaRequest<unknown, unknown, CreateExceptionListSchemaDecoded, 'post'>,
request: KibanaRequest<unknown, unknown, CreateExceptionListRequestDecoded, 'post'>,
response: KibanaResponseFactory,
siemResponse: SiemResponseFactory,
options: { ignoreExisting: boolean } = { ignoreExisting: false }
@ -59,7 +56,7 @@ export const createExceptionListHandler = async (
type,
version,
});
const [validated, errors] = validate(createdList, exceptionListSchema);
const [validated, errors] = validate(createdList, createExceptionListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,13 +7,13 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
CreateEndpointListItemSchemaDecoded,
createEndpointListItemSchema,
exceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { ENDPOINT_LIST_ID, ENDPOINT_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import {
CreateEndpointListItemRequestDecoded,
createEndpointListItemRequest,
createEndpointListItemResponse,
} from '../../common/api';
import type { ListsPluginRouter } from '../types';
import { buildRouteValidation, buildSiemResponse, getExceptionListClient } from './utils';
@ -28,9 +28,9 @@ export const createEndpointListItemRoute = (router: ListsPluginRouter): void =>
path: ENDPOINT_LIST_ITEM_URL,
validate: {
body: buildRouteValidation<
typeof createEndpointListItemSchema,
CreateEndpointListItemSchemaDecoded
>(createEndpointListItemSchema),
typeof createEndpointListItemRequest,
CreateEndpointListItemRequestDecoded
>(createEndpointListItemRequest),
},
},
async (context, request, response) => {
@ -69,7 +69,7 @@ export const createEndpointListItemRoute = (router: ListsPluginRouter): void =>
tags,
type,
});
const [validated, errors] = validate(createdList, exceptionListItemSchema);
const [validated, errors] = validate(createdList, createEndpointListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,10 +7,10 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { createEndpointListSchema } from '@kbn/securitysolution-io-ts-list-types';
import { ENDPOINT_LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { createEndpointListResponse } from '../../common/api';
import { buildSiemResponse } from './utils';
import { getExceptionListClient } from './utils/get_exception_list_client';
@ -44,7 +44,7 @@ export const createEndpointListRoute = (router: ListsPluginRouter): void => {
// and block the least amount of time with this route since it could end up in various parts of the
// stack at some point such as repeatedly being called by endpoint agents.
const body = createdList ?? {};
const [validated, errors] = validate(body, createEndpointListSchema);
const [validated, errors] = validate(body, createEndpointListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
CreateExceptionListItemSchemaDecoded,
createExceptionListItemSchema,
exceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
CreateExceptionListItemRequestDecoded,
createExceptionListItemRequest,
createExceptionListItemResponse,
} from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
import { getExceptionListClient } from './utils/get_exception_list_client';
@ -30,9 +30,9 @@ export const createExceptionListItemRoute = (router: ListsPluginRouter): void =>
path: EXCEPTION_LIST_ITEM_URL,
validate: {
body: buildRouteValidation<
typeof createExceptionListItemSchema,
CreateExceptionListItemSchemaDecoded
>(createExceptionListItemSchema),
typeof createExceptionListItemRequest,
CreateExceptionListItemRequestDecoded
>(createExceptionListItemRequest),
},
},
async (context, request, response) => {
@ -103,7 +103,7 @@ export const createExceptionListItemRoute = (router: ListsPluginRouter): void =>
tags,
type,
});
const [validated, errors] = validate(createdList, exceptionListItemSchema);
const [validated, errors] = validate(createdList, createExceptionListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -6,12 +6,9 @@
*/
import { transformError } from '@kbn/securitysolution-es-utils';
import {
CreateExceptionListSchemaDecoded,
createExceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_URL } from '@kbn/securitysolution-list-constants';
import { CreateExceptionListRequestDecoded, createExceptionListRequest } from '../../common/api';
import type { ListsPluginRouter } from '../types';
import { createExceptionListHandler } from '../handlers/create_exception_list_handler';
@ -26,9 +23,9 @@ export const createExceptionListRoute = (router: ListsPluginRouter): void => {
path: EXCEPTION_LIST_URL,
validate: {
body: buildRouteValidation<
typeof createExceptionListSchema,
CreateExceptionListSchemaDecoded
>(createExceptionListSchema),
typeof createExceptionListRequest,
CreateExceptionListRequestDecoded
>(createExceptionListRequest),
},
},
async (context, request, response) => {

View file

@ -7,9 +7,9 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { acknowledgeSchema } from '@kbn/securitysolution-io-ts-list-types';
import { LIST_INDEX } from '@kbn/securitysolution-list-constants';
import { createListIndexResponse } from '../../common/api';
import type { ListsPluginRouter } from '../types';
import { buildSiemResponse } from './utils';
@ -83,7 +83,7 @@ export const createListIndexRoute = (router: ListsPluginRouter): void => {
await lists.createListItemBootStrapIndex();
}
const [validated, errors] = validate({ acknowledged: true }, acknowledgeSchema);
const [validated, errors] = validate({ acknowledged: true }, createListIndexResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,9 +7,9 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { createListItemSchema, listItemSchema } from '@kbn/securitysolution-io-ts-list-types';
import { LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import { createListItemRequest, createListItemResponse } from '../../common/api';
import type { ListsPluginRouter } from '../types';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -24,7 +24,7 @@ export const createListItemRoute = (router: ListsPluginRouter): void => {
},
path: LIST_ITEM_URL,
validate: {
body: buildRouteValidation(createListItemSchema),
body: buildRouteValidation(createListItemRequest),
},
},
async (context, request, response) => {
@ -58,7 +58,7 @@ export const createListItemRoute = (router: ListsPluginRouter): void => {
value,
});
if (createdListItem != null) {
const [validated, errors] = validate(createdListItem, listItemSchema);
const [validated, errors] = validate(createdListItem, createListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,10 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
CreateListSchemaDecoded,
createListSchema,
listSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { CreateListRequestDecoded, createListRequest, createListResponse } from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -28,8 +24,8 @@ export const createListRoute = (router: ListsPluginRouter): void => {
},
path: LIST_URL,
validate: {
body: buildRouteValidation<typeof createListSchema, CreateListSchemaDecoded>(
createListSchema
body: buildRouteValidation<typeof createListRequest, CreateListRequestDecoded>(
createListRequest
),
},
},
@ -66,7 +62,7 @@ export const createListRoute = (router: ListsPluginRouter): void => {
type,
version,
});
const [validated, errors] = validate(list, listSchema);
const [validated, errors] = validate(list, createListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
DeleteEndpointListItemSchemaDecoded,
deleteEndpointListItemSchema,
exceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { ENDPOINT_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
DeleteEndpointListItemRequestQueryDecoded,
deleteEndpointListItemRequestQuery,
deleteEndpointListItemResponse,
} from '../../common/api';
import {
buildRouteValidation,
@ -32,9 +32,9 @@ export const deleteEndpointListItemRoute = (router: ListsPluginRouter): void =>
path: ENDPOINT_LIST_ITEM_URL,
validate: {
query: buildRouteValidation<
typeof deleteEndpointListItemSchema,
DeleteEndpointListItemSchemaDecoded
>(deleteEndpointListItemSchema),
typeof deleteEndpointListItemRequestQuery,
DeleteEndpointListItemRequestQueryDecoded
>(deleteEndpointListItemRequestQuery),
},
},
async (context, request, response) => {
@ -58,7 +58,7 @@ export const deleteEndpointListItemRoute = (router: ListsPluginRouter): void =>
statusCode: 404,
});
} else {
const [validated, errors] = validate(deleted, exceptionListItemSchema);
const [validated, errors] = validate(deleted, deleteEndpointListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
DeleteExceptionListItemSchemaDecoded,
deleteExceptionListItemSchema,
exceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
DeleteExceptionListItemRequestQueryDecoded,
deleteExceptionListItemRequestQuery,
deleteExceptionListItemResponse,
} from '../../common/api';
import {
buildRouteValidation,
@ -32,9 +32,9 @@ export const deleteExceptionListItemRoute = (router: ListsPluginRouter): void =>
path: EXCEPTION_LIST_ITEM_URL,
validate: {
query: buildRouteValidation<
typeof deleteExceptionListItemSchema,
DeleteExceptionListItemSchemaDecoded
>(deleteExceptionListItemSchema),
typeof deleteExceptionListItemRequestQuery,
DeleteExceptionListItemRequestQueryDecoded
>(deleteExceptionListItemRequestQuery),
},
},
async (context, request, response) => {
@ -59,7 +59,7 @@ export const deleteExceptionListItemRoute = (router: ListsPluginRouter): void =>
statusCode: 404,
});
} else {
const [validated, errors] = validate(deleted, exceptionListItemSchema);
const [validated, errors] = validate(deleted, deleteExceptionListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
DeleteExceptionListSchemaDecoded,
deleteExceptionListSchema,
exceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
DeleteExceptionListRequestQueryDecoded,
deleteExceptionListRequestQuery,
deleteExceptionListResponse,
} from '../../common/api';
import {
buildRouteValidation,
@ -32,9 +32,9 @@ export const deleteExceptionListRoute = (router: ListsPluginRouter): void => {
path: EXCEPTION_LIST_URL,
validate: {
query: buildRouteValidation<
typeof deleteExceptionListSchema,
DeleteExceptionListSchemaDecoded
>(deleteExceptionListSchema),
typeof deleteExceptionListRequestQuery,
DeleteExceptionListRequestQueryDecoded
>(deleteExceptionListRequestQuery),
},
},
async (context, request, response) => {
@ -59,7 +59,7 @@ export const deleteExceptionListRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(deleted, exceptionListSchema);
const [validated, errors] = validate(deleted, deleteExceptionListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,10 +7,10 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { acknowledgeSchema } from '@kbn/securitysolution-io-ts-list-types';
import { LIST_INDEX } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { deleteListIndexResponse } from '../../common/api';
import { buildSiemResponse } from './utils';
@ -93,7 +93,7 @@ export const deleteListIndexRoute = (router: ListsPluginRouter): void => {
await lists.deleteLegacyListItemTemplate();
}
const [validated, errors] = validate({ acknowledged: true }, acknowledgeSchema);
const [validated, errors] = validate({ acknowledged: true }, deleteListIndexResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
deleteListItemSchema,
listItemArraySchema,
listItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
deleteListItemArrayResponse,
deleteListItemRequestQuery,
deleteListItemResponse,
} from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -28,7 +28,7 @@ export const deleteListItemRoute = (router: ListsPluginRouter): void => {
},
path: LIST_ITEM_URL,
validate: {
query: buildRouteValidation(deleteListItemSchema),
query: buildRouteValidation(deleteListItemRequestQuery),
},
},
async (context, request, response) => {
@ -44,7 +44,7 @@ export const deleteListItemRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(deleted, listItemSchema);
const [validated, errors] = validate(deleted, deleteListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {
@ -70,7 +70,7 @@ export const deleteListItemRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(deleted, listItemArraySchema);
const [validated, errors] = validate(deleted, deleteListItemArrayResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -13,9 +13,7 @@ import {
ExceptionListSchema,
FoundExceptionListItemSchema,
FoundExceptionListSchema,
deleteListSchema,
exceptionListItemSchema,
listSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { getSavedObjectType } from '@kbn/securitysolution-list-utils';
import { LIST_URL } from '@kbn/securitysolution-list-constants';
@ -23,6 +21,7 @@ import { LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import type { ExceptionListClient } from '../services/exception_lists/exception_list_client';
import { escapeQuotes } from '../services/utils/escape_query';
import { deleteListRequestQuery, deleteListResponse } from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -36,7 +35,7 @@ export const deleteListRoute = (router: ListsPluginRouter): void => {
},
path: LIST_URL,
validate: {
query: buildRouteValidation(deleteListSchema),
query: buildRouteValidation(deleteListRequestQuery),
},
},
async (context, request, response) => {
@ -115,7 +114,7 @@ export const deleteListRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(deleted, listSchema);
const [validated, errors] = validate(deleted, deleteListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -6,15 +6,15 @@
*/
import { transformError } from '@kbn/securitysolution-es-utils';
import {
DuplicateExceptionListQuerySchemaDecoded,
duplicateExceptionListQuerySchema,
exceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { EXCEPTION_LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
DuplicateExceptionListRequestQueryDecoded,
duplicateExceptionListRequestQuery,
duplicateExceptionListResponse,
} from '../../common/api';
import { buildRouteValidation, buildSiemResponse, getExceptionListClient } from './utils';
@ -27,9 +27,9 @@ export const duplicateExceptionsRoute = (router: ListsPluginRouter): void => {
path: `${EXCEPTION_LIST_URL}/_duplicate`,
validate: {
query: buildRouteValidation<
typeof duplicateExceptionListQuerySchema,
DuplicateExceptionListQuerySchemaDecoded
>(duplicateExceptionListQuerySchema),
typeof duplicateExceptionListRequestQuery,
DuplicateExceptionListRequestQueryDecoded
>(duplicateExceptionListRequestQuery),
},
},
async (context, request, response) => {
@ -76,7 +76,7 @@ export const duplicateExceptionsRoute = (router: ListsPluginRouter): void => {
});
}
const [validated, errors] = validate(duplicatedList, exceptionListSchema);
const [validated, errors] = validate(duplicatedList, duplicateExceptionListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -6,10 +6,10 @@
*/
import { transformError } from '@kbn/securitysolution-es-utils';
import { exportExceptionListQuerySchema } from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { exportExceptionListRequestQuery } from '../../common/api';
import { buildRouteValidation, buildSiemResponse, getExceptionListClient } from './utils';
@ -21,7 +21,7 @@ export const exportExceptionsRoute = (router: ListsPluginRouter): void => {
},
path: `${EXCEPTION_LIST_URL}/_export`,
validate: {
query: buildRouteValidation(exportExceptionListQuerySchema),
query: buildRouteValidation(exportExceptionListRequestQuery),
},
},
async (context, request, response) => {

View file

@ -8,10 +8,10 @@
import { Stream } from 'stream';
import { transformError } from '@kbn/securitysolution-es-utils';
import { exportListItemQuerySchema } from '@kbn/securitysolution-io-ts-list-types';
import { LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { exportListItemRequestQuery } from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -25,7 +25,7 @@ export const exportListItemRoute = (router: ListsPluginRouter): void => {
},
path: `${LIST_ITEM_URL}/_export`,
validate: {
query: buildRouteValidation(exportListItemQuerySchema),
query: buildRouteValidation(exportListItemRequestQuery),
},
},
async (context, request, response) => {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
FindEndpointListItemSchemaDecoded,
findEndpointListItemSchema,
foundExceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { ENDPOINT_LIST_ID, ENDPOINT_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
FindEndpointListItemRequestQueryDecoded,
findEndpointListItemRequestQuery,
findEndpointListItemResponse,
} from '../../common/api';
import { buildRouteValidation, buildSiemResponse, getExceptionListClient } from './utils';
@ -27,9 +27,9 @@ export const findEndpointListItemRoute = (router: ListsPluginRouter): void => {
path: `${ENDPOINT_LIST_ITEM_URL}/_find`,
validate: {
query: buildRouteValidation<
typeof findEndpointListItemSchema,
FindEndpointListItemSchemaDecoded
>(findEndpointListItemSchema),
typeof findEndpointListItemRequestQuery,
FindEndpointListItemRequestQueryDecoded
>(findEndpointListItemRequestQuery),
},
},
async (context, request, response) => {
@ -62,7 +62,7 @@ export const findEndpointListItemRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
}
const [validated, errors] = validate(exceptionListItems, foundExceptionListItemSchema);
const [validated, errors] = validate(exceptionListItems, findEndpointListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
FindExceptionListItemSchemaDecoded,
findExceptionListItemSchema,
foundExceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
FindExceptionListItemRequestQueryDecoded,
findExceptionListItemRequestQuery,
findExceptionListItemResponse,
} from '../../common/api';
import { buildRouteValidation, buildSiemResponse, getExceptionListClient } from './utils';
@ -27,9 +27,9 @@ export const findExceptionListItemRoute = (router: ListsPluginRouter): void => {
path: `${EXCEPTION_LIST_ITEM_URL}/_find`,
validate: {
query: buildRouteValidation<
typeof findExceptionListItemSchema,
FindExceptionListItemSchemaDecoded
>(findExceptionListItemSchema),
typeof findExceptionListItemRequestQuery,
FindExceptionListItemRequestQueryDecoded
>(findExceptionListItemRequestQuery),
},
},
async (context, request, response) => {
@ -76,7 +76,7 @@ export const findExceptionListItemRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
}
const [validated, errors] = validate(exceptionListItems, foundExceptionListItemSchema);
const [validated, errors] = validate(exceptionListItems, findExceptionListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
FindExceptionListSchemaDecoded,
findExceptionListSchema,
foundExceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
FindExceptionListRequestQueryDecoded,
findExceptionListRequestQuery,
findExceptionListResponse,
} from '../../common/api';
import { buildRouteValidation, buildSiemResponse, getExceptionListClient } from './utils';
@ -26,9 +26,10 @@ export const findExceptionListRoute = (router: ListsPluginRouter): void => {
},
path: `${EXCEPTION_LIST_URL}/_find`,
validate: {
query: buildRouteValidation<typeof findExceptionListSchema, FindExceptionListSchemaDecoded>(
findExceptionListSchema
),
query: buildRouteValidation<
typeof findExceptionListRequestQuery,
FindExceptionListRequestQueryDecoded
>(findExceptionListRequestQuery),
},
},
async (context, request, response) => {
@ -53,7 +54,7 @@ export const findExceptionListRoute = (router: ListsPluginRouter): void => {
sortField,
sortOrder,
});
const [validated, errors] = validate(exceptionListItems, foundExceptionListSchema);
const [validated, errors] = validate(exceptionListItems, findExceptionListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,15 +7,15 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
FindListItemSchemaDecoded,
findListItemSchema,
foundListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { decodeCursor } from '../services/utils';
import {
FindListItemRequestQueryDecoded,
findListItemRequestQuery,
findListItemResponse,
} from '../../common/api';
import { buildRouteValidation, buildSiemResponse, getListClient } from './utils';
@ -27,9 +27,10 @@ export const findListItemRoute = (router: ListsPluginRouter): void => {
},
path: `${LIST_ITEM_URL}/_find`,
validate: {
query: buildRouteValidation<typeof findListItemSchema, FindListItemSchemaDecoded>(
findListItemSchema
),
query: buildRouteValidation<
typeof findListItemRequestQuery,
FindListItemRequestQueryDecoded
>(findListItemRequestQuery),
},
},
async (context, request, response) => {
@ -83,7 +84,7 @@ export const findListItemRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(exceptionList, foundListItemSchema);
const [validated, errors] = validate(exceptionList, findListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,11 +7,11 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { findListSchema, foundListSchema } from '@kbn/securitysolution-io-ts-list-types';
import { LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { decodeCursor } from '../services/utils';
import { findListRequestQuery, findListResponse } from '../../common/api';
import { buildRouteValidation, buildSiemResponse, getListClient } from './utils';
@ -23,7 +23,7 @@ export const findListRoute = (router: ListsPluginRouter): void => {
},
path: `${LIST_URL}/_find`,
validate: {
query: buildRouteValidation(findListSchema),
query: buildRouteValidation(findListRequestQuery),
},
},
async (context, request, response) => {
@ -68,7 +68,7 @@ export const findListRoute = (router: ListsPluginRouter): void => {
sortField,
sortOrder,
});
const [validated, errors] = validate(exceptionList, foundListSchema);
const [validated, errors] = validate(exceptionList, findListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,7 +7,6 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { findListSchema, foundListsBySizeSchema } from '@kbn/securitysolution-io-ts-list-types';
import {
FIND_LISTS_BY_SIZE,
MAXIMUM_SMALL_IP_RANGE_VALUE_LIST_DASH_SIZE,
@ -17,6 +16,7 @@ import { chunk } from 'lodash';
import type { ListsPluginRouter } from '../types';
import { decodeCursor } from '../services/utils';
import { findListsBySizeRequestQuery, findListsBySizeResponse } from '../../common/api';
import { buildRouteValidation, buildSiemResponse, getListClient } from './utils';
@ -28,7 +28,7 @@ export const findListsBySizeRoute = (router: ListsPluginRouter): void => {
},
path: `${FIND_LISTS_BY_SIZE}`,
validate: {
query: buildRouteValidation(findListSchema),
query: buildRouteValidation(findListsBySizeRequestQuery),
},
},
async (context, request, response) => {
@ -142,7 +142,7 @@ export const findListsBySizeRoute = (router: ListsPluginRouter): void => {
const smallLists = valueLists.data.filter((valueList, index) => listBooleans[index]);
const largeLists = valueLists.data.filter((valueList, index) => !listBooleans[index]);
const [validated, errors] = validate({ largeLists, smallLists }, foundListsBySizeSchema);
const [validated, errors] = validate({ largeLists, smallLists }, findListsBySizeResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -10,12 +10,12 @@ import {
CreateExceptionListItemSchema,
ExceptionListItemSchema,
FoundExceptionListItemSchema,
getExceptionFilterSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_FILTER } from '@kbn/securitysolution-list-constants';
import { buildExceptionFilter } from '../services/exception_lists/build_exception_filter';
import { ListsPluginRouter } from '../types';
import { getExceptionFilterRequest } from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -27,7 +27,7 @@ export const getExceptionFilterRoute = (router: ListsPluginRouter): void => {
},
path: `${EXCEPTION_FILTER}`,
validate: {
body: buildRouteValidation(getExceptionFilterSchema),
body: buildRouteValidation(getExceptionFilterRequest),
},
},
async (context, request, response) => {

View file

@ -9,13 +9,16 @@ import { extname } from 'path';
import { schema } from '@kbn/config-schema';
import { transformError } from '@kbn/securitysolution-es-utils';
import { importExceptionsResponseSchema } from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_URL } from '@kbn/securitysolution-list-constants';
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { ImportQuerySchemaDecoded, importQuerySchema } from '@kbn/securitysolution-io-ts-types';
import type { ListsPluginRouter } from '../types';
import { ConfigType } from '../config';
import {
ImportExceptionsRequestQueryDecoded,
importExceptionsRequestQuery,
importExceptionsResponse,
} from '../../common/api';
import { buildRouteValidation, buildSiemResponse, getExceptionListClient } from './utils';
@ -37,9 +40,10 @@ export const importExceptionsRoute = (router: ListsPluginRouter, config: ConfigT
path: `${EXCEPTION_LIST_URL}/_import`,
validate: {
body: schema.any(), // validation on file object is accomplished later in the handler.
query: buildRouteValidation<typeof importQuerySchema, ImportQuerySchemaDecoded>(
importQuerySchema
),
query: buildRouteValidation<
typeof importExceptionsRequestQuery,
ImportExceptionsRequestQueryDecoded
>(importExceptionsRequestQuery),
},
},
async (context, request, response) => {
@ -63,7 +67,7 @@ export const importExceptionsRoute = (router: ListsPluginRouter, config: ConfigT
overwrite: request.query.overwrite,
});
const [validated, errors] = validate(importsSummary, importExceptionsResponseSchema);
const [validated, errors] = validate(importsSummary, importExceptionsResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });

View file

@ -8,11 +8,11 @@
import { schema } from '@kbn/config-schema';
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { importListItemQuerySchema, listSchema } from '@kbn/securitysolution-io-ts-list-types';
import { LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { ConfigType } from '../config';
import { importListItemRequestQuery, importListItemResponse } from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
import { createStreamFromBuffer } from './utils/create_stream_from_buffer';
@ -36,7 +36,7 @@ export const importListItemRoute = (router: ListsPluginRouter, config: ConfigTyp
path: `${LIST_ITEM_URL}/_import`,
validate: {
body: schema.buffer(),
query: buildRouteValidation(importListItemQuerySchema),
query: buildRouteValidation(importListItemRequestQuery),
},
},
async (context, request, response) => {
@ -70,7 +70,7 @@ export const importListItemRoute = (router: ListsPluginRouter, config: ConfigTyp
version: 1,
});
const [validated, errors] = validate(list, listSchema);
const [validated, errors] = validate(list, importListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {
@ -92,7 +92,7 @@ export const importListItemRoute = (router: ListsPluginRouter, config: ConfigTyp
statusCode: 400,
});
}
const [validated, errors] = validate(importedList, listSchema);
const [validated, errors] = validate(importedList, importListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,10 +7,10 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { listItemSchema, patchListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
import { LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { patchListItemRequest, patchListItemResponse } from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -24,7 +24,7 @@ export const patchListItemRoute = (router: ListsPluginRouter): void => {
},
path: LIST_ITEM_URL,
validate: {
body: buildRouteValidation(patchListItemSchema),
body: buildRouteValidation(patchListItemRequest),
},
},
async (context, request, response) => {
@ -44,7 +44,7 @@ export const patchListItemRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(listItem, listItemSchema);
const [validated, errors] = validate(listItem, patchListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,10 +7,10 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { listSchema, patchListSchema } from '@kbn/securitysolution-io-ts-list-types';
import { LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { patchListRequest, patchListResponse } from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -24,7 +24,7 @@ export const patchListRoute = (router: ListsPluginRouter): void => {
},
path: LIST_URL,
validate: {
body: buildRouteValidation(patchListSchema),
body: buildRouteValidation(patchListRequest),
},
},
async (context, request, response) => {
@ -39,7 +39,7 @@ export const patchListRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(list, listSchema);
const [validated, errors] = validate(list, patchListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
ReadEndpointListItemSchemaDecoded,
exceptionListItemSchema,
readEndpointListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { ENDPOINT_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
ReadEndpointListItemRequestQueryDecoded,
readEndpointListItemRequestQuery,
readEndpointListItemResponse,
} from '../../common/api';
import {
buildRouteValidation,
@ -32,9 +32,9 @@ export const readEndpointListItemRoute = (router: ListsPluginRouter): void => {
path: ENDPOINT_LIST_ITEM_URL,
validate: {
query: buildRouteValidation<
typeof readEndpointListItemSchema,
ReadEndpointListItemSchemaDecoded
>(readEndpointListItemSchema),
typeof readEndpointListItemRequestQuery,
ReadEndpointListItemRequestQueryDecoded
>(readEndpointListItemRequestQuery),
},
},
async (context, request, response) => {
@ -53,7 +53,7 @@ export const readEndpointListItemRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(exceptionListItem, exceptionListItemSchema);
const [validated, errors] = validate(exceptionListItem, readEndpointListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
ReadExceptionListItemSchemaDecoded,
exceptionListItemSchema,
readExceptionListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
ReadExceptionListItemRequestQueryDecoded,
readExceptionListItemRequestQuery,
readExceptionListItemResponse,
} from '../../common/api';
import {
buildRouteValidation,
@ -32,9 +32,9 @@ export const readExceptionListItemRoute = (router: ListsPluginRouter): void => {
path: EXCEPTION_LIST_ITEM_URL,
validate: {
query: buildRouteValidation<
typeof readExceptionListItemSchema,
ReadExceptionListItemSchemaDecoded
>(readExceptionListItemSchema),
typeof readExceptionListItemRequestQuery,
ReadExceptionListItemRequestQueryDecoded
>(readExceptionListItemRequestQuery),
},
},
async (context, request, response) => {
@ -54,7 +54,7 @@ export const readExceptionListItemRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(exceptionListItem, exceptionListItemSchema);
const [validated, errors] = validate(exceptionListItem, readExceptionListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
ReadExceptionListSchemaDecoded,
exceptionListSchema,
readExceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
ReadExceptionListRequestQueryDecoded,
readExceptionListRequestQuery,
readExceptionListResponse,
} from '../../common/api';
import {
buildRouteValidation,
@ -31,9 +31,10 @@ export const readExceptionListRoute = (router: ListsPluginRouter): void => {
},
path: EXCEPTION_LIST_URL,
validate: {
query: buildRouteValidation<typeof readExceptionListSchema, ReadExceptionListSchemaDecoded>(
readExceptionListSchema
),
query: buildRouteValidation<
typeof readExceptionListRequestQuery,
ReadExceptionListRequestQueryDecoded
>(readExceptionListRequestQuery),
},
},
async (context, request, response) => {
@ -53,7 +54,7 @@ export const readExceptionListRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(exceptionList, exceptionListSchema);
const [validated, errors] = validate(exceptionList, readExceptionListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,10 +7,10 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { listItemIndexExistSchema } from '@kbn/securitysolution-io-ts-list-types';
import { LIST_INDEX } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { readListIndexResponse } from '../../common/api';
import { buildSiemResponse } from './utils';
@ -36,7 +36,7 @@ export const readListIndexRoute = (router: ListsPluginRouter): void => {
if (listIndexExists || listItemIndexExists) {
const [validated, errors] = validate(
{ list_index: listIndexExists, list_item_index: listItemIndexExists },
listItemIndexExistSchema
readListIndexResponse
);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
listItemArraySchema,
listItemSchema,
readListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
readListItemArrayResponse,
readListItemRequestQuery,
readListItemResponse,
} from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -28,7 +28,7 @@ export const readListItemRoute = (router: ListsPluginRouter): void => {
},
path: LIST_ITEM_URL,
validate: {
query: buildRouteValidation(readListItemSchema),
query: buildRouteValidation(readListItemRequestQuery),
},
},
async (context, request, response) => {
@ -44,7 +44,7 @@ export const readListItemRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(listItem, listItemSchema);
const [validated, errors] = validate(listItem, readListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {
@ -70,7 +70,7 @@ export const readListItemRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(listItem, listItemArraySchema);
const [validated, errors] = validate(listItem, readListItemArrayResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,10 +7,10 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { listSchema, readListSchema } from '@kbn/securitysolution-io-ts-list-types';
import { LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { readListRequestQuery, readListResponse } from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -24,7 +24,7 @@ export const readListRoute = (router: ListsPluginRouter): void => {
},
path: LIST_URL,
validate: {
query: buildRouteValidation(readListSchema),
query: buildRouteValidation(readListRequestQuery),
},
},
async (context, request, response) => {
@ -39,7 +39,7 @@ export const readListRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(list, listSchema);
const [validated, errors] = validate(list, readListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
SummaryExceptionListSchemaDecoded,
exceptionListSummarySchema,
summaryExceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
SummaryExceptionListRequestQueryDecoded,
summaryExceptionListRequestQuery,
summaryExceptionListResponse,
} from '../../common/api';
import {
buildRouteValidation,
@ -32,9 +32,9 @@ export const summaryExceptionListRoute = (router: ListsPluginRouter): void => {
path: `${EXCEPTION_LIST_URL}/summary`,
validate: {
query: buildRouteValidation<
typeof summaryExceptionListSchema,
SummaryExceptionListSchemaDecoded
>(summaryExceptionListSchema),
typeof summaryExceptionListRequestQuery,
SummaryExceptionListRequestQueryDecoded
>(summaryExceptionListRequestQuery),
},
},
async (context, request, response) => {
@ -55,7 +55,10 @@ export const summaryExceptionListRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(exceptionListSummary, exceptionListSummarySchema);
const [validated, errors] = validate(
exceptionListSummary,
summaryExceptionListResponse
);
if (errors != null) {
return response.ok({ body: exceptionListSummary });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
UpdateEndpointListItemSchemaDecoded,
exceptionListItemSchema,
updateEndpointListItemSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { ENDPOINT_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
UpdateEndpointListItemRequestDecoded,
updateEndpointListItemRequest,
updateEndpointListItemResponse,
} from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -29,9 +29,9 @@ export const updateEndpointListItemRoute = (router: ListsPluginRouter): void =>
path: ENDPOINT_LIST_ITEM_URL,
validate: {
body: buildRouteValidation<
typeof updateEndpointListItemSchema,
UpdateEndpointListItemSchemaDecoded
>(updateEndpointListItemSchema),
typeof updateEndpointListItemRequest,
UpdateEndpointListItemRequestDecoded
>(updateEndpointListItemRequest),
},
},
async (context, request, response) => {
@ -77,7 +77,7 @@ export const updateEndpointListItemRoute = (router: ListsPluginRouter): void =>
});
}
} else {
const [validated, errors] = validate(exceptionListItem, exceptionListItemSchema);
const [validated, errors] = validate(exceptionListItem, updateEndpointListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,15 +7,15 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
UpdateExceptionListItemSchemaDecoded,
exceptionListItemSchema,
updateExceptionListItemSchema,
updateExceptionListItemValidate,
} from '@kbn/securitysolution-io-ts-list-types';
import { updateExceptionListItemValidate } from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
UpdateExceptionListItemRequestDecoded,
updateExceptionListItemRequest,
updateExceptionListItemResponse,
} from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -30,9 +30,9 @@ export const updateExceptionListItemRoute = (router: ListsPluginRouter): void =>
path: EXCEPTION_LIST_ITEM_URL,
validate: {
body: buildRouteValidation<
typeof updateExceptionListItemSchema,
UpdateExceptionListItemSchemaDecoded
>(updateExceptionListItemSchema),
typeof updateExceptionListItemRequest,
UpdateExceptionListItemRequestDecoded
>(updateExceptionListItemRequest),
},
},
async (context, request, response) => {
@ -93,7 +93,10 @@ export const updateExceptionListItemRoute = (router: ListsPluginRouter): void =>
});
}
} else {
const [validated, errors] = validate(exceptionListItem, exceptionListItemSchema);
const [validated, errors] = validate(
exceptionListItem,
updateExceptionListItemResponse
);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,14 +7,14 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import {
UpdateExceptionListSchemaDecoded,
exceptionListSchema,
updateExceptionListSchema,
} from '@kbn/securitysolution-io-ts-list-types';
import { EXCEPTION_LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import {
UpdateExceptionListRequestDecoded,
updateExceptionListRequest,
updateExceptionListResponse,
} from '../../common/api';
import {
buildRouteValidation,
@ -32,9 +32,9 @@ export const updateExceptionListRoute = (router: ListsPluginRouter): void => {
path: EXCEPTION_LIST_URL,
validate: {
body: buildRouteValidation<
typeof updateExceptionListSchema,
UpdateExceptionListSchemaDecoded
>(updateExceptionListSchema),
typeof updateExceptionListRequest,
UpdateExceptionListRequestDecoded
>(updateExceptionListRequest),
},
},
async (context, request, response) => {
@ -79,7 +79,7 @@ export const updateExceptionListRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(list, exceptionListSchema);
const [validated, errors] = validate(list, updateExceptionListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,10 +7,10 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { listItemSchema, updateListItemSchema } from '@kbn/securitysolution-io-ts-list-types';
import { LIST_ITEM_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { updateListItemRequest, updateListItemResponse } from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -24,7 +24,7 @@ export const updateListItemRoute = (router: ListsPluginRouter): void => {
},
path: LIST_ITEM_URL,
validate: {
body: buildRouteValidation(updateListItemSchema),
body: buildRouteValidation(updateListItemRequest),
},
},
async (context, request, response) => {
@ -44,7 +44,7 @@ export const updateListItemRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(listItem, listItemSchema);
const [validated, errors] = validate(listItem, updateListItemResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {

View file

@ -7,10 +7,10 @@
import { validate } from '@kbn/securitysolution-io-ts-utils';
import { transformError } from '@kbn/securitysolution-es-utils';
import { listSchema, updateListSchema } from '@kbn/securitysolution-io-ts-list-types';
import { LIST_URL } from '@kbn/securitysolution-list-constants';
import type { ListsPluginRouter } from '../types';
import { updateListRequest, updateListResponse } from '../../common/api';
import { buildRouteValidation, buildSiemResponse } from './utils';
@ -24,7 +24,7 @@ export const updateListRoute = (router: ListsPluginRouter): void => {
},
path: LIST_URL,
validate: {
body: buildRouteValidation(updateListSchema),
body: buildRouteValidation(updateListRequest),
},
},
async (context, request, response) => {
@ -39,7 +39,7 @@ export const updateListRoute = (router: ListsPluginRouter): void => {
statusCode: 404,
});
} else {
const [validated, errors] = validate(list, listSchema);
const [validated, errors] = validate(list, updateListResponse);
if (errors != null) {
return siemResponse.error({ body: errors, statusCode: 500 });
} else {