kibana/x-pack/plugins/apm/server/routes/service_nodes.ts
Nathan L Smith d1ed207945
APM TypeScript improvements (#68572)
* Add `compilerOptions.noErrorTrunctation` to the tsconfig template
* Remove unused parameters

Not adding `noUnusedParamaters` to the tsconfig since we get too many hits from dependencies when running `tsc`. These do show up in the editor as warnings, though.
2020-06-08 17:56:06 -05:00

31 lines
982 B
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import * as t from 'io-ts';
import { createRoute } from './create_route';
import { setupRequest } from '../lib/helpers/setup_request';
import { getServiceNodes } from '../lib/service_nodes';
import { rangeRt, uiFiltersRt } from './default_api_types';
export const serviceNodesRoute = createRoute(() => ({
path: '/api/apm/services/{serviceName}/serviceNodes',
params: {
path: t.type({
serviceName: t.string,
}),
query: t.intersection([rangeRt, uiFiltersRt]),
},
handler: async ({ context, request }) => {
const setup = await setupRequest(context, request);
const { params } = context;
const { serviceName } = params.path;
return getServiceNodes({
setup,
serviceName,
});
},
}));