* moved legacy actions api to legacy folder * introduced connector create api * added new delete route * added new execute and get_all * introduced all connector APIs * renamed action to connector in Apis * comment on camel case type * fixed va * updated docs * legacy title * corrected APIs * legacy links * added linik to deprecatred APIs * added linik to deprecatred APIs from index * moved legacy apis down one level * Apply suggestions from code review Co-authored-by: ymao1 <ying.mao@elastic.co> * renamed route file for connectorTypesRoute * define legacy route * Update docs/api/actions-and-connectors/legacy/index.asciidoc Co-authored-by: Mike Côté <mikecote@users.noreply.github.com> * api docs Co-authored-by: ymao1 <ying.mao@elastic.co> Co-authored-by: Mike Côté <mikecote@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
/*
|
|
* 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 { schema } from '@kbn/config-schema';
|
|
import { IRouter } from 'kibana/server';
|
|
import { ILicenseState } from '../lib';
|
|
import { BASE_ACTION_API_PATH } from '../../common';
|
|
import { ActionsRequestHandlerContext } from '../types';
|
|
import { verifyAccessAndContext } from './verify_access_and_context';
|
|
|
|
const paramSchema = schema.object({
|
|
id: schema.string(),
|
|
});
|
|
|
|
export const deleteActionRoute = (
|
|
router: IRouter<ActionsRequestHandlerContext>,
|
|
licenseState: ILicenseState
|
|
) => {
|
|
router.delete(
|
|
{
|
|
path: `${BASE_ACTION_API_PATH}/connector/{id}`,
|
|
validate: {
|
|
params: paramSchema,
|
|
},
|
|
},
|
|
router.handleLegacyErrors(
|
|
verifyAccessAndContext(licenseState, async function (context, req, res) {
|
|
const actionsClient = context.actions.getActionsClient();
|
|
const { id } = req.params;
|
|
await actionsClient.delete({ id });
|
|
return res.noContent();
|
|
})
|
|
)
|
|
);
|
|
};
|